Hyprland-dotfiles/scripts/installupdates.sh

67 lines
1.8 KiB
Bash
Raw Normal View History

2023-09-10 09:07:55 -04:00
#!/bin/bash
# ___ _ _ _ _ _ _ _
# |_ _|_ __ ___| |_ __ _| | | | | | |_ __ __| | __ _| |_ ___ ___
# | || '_ \/ __| __/ _` | | | | | | | '_ \ / _` |/ _` | __/ _ \/ __|
# | || | | \__ \ || (_| | | | | |_| | |_) | (_| | (_| | || __/\__ \
# |___|_| |_|___/\__\__,_|_|_| \___/| .__/ \__,_|\__,_|\__\___||___/
# |_|
2024-02-19 03:00:59 -05:00
# by Stephan Raabe (2024)
2023-09-10 09:07:55 -04:00
# -----------------------------------------------------
# Required: yay trizen timeshift btrfs-grub
# -----------------------------------------------------
sleep 1
2023-09-10 09:07:55 -04:00
clear
2024-02-19 03:00:59 -05:00
figlet "Updates"
2023-11-12 13:57:18 -05:00
_isInstalledYay() {
package="$1";
check="$(yay -Qs --color always "${package}" | grep "local" | grep "${package} ")";
if [ -n "${check}" ] ; then
echo 0; #'0' means 'true' in Bash
return; #true
fi;
echo 1; #'1' means 'false' in Bash
return; #false
}
2023-09-10 09:07:55 -04:00
# ------------------------------------------------------
# Confirm Start
# ------------------------------------------------------
2023-11-25 11:06:26 -05:00
if gum confirm "DO YOU WANT TO START THE UPDATE NOW?" ;then
2024-03-01 15:09:33 -05:00
echo
2024-03-02 02:38:58 -05:00
echo ":: Update started."
2023-11-25 11:06:26 -05:00
elif [ $? -eq 130 ]; then
exit 130
else
2024-03-01 15:09:33 -05:00
echo
2024-03-02 02:38:58 -05:00
echo ":: Update canceled."
2023-11-25 11:06:26 -05:00
exit;
fi
2023-09-10 09:07:55 -04:00
2024-02-16 07:02:39 -05:00
if [[ $(_isInstalledYay "timeshift") == "0" ]] ;then
2023-11-25 11:06:26 -05:00
if gum confirm "DO YOU WANT TO CREATE A SNAPSHOT?" ;then
2024-03-01 15:09:33 -05:00
echo
2023-11-25 11:06:26 -05:00
c=$(gum input --placeholder "Enter a comment for the snapshot...")
sudo timeshift --create --comments "$c"
sudo timeshift --list
sudo grub-mkconfig -o /boot/grub/grub.cfg
2024-03-02 02:38:58 -05:00
echo ":: DONE. Snapshot $c created!"
2024-03-01 15:09:33 -05:00
echo
2023-11-25 11:06:26 -05:00
elif [ $? -eq 130 ]; then
2024-03-02 02:38:58 -05:00
echo ":: Snapshot canceled."
2023-11-25 11:06:26 -05:00
exit 130
else
2024-03-02 02:38:58 -05:00
echo ":: Snapshot canceled."
2023-11-25 11:06:26 -05:00
fi
2024-03-01 15:09:33 -05:00
echo
2023-09-10 09:07:55 -04:00
fi
yay
2023-09-18 15:03:03 -04:00
2023-10-02 08:50:28 -04:00
notify-send "Update complete"
2024-03-02 02:38:58 -05:00
echo
echo ":: Update complete"
sleep 2