Browse Source

Update v-change-sys-release

Ensure that specified branch in upstream Git repository exists before saving.
Kristan Kenney 6 years ago
parent
commit
cb6d9f284a
1 changed files with 8 additions and 0 deletions
  1. 8 0
      bin/v-change-sys-release

+ 8 - 0
bin/v-change-sys-release

@@ -36,8 +36,16 @@ if [ -z "$branch" ]; then
     echo ""
     exit
 else
+    # Check that requested branch exists
+    branch_check=$(curl -s --head -w %{http_code} https://raw.githubusercontent.com/hestiacp/hestiacp/$branch/src/deb/hestia/control -o /dev/null)
+    if [ $branch_check -ne "200" ]; then
+        echo "Error: invalid branch name specified."
+        exit 1
+    fi
+
     # Remove old branch variable
     sed -i "/RELEASE_BRANCH/d" $HESTIA/conf/hestia.conf
+    
     # Set new branch variable
     echo "RELEASE_BRANCH='$branch'" >> $HESTIA/conf/hestia.conf
     echo "Changed system to follow release branch: $branch"