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