30 lines
521 B
Bash
Executable File

#!/bin/bash
if [ ! -f /usr/bin/zenity ];then
echo "Zenity not installed..."
exit 0;
fi
distro=$(lsb_release -a | grep -o "VoidLinux")
auth_prompt_path=$(which pkexec)
if [ -f ${auth_prompt_path} ];then
su_prompt="pkexec"
else
su_prompt="gksudo"
fi
zenity --question --text "Do you want to trim?"
if [[ $? == 1 ]];then
exit
else
notify-send -a "FS-Trim" "Trimming..."
echo "Trimming..."
results=$(${su_prompt} /sbin/fstrim -va)
notify-send "${results}"
echo "${results}"
fi