wildcard distro suffixes

This commit is contained in:
Dylan 2016-02-01 14:56:53 +11:00
parent 008a0bd43c
commit da7667202f

30
fetch
View file

@ -559,7 +559,7 @@ getpackages () {
packages="$(rpm -qa | wc -l)" packages="$(rpm -qa | wc -l)"
;; ;;
"CRUX") "CRUX"*)
packages="$(pkginfo -i | wc -l)" packages="$(pkginfo -i | wc -l)"
;; ;;
@ -585,11 +585,11 @@ getpackages () {
fi fi
;; ;;
"OpenBSD" | "NetBSD") "OpenBSD"* | "NetBSD"*)
packages=$(pkg_info | wc -l) packages=$(pkg_info | wc -l)
;; ;;
"FreeBSD") "FreeBSD"*)
packages=$(pkg info | wc -l) packages=$(pkg info | wc -l)
;; ;;
@ -735,7 +735,7 @@ getcpu () {
*"BSD") *"BSD")
case "$distro" in case "$distro" in
"OpenBSD" | "FreeBSD") "OpenBSD"* | "FreeBSD"*)
# Get cpu name # Get cpu name
cpu="$(sysctl -n hw.model)" cpu="$(sysctl -n hw.model)"
cpu=${cpu/ @*} cpu=${cpu/ @*}
@ -744,13 +744,13 @@ getcpu () {
# Get cpu speed # Get cpu speed
case "$distro" in case "$distro" in
"OpenBSD") speed=$(sysctl -n hw.cpuspeed) ;; "OpenBSD"*) speed=$(sysctl -n hw.cpuspeed) ;;
"FreeBSD") speed=$(sysctl -n hw.clockrate) ;; "FreeBSD"*) speed=$(sysctl -n hw.clockrate) ;;
esac esac
speed=$((speed / 100)) speed=$((speed / 100))
;; ;;
"NetBSD") "NetBSD"*)
# Get cpu name # Get cpu name
cpu="$(grep -F 'model name' /proc/cpuinfo)" cpu="$(grep -F 'model name' /proc/cpuinfo)"
cpu=${cpu/model name*: } cpu=${cpu/model name*: }
@ -885,7 +885,7 @@ getgpu () {
*"BSD") *"BSD")
case "$distro" in case "$distro" in
"FreeBSD") "FreeBSD"*)
gpu=$(pciconf -lv 2>/dev/null | grep -B 4 "VGA" | grep "device") gpu=$(pciconf -lv 2>/dev/null | grep -B 4 "VGA" | grep "device")
gpu=${gpu/device*= } gpu=${gpu/device*= }
gpu=${gpu//\'} gpu=${gpu//\'}
@ -957,14 +957,14 @@ getmemory () {
"OpenBSD" | "BSD") "OpenBSD" | "BSD")
case "$distro" in case "$distro" in
"OpenBSD" | "FreeBSD") "OpenBSD"* | "FreeBSD"*)
memtotal=$(dmesg | awk '/real mem/ {printf $5}') memtotal=$(dmesg | awk '/real mem/ {printf $5}')
memtotal=${memtotal/\(} memtotal=${memtotal/\(}
memtotal=${memtotal/MB\)} memtotal=${memtotal/MB\)}
case "$distro" in case "$distro" in
"OpenBSD") memfree=$(top -d 1 | awk '/Real:/ {printf $6}') ;; "OpenBSD"*) memfree=$(top -d 1 | awk '/Real:/ {printf $6}') ;;
"FreeBSD") memfree=$(top -d 1 | awk '/Mem:/ {printf $10}') ;; "FreeBSD"*) memfree=$(top -d 1 | awk '/Mem:/ {printf $10}') ;;
esac esac
memfree=${memfree/M} memfree=${memfree/M}
@ -972,7 +972,7 @@ getmemory () {
memory="${memused}MB / ${memtotal}MB" memory="${memused}MB / ${memtotal}MB"
;; ;;
"NetBSD") "NetBSD"*)
memfree=$(($(vmstat | awk 'END{printf $4}') / 1000)) memfree=$(($(vmstat | awk 'END{printf $4}') / 1000))
memused=$(($(vmstat | awk 'END{printf $3}') / 1000)) memused=$(($(vmstat | awk 'END{printf $3}') / 1000))
memtotal=$((memused + memfree)) memtotal=$((memused + memfree))
@ -1192,17 +1192,17 @@ getbirthday () {
*"BSD") *"BSD")
case "$distro" in case "$distro" in
"OpenBSD") "OpenBSD"*)
birthday="$(ls -alctT / | awk '/lost\+found/ {printf $6 " " $7 " " $9 " " $8}')" birthday="$(ls -alctT / | awk '/lost\+found/ {printf $6 " " $7 " " $9 " " $8}')"
birthday_shorthand="on" birthday_shorthand="on"
;; ;;
"FreeBSD") "FreeBSD"*)
birthday="$(ls -alctT /etc/hostid | awk '{printf $6 " " $7 " " $9 " " $8}')" birthday="$(ls -alctT /etc/hostid | awk '{printf $6 " " $7 " " $9 " " $8}')"
date_cmd="$(date -j -f "%b %d %Y" "$birthday" "+%a %d %b %Y %l:%M %p")" date_cmd="$(date -j -f "%b %d %Y" "$birthday" "+%a %d %b %Y %l:%M %p")"
;; ;;
"NetBSD") "NetBSD"*)
birthday="$(ls -alctT /etc/defaults/rc.conf | awk '{printf $6 " " $7 " " $9 " " $8}')" birthday="$(ls -alctT /etc/defaults/rc.conf | awk '{printf $6 " " $7 " " $9 " " $8}')"
birthday_shorthand="on" birthday_shorthand="on"
;; ;;