v-change-sys-release 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/bash
  2. # info: update web templates
  3. # options: [RESTART]
  4. #
  5. # The function for changing the release branch for the
  6. # Hestia Control Panel. This allows the user to switch between
  7. # stable and pre-release builds which will automaticlly update
  8. # based on the appropriate release schedule if auto-update is
  9. # turned on.
  10. #----------------------------------------------------------#
  11. # Variable&Function #
  12. #----------------------------------------------------------#
  13. # Argument definition
  14. branch=$1
  15. # Includes
  16. source $HESTIA/func/main.sh
  17. source $HESTIA/conf/hestia.conf
  18. #----------------------------------------------------------#
  19. # Action #
  20. #----------------------------------------------------------#
  21. if [ -z "$branch" ]; then
  22. echo "Error: no release branch specified."
  23. echo "Usage: v-change-sys-release branchname"
  24. echo ""
  25. echo "Common release branches:"
  26. echo "(*) master: Stable releases only"
  27. echo "(*) develop: Daily development builds"
  28. echo ""
  29. echo "You can also specify another branch name from the"
  30. echo "GitHub repository to install the code from that branch."
  31. echo ""
  32. exit
  33. else
  34. # Check that requested branch exists
  35. echo "Checking for existence of $branch branch..."
  36. branch_check=$(curl -s --head -w %{http_code} https://raw.githubusercontent.com/hestiacp/hestiacp/$branch/src/deb/hestia/control -o /dev/null)
  37. if [ $branch_check -ne "200" ]; then
  38. echo "Error: invalid branch name specified."
  39. exit 1
  40. fi
  41. # Remove old branch variable
  42. sed -i "/RELEASE_BRANCH/d" $HESTIA/conf/hestia.conf
  43. # Set new branch variable
  44. echo "RELEASE_BRANCH='$branch'" >> $HESTIA/conf/hestia.conf
  45. echo "Changed system release to update from Git branch: $branch"
  46. fi
  47. #----------------------------------------------------------#
  48. # Hestia #
  49. #----------------------------------------------------------#
  50. exit