Dont prompt removal and call update differently

This commit is contained in:
Alex Epstein 2017-06-27 23:05:21 -04:00
parent 89f520a8b7
commit 96b04c9942
5 changed files with 15 additions and 15 deletions

View File

@ -40,14 +40,14 @@ update()
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd ~ || { echo 'Update Failed' ; exit 1 ; }
if [[ -d ~/$repositoryName ]]; then rm -r $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r $repositoryName ; }; fi #sudo command only on error
if [[ -d ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r -f $repositoryName ; }; fi #sudo command only on error
git clone "https://github.com/$githubUserName/$repositoryName" || { echo "Couldn't download latest version" ; exit 1; }
cd $repositoryName || { echo 'Update Failed' ; exit 1 ;}
git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
"./$nameOfInstallFile update" || { echo "Your password is required to continue with the update" ; "sudo ./$nameOfInstallFile update" ; }
./$nameOfInstallFile "update" || { echo "Your password is required to continue with the update" ; sudo ./$nameOfInstallFile "update" ; }
cd ..
rm -r $repositoryName || sudo rm -r $repositoryName #sudo command only on error
rm -r -f $repositoryName || sudo rm -r -f $repositoryName #sudo command only on error
else
exit 1
fi

View File

@ -99,14 +99,14 @@ update()
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd ~ || { echo 'Update Failed' ; exit 1 ; }
if [[ -d ~/$repositoryName ]]; then rm -r $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r $repositoryName ; }; fi #sudo command only on error
if [[ -d ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r -f $repositoryName ; }; fi #sudo command only on error
git clone "https://github.com/$githubUserName/$repositoryName" || { echo "Couldn't download latest version" ; exit 1; }
cd $repositoryName || { echo 'Update Failed' ; exit 1 ;}
git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
"./$nameOfInstallFile update" || { echo "Your password is required to continue with the update" ; "sudo ./$nameOfInstallFile update" ; }
./$nameOfInstallFile "update" || { echo "Your password is required to continue with the update" ; sudo ./$nameOfInstallFile "update" ; }
cd ..
rm -r $repositoryName || sudo rm -r $repositoryName #sudo command only on error
rm -r -f $repositoryName || sudo rm -r -f $repositoryName #sudo command only on error
else
exit 1
fi

View File

@ -76,14 +76,14 @@ update()
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd ~ || { echo 'Update Failed' ; exit 1 ; }
if [[ -d ~/$repositoryName ]]; then rm -r $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r $repositoryName ; }; fi #sudo command only on error
if [[ -d ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r -f $repositoryName ; }; fi #sudo command only on error
git clone "https://github.com/$githubUserName/$repositoryName" || { echo "Couldn't download latest version" ; exit 1; }
cd $repositoryName || { echo 'Update Failed' ; exit 1 ;}
git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
"./$nameOfInstallFile update" || { echo "Your password is required to continue with the update" ; "sudo ./$nameOfInstallFile update" ; }
./$nameOfInstallFile "update" || { echo "Your password is required to continue with the update" ; sudo ./$nameOfInstallFile "update" ; }
cd ..
rm -r $repositoryName || sudo rm -r $repositoryName #sudo command only on error
rm -r -f $repositoryName || sudo rm -f -r $repositoryName #sudo command only on error
else
exit 1
fi

View File

@ -89,14 +89,14 @@ update()
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd ~ || { echo 'Update Failed' ; exit 1 ; }
if [[ -d ~/$repositoryName ]]; then rm -r $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r $repositoryName ; }; fi #sudo command only on error
if [[ -d ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r -f $repositoryName ; }; fi #sudo command only on error
git clone "https://github.com/$githubUserName/$repositoryName" || { echo "Couldn't download latest version" ; exit 1; }
cd $repositoryName || { echo 'Update Failed' ; exit 1 ;}
git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
"./$nameOfInstallFile update" || { echo "Your password is required to continue with the update" ; "sudo ./$nameOfInstallFile update" ; }
./$nameOfInstallFile "update" || { echo "Your password is required to continue with the update" ; sudo ./$nameOfInstallFile "update" ; }
cd ..
rm -r $repositoryName || sudo rm -r $repositoryName #sudo command only on error
rm -r -f $repositoryName || sudo rm -r -f $repositoryName #sudo command only on error
else
exit 1
fi

View File

@ -51,14 +51,14 @@ update()
read -r answer
if [[ "$answer" == "Y" || "$answer" == "y" ]] ;then
cd ~ || { echo 'Update Failed' ; exit 1 ; }
if [[ -d ~/$repositoryName ]]; then rm -r $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r $repositoryName ; }; fi #sudo command only on error
if [[ -d ~/$repositoryName ]]; then rm -r -f $repositoryName || { echo "Your password is required to continue with the update" ; sudo rm -r -f $repositoryName ; }; fi #sudo command only on error
git clone "https://github.com/$githubUserName/$repositoryName" || { echo "Couldn't download latest version" ; exit 1; }
cd $repositoryName || { echo 'Update Failed' ; exit 1 ;}
git checkout "v$latestVersion" 2> /dev/null || git checkout "$latestVersion" 2> /dev/null || echo "Couldn't git checkout to stable release, updating to latest commit."
chmod a+x install.sh #this might be necessary in your case but wasnt in mine.
"./$nameOfInstallFile update" || { echo "Your password is required to continue with the update" ; "sudo ./$nameOfInstallFile update" ; }
./$nameOfInstallFile "update" || { echo "Your password is required to continue with the update" ; sudo ./$nameOfInstallFile "update" ; }
cd ..
rm -r $repositoryName || sudo rm -r $repositoryName #sudo command only on error
rm -r -f $repositoryName || sudo rm -r -f $repositoryName #sudo command only on error
else
exit 1
fi