Add option to remove existing RubyTldr installation in installer

master
Marvin Johanning 2020-02-07 19:33:11 +01:00
parent 05a53070d5
commit ef2aae606d
1 changed files with 12 additions and 1 deletions

View File

@ -11,6 +11,18 @@ ruby_version=$(ruby -v)
if [[ $ruby_version == *ruby* ]]; then printf "A Ruby installation ($ruby_version) has been found on your machine. Proceeding ... \n\n"; else "No Ruby installation could be found on your machine. Please download the latest version of Ruby using your distribution's package manager or by compiling it from source"; exit; fi
if [ -e ~/.rtldr ]
then
echo "The program seems to have already been installed previously, since the ~/.rtldr folder already exists. Do you wish to remove the folder and replace the old RubyTldr version with the one you have just downloaded?"
select yn in "Yes" "No"; do
case $yn in
Yes ) echo "Removing old ~./rtldr... " ; rm -r --interactive=never ~/.rtldr ; break;;
No ) echo "The symbolic link will not be removed. Please be aware that this may break your rtldr installation. Setting a symlink manually, instead, and potentially altering a few of the files will now be necessary."; break;;
esac
done
fi
if [ -e ~/.rtldr ]; then echo "The program seems to have already been installed since the ~/.rtldr directory already exists. In that case, please use the command 'updatetldr'" && exit; else echo "Installation starting."; fi
if [[ -e tldr && -e lib/bin/tldr.rb ]]
@ -83,4 +95,3 @@ echo "Removing installer ..."
sudo rm installer.sh
echo "If you see this message, everything should've been installed correctly. To ensure that it has, please run 'rtldr tldr'. If you get an explanation of this program, then everything worked correctly."
#echo "To update tldr, please run updatetldr"