jitty-scripts/trb.sh

30 lines
521 B
Bash
Raw Normal View History

2017-05-09 21:31:02 -07:00
#!/bin/bash
2017-05-21 20:00:18 -07:00
if [ ! -f /usr/bin/zenity ];then
echo "Zenity not installed..."
exit 0;
fi
2017-05-21 20:00:18 -07:00
distro=$(lsb_release -a | grep -o "VoidLinux")
auth_prompt_path=$(which pkexec)
if [ -f ${auth_prompt_path} ];then
2017-05-21 20:00:18 -07:00
su_prompt="pkexec"
2017-05-21 20:13:55 -07:00
else
su_prompt="gksudo"
2017-05-21 20:00:18 -07:00
fi
2017-05-09 21:31:02 -07:00
zenity --question --text "Do you want to trim?"
if [[ $? == 1 ]];then
exit
else
2021-11-03 10:48:15 -07:00
notify-send -a "FS-Trim" "Trimming..."
2017-08-30 08:00:04 -07:00
echo "Trimming..."
results=$(${su_prompt} /sbin/fstrim -va)
2017-05-09 21:31:02 -07:00
notify-send "${results}"
2017-05-21 20:15:37 -07:00
echo "${results}"
2017-05-09 21:31:02 -07:00
fi