Skip to content
This repository has been archived by the owner on Apr 3, 2018. It is now read-only.

Commit

Permalink
Add git pull if repository is cloned
Browse files Browse the repository at this point in the history
  • Loading branch information
funilrys committed Jul 22, 2017
1 parent c16aa1a commit 1dc993f
Showing 1 changed file with 36 additions and 31 deletions.
67 changes: 36 additions & 31 deletions tool
Original file line number Diff line number Diff line change
Expand Up @@ -658,45 +658,50 @@ downloadScript()
################################################################################
update()
{
# We get the online version and compare versions
checkVersion 'get'

if [[ ${update} == true ]]
if [[ -d ${currentDir}.git ]]
then
# We only need to execute if the versions are not the same

downloadScript

# We install the new script
installation ${currentDir}${script} true
# We log && print message
printf "Checking Version" && printf "Checking Version" >> ${logOutput}

# We check the version of the newly downloaded script
checkVersion
git pull
else
# We get the online version and compare versions
checkVersion 'get'

if [[ ${update} == false ]]
if [[ ${update} == true ]]
then
# If we don't need to update, here's the end
# We only need to execute if the versions are not the same

downloadScript

# We install the new script
installation ${currentDir}${script} true
# We log && print message
printf " ${cyan}${normal}\n\n" && printf " ✔\n" >> ${logOutput}
echo "${bold}${cyan}The update was successfully completed!${normal}"
printf '\n'
printf "Checking Version" && printf "Checking Version" >> ${logOutput}

# We delete the temporary file and stop the script
rm -f "${funilrys}"
exit 1
# We check the version of the newly downloaded script
checkVersion

if [[ ${update} == false ]]
then
# If we don't need to update, here's the end
# We log && print message
printf " ${cyan}${normal}\n\n" && printf " ✔\n" >> ${logOutput}
echo "${bold}${cyan}The update was successfully completed!${normal}"
printf '\n'

# We delete the temporary file and stop the script
rm -f "${funilrys}"
exit 1
else
# We log && print message
printf " ${red}${normal}\n" && printf " ✘\n" >> ${logOutput}
echo "Impossible to update ${currentDir}${script}. Please report issue." >> ${logOutput}
exit 0
fi
else
# We log && print message
printf " ${red}${normal}\n" && printf " ✘\n" >> ${logOutput}
echo "Impossible to update ${currentDir}${script}. Please report issue." >> ${logOutput}
exit 0
printf "No need to update.\n" && printf "No need to update." >> ${logOutput}
rm -f "${funilrys}"
exit 1
fi
else
# We log && print message
printf "No need to update.\n" && printf "No need to update." >> ${logOutput}
rm -f "${funilrys}"
exit 1
fi
}

Expand Down

0 comments on commit 1dc993f

Please sign in to comment.