From d39bebb2a42e2f34c1badde4ebb439cf26aeef7f Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sun, 23 Oct 2016 18:36:59 +0700 Subject: [PATCH 1/2] 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 } From 24e7216777841a7942e0ef7a236792d648c2740a Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Sun, 23 Oct 2016 18:41:22 +0700 Subject: [PATCH 2/2] Solaris: Strip out crap from getdistro output --- neofetch | 1 + 1 file changed, 1 insertion(+) diff --git a/neofetch b/neofetch index 87830da8..d9dba1b3 100755 --- a/neofetch +++ b/neofetch @@ -233,6 +233,7 @@ getdistro() { "on" | "tiny") distro="$(awk 'NR==1{print $1 " " $2;}' /etc/release)" ;; *) distro="$(awk 'NR==1{print $1 " " $2 " " $3;}' /etc/release)" ;; esac + distro="${distro/\(*}" ;; esac