Просмотр исходного кода

Merge branch 'develop' into webui-refresh-winterfell

Kristan Kenney 6 лет назад
Родитель
Сommit
dbb4c9e02a

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

@@ -0,0 +1,50 @@
+#!/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
+
+#----------------------------------------------------------#
+#                       Action                             #
+#----------------------------------------------------------#
+if [ -z "$branch" ]; then
+    echo "Error: no release branch specified."
+    echo "Usage: v-change-sys-release branchname"
+    echo ""
+    echo "Common release branches:"
+    echo "(*) master:   Stable releases only"
+    echo "(*) beta:     Beta builds which are being prepared for release"
+    echo "(*) develop:  Daily development builds"
+    echo ""
+    echo "You can also specify another branch name from the"
+    echo "GitHub repository to install the code from that branch."
+    echo ""
+    exit
+else
+    # 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"
+fi
+
+#----------------------------------------------------------#
+#                       Hestia                             #
+#----------------------------------------------------------#
+
+exit

+ 4 - 2
bin/v-list-sys-config

@@ -43,6 +43,7 @@ json_list() {
         "FIREWALL_EXTENSION": "'$FIREWALL_EXTENSION'",
         "REPOSITORY": "'$REPOSITORY'",
         "VERSION": "'$VERSION'",
+        "RELEASE_BRANCH": "'$RELEASE_BRANCH'",
         "LANGUAGE": "'$LANGUAGE'",
         "BACKUP_GZIP": "'$BACKUP_GZIP'",
         "BACKUP": "'$BACKUP'",
@@ -129,6 +130,7 @@ shell_list() {
         echo "Language:       $LANGUAGE"
     fi
     echo "Version:        $VERSION"
+    echo "Release Branch: $RELEASE_BRANCH"
 }
 
 # PLAIN list function
@@ -139,7 +141,7 @@ plain_list() {
     echo -ne "$ANTIVIRUS_SYSTEM\t$ANTISPAM_SYSTEM\t$DB_SYSTEM\t"
     echo -ne "$DNS_SYSTEM\t$DNS_CLUSTER\t$STATS_SYSTEM\t$BACKUP_SYSTEM\t"
     echo -ne "$CRON_SYSTEM\t$DISK_QUOTA\t$FIREWALL_SYSTEM\t"
-    echo -ne "$FIREWALL_EXTENSION\t$REPOSITORY\t$VERSION\t$LANGUAGE\t"
+    echo -ne "$FIREWALL_EXTENSION\t$REPOSITORY\t$VERSION\t$RELEASE_BRANCH\t$LANGUAGE\t"
     echo -e "$BACKUP_GZIP\t$BACKUP\t$WEBMAIL_ALIAS\t$DB_PMA_URL\t$DB_PGA_URL"
 }
 
@@ -162,7 +164,7 @@ csv_list() {
     echo -n "'$ANTIVIRUS_SYSTEM','$ANTISPAM_SYSTEM','$DB_SYSTEM',"
     echo -n "'$DNS_SYSTEM','$DNS_CLUSTER','$STATS_SYSTEM','$BACKUP_SYSTEM',"
     echo -n "'$CRON_SYSTEM','$DISK_QUOTA','$FIREWALL_SYSTEM','$REPOSITORY',"
-    echo -n "'$FIREWALL_EXTENSION','$VERSION','$LANGUAGE','$BACKUP_GZIP',"
+    echo -n "'$FIREWALL_EXTENSION','$VERSION','$RELEASE_BRANCH','$LANGUAGE','$BACKUP_GZIP',"
     echo -n "'$BACKUP','$WEBMAIL_ALIAS','$DB_PMA_URL','$DB_PGA_URL'"
     echo
 }

+ 2 - 1
bin/v-update-sys-developer

@@ -37,7 +37,8 @@ install=$3
 if [ ! -z "$1" ]; then
   branch=$1
 else
-  branch="develop"
+  source /usr/local/hestia/conf/hestia.conf
+  branch=$RELEASE_BRANCH
 fi
 
 if [ ! -z "$2" ]; then

+ 3 - 2
install/hst-install-debian.sh

@@ -1029,8 +1029,9 @@ echo "BACKUP_SYSTEM='local'" >> $HESTIA/conf/hestia.conf
 # Language
 echo "LANGUAGE='$lang'" >> $HESTIA/conf/hestia.conf
 
-# Version
-echo "VERSION='0.9.8'" >> $HESTIA/conf/hestia.conf
+# Version & Release Branch
+echo "VERSION='0.10.0'" >> $HESTIA/conf/hestia.conf
+echo "RELEASE='develop'" >> $HESTIA/conf/hestia.conf
 
 # Installing hosting packages
 cp -rf $hestiacp/packages $HESTIA/data/

+ 3 - 2
install/hst-install-ubuntu.sh

@@ -991,8 +991,9 @@ echo "BACKUP_SYSTEM='local'" >> $HESTIA/conf/hestia.conf
 # Language
 echo "LANGUAGE='$lang'" >> $HESTIA/conf/hestia.conf
 
-# Version
-echo "VERSION='0.9.8'" >> $HESTIA/conf/hestia.conf
+# Version & Release Branch
+echo "VERSION='0.10.0'" >> $HESTIA/conf/hestia.conf
+echo "RELEASE='develop'" >> $HESTIA/conf/hestia.conf
 
 # Installing hosting packages
 cp -rf $hestiacp/packages $HESTIA/data/

+ 13 - 0
install/upgrade/0.10.0-190430.sh

@@ -13,6 +13,14 @@ if [ -z "$WEBMAIL_ALIAS_CHECK" ]; then
     echo "WEBMAIL_ALIAS='webmail'" >> $HESTIA/conf/hestia.conf
 fi
 
+# Add release branch system configuration if non-existent
+release_branch_check=$(cat $HESTIA/conf/hestia.conf | grep RELEASE_BRANCH)
+if [ -z "$release_branch_check" ]; then
+    echo "(*) Adding global release branch variable to system configuration..."
+    sed -i "/RELEASE_BRANCH/d" $HESTIA/conf/hestia.conf
+    echo "RELEASE_BRANCH='develop'" >> $HESTIA/conf/hestia.conf
+fi
+
 # load hestia.conf
 source $HESTIA/conf/hestia.conf
 
@@ -59,6 +67,11 @@ echo ""
 echo "This process may take a few moments, please wait..."
 echo ""
 
+# Set new version
+sed -i "/VERSION/d" $HESTIA/conf/hestia.conf
+# Set new branch variable
+echo "VERSION='0.10.0'" >> $HESTIA/conf/hestia.conf
+
 # Update Apache and Nginx configuration to support new file structure
 if [ -f /etc/apache2/apache.conf ]; then
     echo "(*) Updating Apache configuration..."

+ 10 - 0
web/edit/server/index.php

@@ -223,6 +223,16 @@ if (!empty($_POST['save'])) {
         }
     }
 
