Update with gum confirm

This commit is contained in:
Stephan Raabe 2023-11-20 22:11:39 +01:00
parent 0038510d56
commit 7707ac4206
4 changed files with 61 additions and 90 deletions

View File

@ -25,10 +25,7 @@ echo -e "${NONE}"
echo "~/dotfiles-versions/backups/$datets/.bashrc-old" echo "~/dotfiles-versions/backups/$datets/.bashrc-old"
echo "" echo ""
fi fi
while true; do if gum confirm "Do you want to proceed?" ;then
read -p "Do you want to proceed? (Yy/Nn): " yn
case $yn in
[Yy]* )
if [ ! -d ~/dotfiles-versions ]; then if [ ! -d ~/dotfiles-versions ]; then
mkdir ~/dotfiles-versions mkdir ~/dotfiles-versions
echo "~/dotfiles-versions created." echo "~/dotfiles-versions created."
@ -49,11 +46,8 @@ echo -e "${NONE}"
cp ~/.bashrc ~/dotfiles-versions/backups/$datets/.bashrc-old cp ~/.bashrc ~/dotfiles-versions/backups/$datets/.bashrc-old
echo "Existing .bashrc file found in homefolder. .bashrc-old created" echo "Existing .bashrc file found in homefolder. .bashrc-old created"
fi fi
break;; else
[Nn]* ) echo "Backup skipped."
break;; fi
* ) echo "Please answer yes or no.";;
esac
done
echo "" echo ""
fi fi

View File

@ -4,30 +4,21 @@
echo "IMPORTANT: Please make sure that your system and your packages are up to date." echo "IMPORTANT: Please make sure that your system and your packages are up to date."
echo "You can cancel the installation at any time with CMD + C" echo "You can cancel the installation at any time with CMD + C"
echo ""
SCRIPT=$(realpath "$0") SCRIPT=$(realpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT") SCRIPTPATH=$(dirname "$SCRIPT")
if [ $SCRIPTPATH = "/home/$USER/dotfiles" ]; then if [ $SCRIPTPATH = "/home/$USER/dotfiles" ]; then
echo "IMPORTANT: You're running the installation script from the installation target directory." echo "IMPORTANT: You're running the installation script from the installation target directory."
echo "Please move the installation folder dotfiles e.g. to ~/Downloads/ and start the script again." echo "Please move the installation folder dotfiles e.g. to ~/Downloads/ and start the script again."
echo "Proceeding is not recommended!" echo "Proceeding is not recommended!"
echo ""
if [ ! $mode == "dev" ]; then if [ ! $mode == "dev" ]; then
exit exit
fi fi
fi fi
while true; do if gum confirm "DO YOU WANT TO START THE INSTALLATION NOW?" ;then
read -p "DO YOU WANT TO START THE INSTALLATION NOW? (Yy/Nn): " yn
case $yn in
[Yy]* )
echo "Installation started." echo "Installation started."
break;; else
[Nn]* )
echo "Installation canceled." echo "Installation canceled."
exit; exit;
break;; fi
* ) echo "Please answer yes or no.";;
esac
done
echo "" echo ""

View File

@ -14,17 +14,10 @@ cat <<"EOF"
EOF EOF
echo -e "${NONE}" echo -e "${NONE}"
while true; do if gum confirm "Do you want to install the custom tty login issue?" ;then
read -p "Do you want to install the custom tty login issue (Yy/Nn): " yn
case $yn in
[Yy]* )
sudo cp login/issue /etc/issue sudo cp login/issue /etc/issue
break;; else
[Nn]* )
echo "Setup tty login skipped." echo "Setup tty login skipped."
break;; fi
* ) echo "Please answer yes or no.";;
esac
done
echo "" echo ""
fi fi

View File

@ -39,11 +39,7 @@ echo -e "${NONE}"
fi fi
fi fi
echo "" echo ""
if gum confirm "Do you want to restore the files now and use it on your new installation?" ;then
while true; do
read -p "Do you want to restore the files now and use it on your new installation (Yy/Nn): " yn
case $yn in
[Yy]* )
if [ -f ~/dotfiles/.bashrc ]; then if [ -f ~/dotfiles/.bashrc ]; then
cp ~/dotfiles/.bashrc ~/dotfiles-versions/$version/ cp ~/dotfiles/.bashrc ~/dotfiles-versions/$version/
echo ".bashrc restored!" echo ".bashrc restored!"
@ -69,11 +65,8 @@ echo -e "${NONE}"
fi fi
fi fi
restored=1 restored=1
break;; else
[Nn]* ) echo "Restore skipped"
break;; fi
* ) echo "Please answer yes or no.";;
esac
done
echo "" echo ""
fi fi