Remove check for 'df' as all OS we support will have it installed
This commit is contained in:
parent
5048dda2aa
commit
5145f40125
1 changed files with 20 additions and 22 deletions
42
fetch
42
fetch
|
@ -1012,32 +1012,30 @@ getgtkfont () {
|
||||||
}
|
}
|
||||||
|
|
||||||
getdisk () {
|
getdisk () {
|
||||||
if type -p df >/dev/null 2>&1; then
|
# df flags
|
||||||
# df flags
|
case "$os" in
|
||||||
case "$os" in
|
"Linux" | "Windows") df_flags="-h --total" ;;
|
||||||
"Linux" | "Windows") df_flags="-h --total" ;;
|
"Mac OS X") df_flags="-H /" ;;
|
||||||
"Mac OS X") df_flags="-H /" ;;
|
|
||||||
|
|
||||||
*"BSD")
|
*"BSD")
|
||||||
case "$os" in
|
case "$os" in
|
||||||
"FreeBSD") df_flags="-h -c" ;;
|
"FreeBSD") df_flags="-h -c" ;;
|
||||||
*) disk="Unknown"; return ;;
|
*) disk="Unknown"; return ;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Get the disk info
|
# Get the disk info
|
||||||
disk=$(df $df_flags 2>/dev/null | awk 'END{print $2 ":" $3 ":" $5}')
|
disk=$(df $df_flags 2>/dev/null | awk 'END{print $2 ":" $3 ":" $5}')
|
||||||
|
|
||||||
# Format the output
|
# Format the output
|
||||||
disk_used=${disk#*:}
|
disk_used=${disk#*:}
|
||||||
disk_used=${disk_used%%:*}
|
disk_used=${disk_used%%:*}
|
||||||
disk_total=${disk%%:*}
|
disk_total=${disk%%:*}
|
||||||
disk_total_per=${disk#*:*:}
|
disk_total_per=${disk#*:*:}
|
||||||
|
|
||||||
# Put it all together
|
# Put it all together
|
||||||
disk="${disk_used} / ${disk_total} (${disk_total_per})"
|
disk="${disk_used} / ${disk_total} (${disk_total_per})"
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
getcols () {
|
getcols () {
|
||||||
|
|
Loading…
Reference in a new issue