From dccf7a72e81d95f734389d0c6dbcfa2c3b857eac Mon Sep 17 00:00:00 2001 From: darealshinji Date: Sat, 20 Jun 2015 19:03:18 +0200 Subject: [PATCH] Count Chocolatey packages in Cygwin if present See https://chocolatey.org/ The path `C:\ProgramData\chocolatey` is automatically set during install and can't be changed without modifying the install script, so looking there for package entries should be a reliable method. --- screenfetch-dev | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/screenfetch-dev b/screenfetch-dev index 96e7c5e..dcfc563 100755 --- a/screenfetch-dev +++ b/screenfetch-dev @@ -877,7 +877,14 @@ detectpkgs () { pkgs=$(if TMPDIR=/dev/null ASSUME_ALWAYS_YES=1 PACKAGESITE=file:///nonexistent pkg info pkg >/dev/null 2>&1; then pkg info | wc -l | awk '{print $1}'; else pkg_info | wc -l | awk '{sub(" ", "");print $1}'; fi) ;; - 'Cygwin') cygfix=2; pkgs=$(($(cygcheck -cd | wc -l)-$cygfix)) ;; + 'Cygwin') + cygfix=2 + pkgs=$(($(cygcheck -cd | wc -l) - ${cygfix})) + if [ -d "/cygdrive/c/ProgramData/chocolatey/lib" ]; then + chocopkgs=$(( $(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l) )) + pkgs=$((${pkgs} + ${chocopkgs})) + fi + ;; esac verboseOut "Finding current package count...found as '$pkgs'" }