forked from hestiacp/hestiacp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathv-change-sys-release
More file actions
executable file
·62 lines (53 loc) · 2.16 KB
/
v-change-sys-release
File metadata and controls
executable file
·62 lines (53 loc) · 2.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
#!/bin/bash
# info: update web templates
# options: [RESTART]
#
# The function for changing the release branch for the
# Hestia Control Panel. This allows the user to switch between
# stable and pre-release builds which will automaticlly update
# based on the appropriate release schedule if auto-update is
# turned on.
#----------------------------------------------------------#
# Variable&Function #
#----------------------------------------------------------#
# Argument definition
branch=$1
# Includes
source $HESTIA/func/main.sh
source $HESTIA/conf/hestia.conf
# Perform verification if read-only mode is enabled
check_hestia_demo_mode
#----------------------------------------------------------#
# Action #
#----------------------------------------------------------#
if [ -z "$branch" ]; then
echo "Error: no release branch specified."
echo "Usage: v-change-sys-release branchname"
echo ""
echo "Common release branches:"
echo "(*) release: The latest stable release available via APT"
echo "(*) prerelease: Beta/release candidate releases"
echo "(*) master: The latest development code from GitHub"
echo ""
echo "You can also specify another branch name from the"
echo "GitHub repository to install the code from that branch."
echo ""
exit
else
# Check that requested branch exists
echo "Checking for existence of $branch branch..."
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 release to update from branch: $branch"
fi
#----------------------------------------------------------#
# Hestia #
#----------------------------------------------------------#
exit