Adding geo install and uninstall, fixing incorrect echo in uninstall

This commit is contained in:
Alex Epstein 2017-06-30 12:46:46 -04:00
parent 14e9a60623
commit 71a2704216
4 changed files with 45 additions and 2 deletions

6
geo/install.sh Executable file
View File

@ -0,0 +1,6 @@
#!/bin/bash
# Author: Alexander Epstein https://github.com/alexanderepstein
echo -n "Installing geo: "
chmod a+x geo
cp geo /usr/local/bin > /dev/null 2>&1 || { echo "Failure"; echo "Error copying file, try running install script as sudo"; exit 1; }
echo "Success"

5
geo/uninstall.sh Executable file
View File

@ -0,0 +1,5 @@
#!/bin/bash
# Author: Alexander Epstein https://github.com/alexanderepstein
echo -n "Removing geo: "
rm -f /usr/local/bin/geo > /dev/null 2>&1 || { echo "Failed" ; echo "Error removing file, try running uninstall script as sudo"; exit 1; }
echo "Success"

View File

@ -69,6 +69,16 @@ if [[ $# == 0 ]]; then
cd .. || exit 1
fi
unset answer
echo -n "Do you wish to install geo [Y/n]: "
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd geo || exit 1
./install.sh
cd .. || exit 1
fi
fi
if [[ $1 == "currency" ]];then
@ -99,6 +109,10 @@ elif [[ $1 == "short" ]]; then
cd short || exit 1
./install.sh || exit 1
cd .. || exit 1
elif [[ $1 == "geo" ]]; then
cd geo || exit 1
./install.sh || exit 1
cd .. || exit 1
elif [[ $1 == "all" ]];then
cd currency || exit 1
./install.sh || exit 1
@ -121,6 +135,9 @@ elif [[ $1 == "all" ]];then
cd short || exit 1
./install.sh || exit 1
cd .. || exit 1
cd geo || exit 1
./install.sh || exit 1
cd .. || exit 1
elif [[ $1 == "update" ]]; then
echo "Updating scripts..."
if [[ -f /usr/local/bin/currency ]];then
@ -158,6 +175,11 @@ elif [[ $1 == "update" ]]; then
./install.sh || exit 1
cd .. || exit 1
fi
if [[ -f /usr/local/bin/geo ]];then
cd geo || exit 1
./install.sh || exit 1
cd .. || exit 1
fi
fi
echo "Bash Snippets version $currentVersion"

View File

@ -59,7 +59,7 @@ if [[ -f /usr/local/bin/movies ]];then
fi
if [[ -f /usr/local/bin/taste ]];then
echo -n "Do you wish to uninstall movies [Y/n]: "
echo -n "Do you wish to uninstall taste [Y/n]: "
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd taste || exit 1
@ -69,7 +69,7 @@ if [[ -f /usr/local/bin/taste ]];then
fi
if [[ -f /usr/local/bin/short ]];then
echo -n "Do you wish to uninstall movies [Y/n]: "
echo -n "Do you wish to uninstall short [Y/n]: "
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd short || exit 1
@ -77,3 +77,13 @@ if [[ -f /usr/local/bin/short ]];then
cd .. || exit 1
fi
fi
if [[ -f /usr/local/bin/geo ]];then
echo -n "Do you wish to uninstall geo [Y/n]: "
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd geo || exit 1
./uninstall.sh
cd .. || exit 1
fi
fi