From effa8a6eb55d899357bdbefe85ce88b1efc51692 Mon Sep 17 00:00:00 2001 From: eoli3n Date: Thu, 13 May 2021 23:15:36 +0200 Subject: [PATCH] hm hm hm --- roles/waybar/files/waybar/modules/storage.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/roles/waybar/files/waybar/modules/storage.sh b/roles/waybar/files/waybar/modules/storage.sh index 1189be8..735232b 100755 --- a/roles/waybar/files/waybar/modules/storage.sh +++ b/roles/waybar/files/waybar/modules/storage.sh @@ -2,9 +2,10 @@ warning=85 critical=95 +target="$1" # Detect slash FSType -fstype=$(df -l "$1" --output=fstype | sed 1d) +fstype=$(findmnt -nT "$target" -o FSTYPE) # Set query cmd if [[ -z "$fstype" ]] @@ -12,10 +13,10 @@ then exit elif [[ "$fstype" == zfs ]] then - zfsroot=$(echo $1 | sed 's:/.*::') + zfsroot=$(echo $target | sed 's:/.*::') pcent=$(zpool list -o cap -H $zfsroot | tr -d '%') else - pcent=$(df "$1" --output="pcent" 2>/dev/null | sed 1d | tr -d ' ' | tr -d '%') + pcent=$(df "$target" --output="pcent" 2>/dev/null | sed 1d | tr -d ' ' | tr -d '%') fi json_fmt='{"text": "%s" , "class": "%s" }\n'