Add support for --release flag on traditional updates.

This commit is contained in:
Buster "Silver Eagle" Neece 2018-12-17 22:23:52 -06:00
parent 0ff0a35e11
commit 306826084b
2 changed files with 45 additions and 28 deletions

View File

@ -1,17 +1,12 @@
#!/usr/bin/env bash
while test $# -gt 0; do
case "$1" in
--dev)
APP_ENV="development"
shift
;;
*)
break
;;
esac
done
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
--dev)
APP_ENV="development"
shift
;;
esac; shift; done
if [[ "$1" == '--' ]]; then shift; fi
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' ansible|grep "install ok installed")
echo "Checking for Ansible: $PKG_OK"

View File

@ -1,22 +1,21 @@
#!/usr/bin/env bash
while test $# -gt 0; do
case "$1" in
--dev)
APP_ENV="development"
shift
;;
release_update=0
--full)
UPDATE_REVISION=0
shift
;;
while [[ "$1" =~ ^- && ! "$1" == "--" ]]; do case $1 in
--dev)
APP_ENV="development"
;;
*)
break
;;
esac
done
-r | --release )
release_update=1
;;
--full)
UPDATE_REVISION=0
;;
esac; shift; done
if [[ "$1" == '--' ]]; then shift; fi
PKG_OK=$(dpkg-query -W --showformat='${Status}\n' ansible|grep "install ok installed")
echo "Checking for Ansible: $PKG_OK"
@ -39,7 +38,30 @@ echo "Updating AzuraCast (Environment: $APP_ENV, Update revision: $UPDATE_REVISI
if [[ ${APP_ENV} = "production" ]]; then
if [[ -d ".git" ]]; then
git reset --hard && git pull
if [[ $release_update = 1 ]]; then
current_hash=$(git rev-parse HEAD)
current_tag=$(git describe --abbrev=0 --tags)
git fetch --tags
latest_tag=$(git describe --abbrev=0 --tags)
git reset --hard
if [[ $current_tag = $latest_tag ]]; then
echo "You are already on the latest version (${current_tag})!"
else
echo "Updating codebase from ${current_tag} to ${latest_tag}..."
git pull
git reset --hard $latest_tag
fi
else
echo "Updating to the latest rolling-release version..."
echo "Tip: use the '--release' flag to update to tagged releases only."
git reset --hard
git pull
fi
else
echo "You are running a release build. Any code updates should be applied manually."
fi