trb.sh: added support for gksudo

This commit is contained in:
mollusk 2017-05-21 20:00:18 -07:00
parent 280a2ca3e6
commit 3b097993b2

13
trb.sh
View File

@ -1,13 +1,24 @@
#!/bin/bash #!/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?" zenity --question --text "Do you want to trim?"
if [[ $? == 1 ]];then if [[ $? == 1 ]];then
exit exit
else else
results=$(pkexec /sbin/fstrim -va) results=$($su_prompt "/sbin/fstrim -va")
notify-send "${results}" notify-send "${results}"
fi fi