From d39bebb2a42e2f34c1badde4ebb439cf26aeef7f Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sun, 23 Oct 2016 18:36:59 +0700 Subject: [PATCH] Solaris: Unified package detection with Linux Some OpenSolaris/illumos-based distribution used various Linux package managers such as dpkg, rpm, and portage (see more at http://wiki.illumos.org/display/illumos/Distributions). It would make sense for Solaris' case to be unified with Linux. However, Linux's `pkg` detection (I don't know which distro is that) are vastly different from Oracle Solaris/OpenIndiana's `pkg`, so a workaround is used. --- neofetch | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index d0011a13..87830da8 100755 --- a/neofetch +++ b/neofetch @@ -343,7 +343,7 @@ getuptime() { getpackages() { case "$os" in - "Linux" | "iPhone OS") + "Linux" | "iPhone OS" | "Solaris") type -p pacman >/dev/null 2>&1 && \ packages="$(pacman -Qq --color never | wc -l)" @@ -367,6 +367,7 @@ getpackages() { type -p pkg >/dev/null 2>&1 && \ packages="$((packages+=$(ls -1 /var/db/pkg | wc -l)))" + [ "$packages" == "0" ] && packages="$((packages+=$(pkg list | wc -l)))" type -p emerge >/dev/null 2>&1 && \ packages="$((packages+=$(ls -d /var/db/pkg/*/* | wc -l)))" @@ -426,10 +427,6 @@ getpackages() { [ -d "/cygdrive/c/ProgramData/chocolatey/lib" ] && \ packages="$((packages+=$(ls -1 /cygdrive/c/ProgramData/chocolatey/lib | wc -l)))" ;; - - "Solaris") - packages="$(pkg list | wc -l)" - ;; esac }