From 71a2704216d54415ccf5e1a7987e601c6c49ced7 Mon Sep 17 00:00:00 2001 From: Alex Epstein Date: Fri, 30 Jun 2017 12:46:46 -0400 Subject: [PATCH] Adding geo install and uninstall, fixing incorrect echo in uninstall --- geo/install.sh | 6 ++++++ geo/uninstall.sh | 5 +++++ install.sh | 22 ++++++++++++++++++++++ uninstall.sh | 14 ++++++++++++-- 4 files changed, 45 insertions(+), 2 deletions(-) create mode 100755 geo/install.sh create mode 100755 geo/uninstall.sh diff --git a/geo/install.sh b/geo/install.sh new file mode 100755 index 0000000..ac5d7bd --- /dev/null +++ b/geo/install.sh @@ -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" diff --git a/geo/uninstall.sh b/geo/uninstall.sh new file mode 100755 index 0000000..de4945e --- /dev/null +++ b/geo/uninstall.sh @@ -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" diff --git a/install.sh b/install.sh index 9fca85d..0a83c77 100755 --- a/install.sh +++ b/install.sh @@ -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" diff --git a/uninstall.sh b/uninstall.sh index 7e98cab..3b7d77d 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -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