From 3b097993b288f15b94c68f5ed78df33131fbcbbd Mon Sep 17 00:00:00 2001 From: mollusk Date: Sun, 21 May 2017 20:00:18 -0700 Subject: [PATCH] trb.sh: added support for gksudo --- trb.sh | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/trb.sh b/trb.sh index e0fdade..65efc04 100755 --- a/trb.sh +++ b/trb.sh @@ -1,13 +1,24 @@ #!/bin/bash +if [ ! -f /usr/bin/zenity ];then + echo "Zenity not installed..." + exit 0; +fi + +distro=$(lsb_release -a | grep -o "VoidLinux") + +if [ $distro = "VoidLinux" ];then + su_prompt="gksudo" +else + su_prompt="pkexec" +fi - zenity --question --text "Do you want to trim?" if [[ $? == 1 ]];then exit else - results=$(pkexec /sbin/fstrim -va) + results=$($su_prompt "/sbin/fstrim -va") notify-send "${results}" fi