From e68a0308fe6d7cc7ee10b255fc0f359afa183b96 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Tue, 13 Aug 2019 04:00:53 +0200 Subject: [PATCH] Plugin zfs-filesystem-graph: fix autoconf and remove "suggest" --- plugins/zfs/zfs-filesystem-graph | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/plugins/zfs/zfs-filesystem-graph b/plugins/zfs/zfs-filesystem-graph index 8bc3ca07..6021e17e 100755 --- a/plugins/zfs/zfs-filesystem-graph +++ b/plugins/zfs/zfs-filesystem-graph @@ -20,18 +20,20 @@ # ** WARNING ** # For now this plugin does not allow "_" in the name of a zpool or filesystems # +# #%# capabilities=autoconf +# myname=$(basename "$0" | sed 's/^zfs_fs_//g' | sed -e 's/_/\//g') if [ "$1" = "autoconf" ]; then - # Makes little sense to autoconf if you can't suggest - echo no + if which zfs >/dev/null; then + echo yes + else + echo "no (missing executable 'zfs')" + fi exit 0 fi -if [ "$1" = "suggest" ]; then - exit 0 -fi read -r -a values <<<"$(zfs get -p usedbydataset,usedbychildren,usedbysnapshots,usedbyrefreservation,available,quota "$myname" \ | awk 'BEGIN {total=0;} { if( NR==1 ) next; } !/quota/ {total=total+$3;} {print $3} END{print total;}')"