+    // Update release branch
+    if (empty($_SESSION['error_msg'])) {
+        if ($_POST['v_release_branch'] != $_SESSION['RELEASE_BRANCH']) {
+            exec (HESTIA_CMD."v-change-sys-release ".escapeshellarg($_POST['v_release_branch']), $output, $return_var);
+            check_return_code($return_var,$output);
+            unset($output);
+            $v_release_adv = 'yes';
+        }
+    }
+
     // Disable local backup
     if (empty($_SESSION['error_msg'])) {
         if (($_POST['v_backup'] == 'no') && ($v_backup == 'yes' )) {

+ 11 - 0
web/templates/admin/edit_server.html

@@ -100,6 +100,17 @@
                                     <br><br>
                                 </td>
                             </tr>
+                            <tr>
+                                <td class="vst-text input-label">
+                                    <?php print __('Release Branch') ?>
+                                </td>
+                            </tr>
+                            <tr>
+                                <td>
+                                    <input type="text" size="20" class="vst-input" name="v_release_branch" value="<?php echo $_SESSION['RELEASE_BRANCH']; ?>">
+                                    <br><br>
+                                </td>
+                            </tr>
                             <tr>
                                 <td class="vst-text input-label step-top">
                                     <a href="javascript:elementHideShow('web');" class="vst-text">