From 5fc68226dc255908ec5516593fa1b0145da71c54 Mon Sep 17 00:00:00 2001 From: Ting-Wei Lan Date: Thu, 10 Apr 2014 19:08:39 +0800 Subject: bash_include: 現在可偵測 FreeBSD 系統是否使用 pkgng 了 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bash_include | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'bash_include') diff --git a/bash_include b/bash_include index f52bcdb..a9e647f 100644 --- a/bash_include +++ b/bash_include @@ -1433,13 +1433,19 @@ function rpmsize () { } function freebsd_ports_should_rebuild () { + if [ -f "/var/db/pkg/local.sqlite" ]; then + WITH_PKGNG="true" + pkg_which_cmd="pkg which -q" + else + pkg_which_cmd="pkg_info -q -W" + fi reqcomp=$(ldd -f '%a %o %p\n' \ /usr/local/bin/* /usr/local/sbin/* \ /usr/local/lib/* /usr/local/libexec/* \ /usr/local/libexec/*/* \ 2>/dev/null | safe_grep 'not found' | \ { while read oneline; do echo ${oneline} | cut -d ' ' -f 1; done; } | uniq) - reqpkg=$({ for i in $reqcomp; do pkg_info -q -W $i; done } | sort | uniq) + reqpkg=$({ for i in $reqcomp; do $pkg_which_cmd $i; done } | sort | uniq) echo $reqpkg } -- cgit