Added gum

This commit is contained in:
Stephan Raabe 2023-11-25 17:06:26 +01:00
parent 49093fef5d
commit 3ebe8dc891
2 changed files with 26 additions and 32 deletions

View File

@ -38,38 +38,32 @@ _isInstalledYay() {
# Confirm Start # Confirm Start
# ------------------------------------------------------ # ------------------------------------------------------
while true; do if gum confirm "DO YOU WANT TO START THE UPDATE NOW?" ;then
read -p "DO YOU WANT TO START THE UPDATE NOW? (Yy/Nn): " yn echo "Update started."
case $yn in elif [ $? -eq 130 ]; then
[Yy]* ) exit 130
echo "" else
break;; echo "Update canceled."
[Nn]* )
exit; exit;
break;; fi
* ) echo "Please answer yes or no.";;
esac
done
if [[ $(_isInstalledYay "Timeshift") == 1 ]];
then
while true; do
read -p "DO YOU WANT TO CREATE A SNAPSHOT? (Yy/Nn): " yn
case $yn in
[Yy]* )
echo "" echo ""
read -p "Enter a comment for the snapshot: " c
if [[ $(_isInstalledYay "Timeshift") == 1 ]] ;then
if gum confirm "DO YOU WANT TO CREATE A SNAPSHOT?" ;then
echo ""
c=$(gum input --placeholder "Enter a comment for the snapshot...")
sudo timeshift --create --comments "$c" sudo timeshift --create --comments "$c"
sudo timeshift --list sudo timeshift --list
sudo grub-mkconfig -o /boot/grub/grub.cfg sudo grub-mkconfig -o /boot/grub/grub.cfg
echo "DONE. Snapshot $c created!" echo "DONE. Snapshot $c created!"
echo "" echo ""
break;; elif [ $? -eq 130 ]; then
[Nn]* ) echo "Snapshot canceled."
break;; exit 130
* ) echo "Please answer yes or no.";; else
esac echo "Snapshot canceled."
done fi
echo ""
fi fi
echo "-----------------------------------------------------" echo "-----------------------------------------------------"

View File

@ -9,7 +9,7 @@
# by Stephan Raabe (2023) # by Stephan Raabe (2023)
# ----------------------------------------------------- # -----------------------------------------------------
read -p "Enter a comment for the snapshot: " c c=$(gum input --placeholder "Enter a comment for the snapshot...")
sudo timeshift --create --comments "$c" sudo timeshift --create --comments "$c"
sudo timeshift --list sudo timeshift --list
sudo grub-mkconfig -o /boot/grub/grub.cfg sudo grub-mkconfig -o /boot/grub/grub.cfg