diff --git a/bin/myc-update b/bin/myc-update index ba02471..63b1122 100755 --- a/bin/myc-update +++ b/bin/myc-update @@ -10,19 +10,26 @@ include pretty start=$SECONDS if [ -z "$NO_UPDATE" -a -d "/opt/apps/myc-manage" ]; then + MYC_UPDATE_VERSION="${MYC_UPDATE_VERSION:-master}" Elt "Checking if myc-manage requires update..." cd /opt/apps/myc-manage - REMOTE_HEAD="$(git ls-remote origin refs/heads/master 2>/dev/null | cut -f 1)" + REMOTE_HEAD="$(git ls-remote origin "refs/heads/${MYC_UPDATE_VERSION}" 2>/dev/null | cut -f 1)" + if [ -z "$REMOTE_HEAD" ]; then + err "Can't find remote branch '$MYC_UPDATE_VERSION'." + echo " - Either this branch is not available on 'origin' remote." >&2 + echo " - Either 'origin' remote is not correctly set." >&2 + exit 1 + fi HEAD="$(git rev-parse HEAD)" if [ "$REMOTE_HEAD" != "$HEAD" ]; then print_info "new version available" Wrap -d "Update myc-manage" <