2023-09-10 13:07:55 +00:00
|
|
|
#!/bin/bash
|
|
|
|
# ___ _ _ _ _ _ _ _
|
|
|
|
# |_ _|_ __ ___| |_ __ _| | | | | | |_ __ __| | __ _| |_ ___ ___
|
|
|
|
# | || '_ \/ __| __/ _` | | | | | | | '_ \ / _` |/ _` | __/ _ \/ __|
|
|
|
|
# | || | | \__ \ || (_| | | | | |_| | |_) | (_| | (_| | || __/\__ \
|
|
|
|
# |___|_| |_|___/\__\__,_|_|_| \___/| .__/ \__,_|\__,_|\__\___||___/
|
|
|
|
# |_|
|
|
|
|
# by Stephan Raabe (2023)
|
|
|
|
# -----------------------------------------------------
|
|
|
|
# Required: yay trizen timeshift btrfs-grub
|
|
|
|
# -----------------------------------------------------
|
|
|
|
|
2023-09-11 11:43:14 +00:00
|
|
|
sleep 1
|
2023-09-10 13:07:55 +00:00
|
|
|
clear
|
|
|
|
|
2023-11-12 18:57:18 +00:00
|
|
|
cat <<"EOF"
|
|
|
|
_ _ _ _
|
|
|
|
| | | |_ __ __| | __ _| |_ ___ ___
|
|
|
|
| | | | '_ \ / _` |/ _` | __/ _ \/ __|
|
|
|
|
| |_| | |_) | (_| | (_| | || __/\__ \
|
|
|
|
\___/| .__/ \__,_|\__,_|\__\___||___/
|
|
|
|
|_|
|
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
_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 13:07:55 +00:00
|
|
|
# ------------------------------------------------------
|
|
|
|
# Confirm Start
|
|
|
|
# ------------------------------------------------------
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
read -p "DO YOU WANT TO START THE UPDATE NOW? (Yy/Nn): " yn
|
|
|
|
case $yn in
|
|
|
|
[Yy]* )
|
2023-10-02 12:50:28 +00:00
|
|
|
echo ""
|
2023-09-10 13:07:55 +00:00
|
|
|
break;;
|
|
|
|
[Nn]* )
|
|
|
|
exit;
|
|
|
|
break;;
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
if [[ $(_isInstalledYay "Timeshift") == 1 ]];
|
|
|
|
then
|
2023-10-02 12:50:28 +00:00
|
|
|
while true; do
|
|
|
|
read -p "DO YOU WANT TO CREATE A SNAPSHOT? (Yy/Nn): " yn
|
|
|
|
case $yn in
|
|
|
|
[Yy]* )
|
|
|
|
echo ""
|
|
|
|
read -p "Enter a comment for the snapshot: " c
|
|
|
|
sudo timeshift --create --comments "$c"
|
|
|
|
sudo timeshift --list
|
|
|
|
sudo grub-mkconfig -o /boot/grub/grub.cfg
|
|
|
|
echo "DONE. Snapshot $c created!"
|
|
|
|
echo ""
|
|
|
|
break;;
|
|
|
|
[Nn]* )
|
|
|
|
break;;
|
|
|
|
* ) echo "Please answer yes or no.";;
|
|
|
|
esac
|
|
|
|
done
|
2023-09-10 13:07:55 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
echo "-----------------------------------------------------"
|
|
|
|
echo "Start update"
|
|
|
|
echo "-----------------------------------------------------"
|
|
|
|
echo ""
|
|
|
|
|
|
|
|
yay
|
2023-09-18 19:03:03 +00:00
|
|
|
|
2023-10-02 12:50:28 +00:00
|
|
|
notify-send "Update complete"
|