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

View File

@ -4,30 +4,21 @@
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 ""
SCRIPT=$(realpath "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
if [ $SCRIPTPATH = "/home/$USER/dotfiles" ]; then
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 "Proceeding is not recommended!"
echo ""
if [ ! $mode == "dev" ]; then
exit
fi
fi
while true; do
read -p "DO YOU WANT TO START THE INSTALLATION NOW? (Yy/Nn): " yn
case $yn in
[Yy]* )
if gum confirm "DO YOU WANT TO START THE INSTALLATION NOW?" ;then
echo "Installation started."
break;;
[Nn]* )
else
echo "Installation canceled."
exit;
break;;
* ) echo "Please answer yes or no.";;
esac
done
fi
echo ""

View File

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

View File

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