Remove duplicate blocks inside of getcpu and getmemory
This commit is contained in:
parent
b52c4f1745
commit
075c487064
1 changed files with 11 additions and 31 deletions
42
fetch
42
fetch
|
@ -501,7 +501,6 @@ getuptime () {
|
||||||
*)
|
*)
|
||||||
uptime="Unknown"
|
uptime="Unknown"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Make the output of uptime smaller.
|
# Make the output of uptime smaller.
|
||||||
|
@ -733,7 +732,7 @@ getcpu () {
|
||||||
|
|
||||||
*"BSD")
|
*"BSD")
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
"OpenBSD")
|
"OpenBSD" | "FreeBSD")
|
||||||
# Get cpu name
|
# Get cpu name
|
||||||
cpu="$(sysctl -n hw.model)"
|
cpu="$(sysctl -n hw.model)"
|
||||||
cpu=${cpu/ @*}
|
cpu=${cpu/ @*}
|
||||||
|
@ -741,19 +740,10 @@ getcpu () {
|
||||||
cpu=${cpu% }
|
cpu=${cpu% }
|
||||||
|
|
||||||
# Get cpu speed
|
# Get cpu speed
|
||||||
speed=$(sysctl -n hw.cpuspeed)
|
case "$distro" in
|
||||||
speed=$((speed / 100))
|
"OpenBSD") speed=$(sysctl -n hw.cpuspeed) ;;
|
||||||
;;
|
"FreeBSD") speed=$(sysctl -n hw.clockrate) ;;
|
||||||
|
esac
|
||||||
"FreeBSD")
|
|
||||||
# Get cpu name
|
|
||||||
cpu="$(sysctl -n hw.model)"
|
|
||||||
cpu=${cpu/ @*}
|
|
||||||
cpu=${cpu// }
|
|
||||||
cpu=${cpu% }
|
|
||||||
|
|
||||||
# Get cpu speed
|
|
||||||
speed="$(sysctl -n hw.clockrate)"
|
|
||||||
speed=$((speed / 100))
|
speed=$((speed / 100))
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
@ -964,24 +954,15 @@ getmemory () {
|
||||||
|
|
||||||
"OpenBSD" | "BSD")
|
"OpenBSD" | "BSD")
|
||||||
case "$distro" in
|
case "$distro" in
|
||||||
"OpenBSD")
|
"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\)}
|
||||||
|
|
||||||
memfree=$(top -d 1 | awk '/Real:/ {printf $6}')
|
case "$distro" in
|
||||||
memfree=${memfree/M}
|
"OpenBSD") memfree=$(top -d 1 | awk '/Real:/ {printf $6}') ;;
|
||||||
|
"FreeBSD") memfree=$(top -d 1 | awk '/Mem:/ {printf $10}') ;;
|
||||||
memused=$((memtotal - memfree))
|
esac
|
||||||
memory="${memused}MB / ${memtotal}MB"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"FreeBSD")
|
|
||||||
memtotal=$(dmesg | awk '/real mem/ {printf $5}')
|
|
||||||
memtotal=${memtotal/\(}
|
|
||||||
memtotal=${memtotal/MB\)}
|
|
||||||
|
|
||||||
memfree=$(top -d 1 | awk '/Mem:/ {printf $10}')
|
|
||||||
memfree=${memfree/M}
|
memfree=${memfree/M}
|
||||||
|
|
||||||
memused=$((memtotal - memfree))
|
memused=$((memtotal - memfree))
|
||||||
|
@ -1250,9 +1231,8 @@ getbirthday () {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Toggle showing the time
|
# Toggle showing the time
|
||||||
if [ "$birthday_time" == "off" ]; then
|
[ "$birthday_time" == "off" ] && \
|
||||||
birthday=${birthday/??:??*}
|
birthday=${birthday/??:??*}
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
Loading…
Reference in a new issue