check for dirs instead of commands for package counting

This commit is contained in:
Gauge Krahe committed 2020-07-28 09:22:17 +10:00
1 parent d68f934833
commit b7e8e39f56
1 file changed
+4 -2
+4 -2
View File
@@ -3,6 +3,8 @@
# this is my attempt at trying to make a fetch using only posix shell # this is my attempt at trying to make a fetch using only posix shell
# and as little if none external utilities as I can. # and as little if none external utilities as I can.
# #
# shellcheck disable=SC2034
#
## Terminal ## Terminal
@@ -30,14 +32,14 @@ done
## Packages ## Packages
# horribly inefficient, I know. # horribly inefficient, I know.
command -v pacman-key >/dev/null 2>&1 && { [ -d /var/lib/pacman/local ] && {
pkgs=0 pkgs=0
for i in /var/lib/pacman/local/*; do for i in /var/lib/pacman/local/*; do
pkgs=$(( pkgs + 1 )) pkgs=$(( pkgs + 1 ))
done done
} }
command -v xbps-install >/dev/null 2>&1 && { [ -d /var/db/xbps ] && {
pkgs=0 pkgs=0
for i in /var/db/xbps/*; do for i in /var/db/xbps/*; do
pkgs=$(( pkgs + 1 )) pkgs=$(( pkgs + 1 ))