diff --git a/motd.sh b/motd.sh index 4463238..e7a6bc4 100755 --- a/motd.sh +++ b/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,19 +134,29 @@ while read line; do fi # get disk usage dds=$(echo "$line" | awk '{print $6}' | sed 's/%//') - 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)) + 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)) - #echo "$line" + 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/%//') + fi + + used_width=$((($usage*$bar_width)/100)) + #echo "$line" #echo "$dds,$dds_width|$child,$child_width|$snap,$snap_width|$usage,$used_width" i=0 - # [ + # [ bar="[" # DDS