Packages: Separate FreeBSD pkg from Linux/Solaris pkg detection

This commit is contained in:
Muhammad Herdiansyah 2016-12-18 11:52:09 +07:00
parent 5f48a04bda
commit 2bad735fb3

View file

@ -450,9 +450,12 @@ get_packages() {
packages="$((packages+=$(pkg_info | wc -l)))"
if type -p pkg >/dev/null; then
packages="$((packages+=$(ls -1 /var/db/pkg | wc -l)))"
(("$packages" == "0")) && packages="$((packages+=$(pkg info | wc -l)))"
(("$packages" == "0")) && packages="$((packages+=$(pkg list | wc -l)))"
case "$kernel_name" in
"FreeBSD") packages="$((packages+=$(pkg info | wc -l)))" ;;
*)
packages="$((packages+=$(ls -1 /var/db/pkg | wc -l)))"
(("$packages" == "0")) && packages="$((packages+=$(pkg list | wc -l)))"
esac
fi
;;