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 "(*) beta: Beta builds which are being prepared for release"
  28. echo "(*) develop: Daily development builds"
  29. echo ""
  30. echo "You can also specify another branch name from the"
  31. echo "GitHub repository to install the code from that branch."
  32. echo ""
  33. exit
  34. else
  35. # Check that requested branch exists
  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 to follow release branch: $branch"
  46. fi
  47. #----------------------------------------------------------#
  48. # Hestia #
  49. #----------------------------------------------------------#
  50. exit