fix motd.sh disks for btrfs
This commit is contained in:
parent
025f53864b
commit
eaf18459e9
16
motd.sh
16
motd.sh
@ -109,7 +109,7 @@ max_usage=80
|
||||
bar_width=50
|
||||
|
||||
# disk usage: ignore zfs, squashfs & tmpfs
|
||||
DISKS=$(df -H -x squashfs -x tmpfs -x devtmpfs -x zfs --output=target,pcent,size,used | tail -n+2)" 0 0 0 -"
|
||||
DISKS=$(df -H -x squashfs -x tmpfs -x devtmpfs -x zfs -x overlay --output=target,pcent,size,used | tail -n+2)" 0 0 0 -"
|
||||
|
||||
if test $(command -v zfs); then
|
||||
DISKS+="\n"
|
||||
@ -134,14 +134,24 @@ while read line; do
|
||||
fi
|
||||
# get disk usage
|
||||
dds=$(echo "$line" | awk '{print $6}' | sed 's/%//')
|
||||
if [ -z "$dds" ]; then
|
||||
dds_width=0
|
||||
child_width=0
|
||||
snap_width=0
|
||||
usage=$(echo "$line" | sed -E "s/.+([0-9]{2,3})%.+/\1/")
|
||||
else
|
||||
dds_width=$((($dds*$bar_width)/100))
|
||||
|
||||
child=$(echo "$line" | awk '{print $7}' | sed 's/%//')
|
||||
child_width=$((($child*$bar_width)/100))
|
||||
|
||||
snap=$(echo "$line" | awk '{print $5}' | sed 's/%//')
|
||||
snap_width=$((($snap*$bar_width)/100))
|
||||
usage=$(echo "$line" | awk '{print $2}' | sed 's/%//')
|
||||
used_width=$((($usage*$bar_width)/100))
|
||||
|
||||
usage=$(echo "$line" | awk '{print $2}' | sed 's/%//')
|
||||
fi
|
||||
|
||||
used_width=$((($usage*$bar_width)/100))
|
||||
#echo "$line"
|
||||
#echo "$dds,$dds_width|$child,$child_width|$snap,$snap_width|$usage,$used_width"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user