From 26f68ab0608bfbde79f1dafdc3edd25c75944bc5 Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Mon, 1 Aug 2016 16:03:14 +0700 Subject: [PATCH 1/2] Updated installation instructions Included: - Added Installation Instructions for Slackware - Fix for Gentoo's instruction on wget - Small changes for Void --- README.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index fac7350f..762a0621 100644 --- a/README.md +++ b/README.md @@ -37,6 +37,7 @@ Have a look at the wiki, I've updated/added some new pages!
- [Fedora / RHEL / CentOS](#fedora--rhel--centos) - [Void Linux](#void-linux) - [BunsenLabs](#bunsenlabs) + - [Slackware](#slackware) - [Mac OS X](#mac-os-x) - [Others](#others) - [Post Install](#post-install) @@ -169,6 +170,7 @@ https://github.com/dylanaraps/neofetch/wiki/Following-HEAD - [Fedora / RHEL / CentOS](#fedora--rhel--centos) - [Void Linux](#void-linux) - [BunsenLabs](#bunsenlabs) +- [Slackware](#slackware) - [Mac OS X](#mac-os-x) - [Others](#others) @@ -181,7 +183,7 @@ https://github.com/dylanaraps/neofetch/wiki/Following-HEAD ### Gentoo / Funtoo 1. Add the 3rd party repo - - `# wget https://git.io/vocNV -O /etc/portage/repos.conf/konimex.conf` + - `# wget -O /etc/portage/repos.conf/konimex.conf https://git.io/vocNV` 2. Sync the repo - `# emerge --sync konimex` 3. To enable additional features such as w3m and music support, enable the appropriate USE flags. For example: @@ -255,8 +257,9 @@ Alternatively: - `sudo dnf install neofetch` ### Void Linux -1. Install it from the official repositories - - `sudo xbps-install -S neofetch` +Install it from the official repositories + +- `sudo xbps-install -S neofetch` ### BunsenLabs Neofetch is available in the official repos. @@ -264,6 +267,10 @@ Neofetch is available in the official repos. 1. `sudo apt-get update` 2. `sudo apt-get install neofetch` +### Slackware + +Download the files from [SlackBuilds](https://slackbuilds.org/repository/14.2/desktop/neofetch/) and follow [their instructions](https://slackbuilds.org/howto/). + ### Mac OS X 1. Install `neofetch` with Homebrew From 2e64ff37cd9aeb0a7f19175bf990d0f1d28aaafb Mon Sep 17 00:00:00 2001 From: Muhammad Herdiansyah Date: Tue, 2 Aug 2016 17:52:01 +0700 Subject: [PATCH 2/2] Added Solaris support --- neofetch | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 5 deletions(-) diff --git a/neofetch b/neofetch index f84d71e1..b8e53400 100755 --- a/neofetch +++ b/neofetch @@ -442,6 +442,7 @@ case "$(uname)" in "Darwin") os="$(sw_vers -productName)" ;; *"BSD" | "DragonFly") os="BSD" ;; "CYGWIN"*) os="Windows" ;; + "SunOS") os="Solaris" ;; *) printf "%s\n" "Unknown OS detected: $(uname)"; exit 1 ;; esac @@ -511,6 +512,10 @@ getdistro () { distro="${distro/Caption'='}" distro="${distro/Microsoft }" ;; + + "Solaris") + distro="$(nawk 'NR==1{gsub(/^ \t]+|[ \t]+$/,""); printf $1 " " $2;}' /etc/release)" + ;; esac # Get architecture @@ -610,6 +615,10 @@ getuptime () { uptime="up $days $hours $minutes" ;; + + "Solaris") + uptime="$(uptime | /usr/xpg4/bin/awk -F ':[0-9]{2}+[a-z][a-z] |(, ){1}+' '{printf $2}')" + ;; esac # Make the output of uptime smaller. @@ -712,6 +721,10 @@ 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 } @@ -1110,6 +1123,29 @@ getcpu () { cpu="$cpu @ ${speed}GHz" ;; + + "Solaris") + # Get cpuname + cpu="$(psrinfo -pv | tail -1)" + cpu="${cpu/[0-9]\.*}" + cpu="${cpu/ @*}" + + # Get cpu speed + speed="$(psrinfo -v | tail -2 | head -1 | awk '{print $6}')" + speed="$((speed / 100))" + + # Get cpu cores + cores="$(kstat -m cpu_info | grep "chip_id" | wc -l | tr -d ' ')" + + # Fix for speeds under 1ghz + if [ -z "${speed:1}" ]; then + speed="0.${speed}" + else + speed="${speed:0:1}.${speed:1}" + fi + + cpu="$cpu @ ${speed}GHz" + ;; esac @@ -1165,12 +1201,13 @@ getcpu_usage () { cpu_usage="${cpu_usage//[[:space:]]}" ;; - "Linux" | "Mac OS X" | "iPhone OS" | "BSD") + "Linux" | "Mac OS X" | "iPhone OS" | "BSD" | "Solaris") # Get cores if unset if [ -z "$cores" ]; then case "$os" in "Linux") cores="$(awk -F ': ' '/siblings/ {printf $2; exit}' /proc/cpuinfo)" ;; "Mac OS X" | "BSD") cores="$(sysctl -n hw.ncpu)" ;; + "Solaris") cores="$(kstat -m cpu_info | grep "chip_id" | wc -l | tr -d ' ')" esac fi @@ -1335,7 +1372,7 @@ getgpu () { esac ;; - "BSD") + "BSD" | "Solaris") case "$distro" in "FreeBSD"*) gpu="$(pciconf -lv 2>/dev/null | grep -B 4 "VGA" | grep "device")" @@ -1418,6 +1455,12 @@ getmemory () { memtotal="$(($(sysctl -n hw.physmem) / 1024 / 1024))" memused="$((memtotal - memfree))" ;; + + "Solaris") + memtotal="$(prtconf | grep Memory | head -1 | awk 'BEGIN {FS=" "} {print $3}')" + memfree="$(($(sar -r 1 1 | tail -1 | awk 'BEGIN {FS=" "} {print $2}') / 1024))" + memused="$((memtotal - memfree))" + ;; esac memory="${memused}MB / ${memtotal}MB" @@ -1515,7 +1558,7 @@ getsong () { getresolution () { case "$os" in - "Linux" | "BSD") + "Linux" | "BSD" | "Solaris") if type -p xrandr >/dev/null 2>&1; then case "$refresh_rate" in "on") resolution="$(xrandr --nograb --current | awk 'match($0,/[0-9]*\.[0-9]*\*/) {printf $1 " @ " substr($0,RSTART,RLENGTH) "Hz, "}')" ;; @@ -1831,7 +1874,7 @@ gettermfont () { getdisk () { # df flags case "$os" in - "Linux" | "iPhone OS" | "Windows") df_flags="-h -l --total" ;; + "Linux" | "iPhone OS" | "Windows" | "Solaris") df_flags="-h -l --total" ;; "Mac OS X" | "BSD") case "$distro" in "FreeBSD"* | *"OS X"* ) df_flags="-H / -l" ;; @@ -1987,7 +2030,7 @@ getlocalip () { [ -z "$localip" ] && localip="$(ipconfig getifaddr en1)" ;; - "BSD") + "BSD" | "Solaris") localip="$(ifconfig | awk '/broadcast/ {print $2}')" ;; @@ -2069,6 +2112,11 @@ getbirthday () { birthday="$(ls -alct --full-time /cygdrive/c/Windows/explorer.exe | awk '{printf $8 " " $9}')" date_cmd="$(date -d"$birthday" "$birthday_format")" ;; + + "Solaris") + birthday="$(ls -alct --full-time /var/sadm/system/logs/install_log | awk '{printf $6 " " $7}')" + date_cmd="$(date -d"$birthday" "$birthday_format")" + ;; esac # Strip seconds from time output