[Update] Make the update check in update.sh readonly

master
André Peters 2019-03-12 17:22:35 +01:00 committed by GitHub
commit ae8dfb3449
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -71,8 +71,12 @@ while (($#)); do
case "${1}" in
--check|-c)
echo "Checking remote code for updates..."
git fetch origin #${BRANCH}
if [[ -z $(git log HEAD --pretty=format:"%H" | grep $(git rev-parse origin/${BRANCH})) ]]; then
LATEST_REV=$(git ls-remote --exit-code --refs --quiet https://github.com/mailcow/mailcow-dockerized ${BRANCH} | cut -f1)
if [ $? -ne 0 ]; then
echo "A problem occurred while trying to fetch the latest revision from github."
exit 99
fi
if [[ -z $(git log HEAD --pretty=format:"%H" | grep "${LATEST_REV}") ]]; then
echo "Updated code is available."
exit 0
else