v-change-sys-release 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  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. # Verifications #
  20. #----------------------------------------------------------#
  21. # Perform verification if read-only mode is enabled
  22. check_hestia_demo_mode
  23. #----------------------------------------------------------#
  24. # Action #
  25. #----------------------------------------------------------#
  26. if [ -z "$branch" ]; then
  27. echo "Error: no release branch specified."
  28. echo "Usage: v-change-sys-release branchname"
  29. echo ""
  30. echo "Release branches:"
  31. echo "- release: the latest stable release"
  32. echo "- beta: beta and release candidate test releases"
  33. echo "- develop: unstable development builds"
  34. echo ""
  35. echo "Integration branches (not tied to a specific release/version):"
  36. echo "- staging/fixes: contains new fixes since the last release."
  37. echo "- staging/features: contains new features since the last release."
  38. echo ""
  39. echo "You can also specify another branch name from the"
  40. echo "GitHub repository to install the code from that branch."
  41. echo ""
  42. exit
  43. else
  44. # Check that requested branch exists
  45. echo "Checking for existence of $branch branch..."
  46. branch_check=$(curl -s --head -w %{http_code} https://raw.githubusercontent.com/hestiacp/hestiacp/$branch/src/deb/hestia/control -o /dev/null)
  47. if [ $branch_check -ne "200" ]; then
  48. echo "Error: invalid branch name specified."
  49. exit 1
  50. fi
  51. # Remove old branch variable
  52. sed -i "/RELEASE_BRANCH/d" $HESTIA/conf/hestia.conf
  53. # Set new branch variable
  54. echo "RELEASE_BRANCH='$branch'" >> $HESTIA/conf/hestia.conf
  55. echo "Updated system to update from Git using branch: $branch"
  56. fi
  57. #----------------------------------------------------------#
  58. # Hestia #
  59. #----------------------------------------------------------#
  60. exit