Skip to content

Commit f879f41

Browse files
committed
Remove hardcoded version from autocompile script
autodetect from local hestia/control file or github from specified branch name
1 parent 9b544be commit f879f41

File tree

1 file changed

+21
-12
lines changed

1 file changed

+21
-12
lines changed

src/hst_autocompile.sh

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,28 @@ INSTALL_DIR='/usr/local/hestia'
6464
SRC_DIR="$(cd "$(dirname "$0")/.." && pwd)"
6565
ARCHIVE_DIR="$SRC_DIR/src/archive/"
6666

67+
# Set command variables
68+
if [ ! -z "$2" ]; then
69+
branch=$2
70+
else
71+
echo -n "Please enter the name of the branch to build from (e.g. master): "
72+
read branch
73+
fi
74+
6775
# Set Version for compiling
68-
HESTIA_V='0.10.0-190430_amd64'
76+
if [ -f "$SRC_DIR/src/deb/hestia/control" ] && [ "$branch" = '~localsrc' ]; then
77+
BUILD_VER=$(cat $SRC_DIR/src/deb/hestia/control |grep "Version:" |cut -d' ' -f2)
78+
else
79+
BUILD_VER=$(curl -s https://raw.githubusercontent.com/hestiacp/hestiacp/$branch/src/deb/hestia/control |grep "Version:" |cut -d' ' -f2)
80+
fi
81+
82+
if [ -z "$BUILD_VER" ]; then
83+
echo "Error: Branch invalid, could not detect version"
84+
exit 1
85+
fi
86+
87+
BUILD_ARCH='amd64'
88+
HESTIA_V="${BUILD_VER}_${BUILD_ARCH}"
6989
NGINX_V='1.17.0'
7090
OPENSSL_V='1.1.1b'
7191
PCRE_V='8.43'
@@ -85,17 +105,6 @@ timestamp() {
85105
date +%s
86106
}
87107

88-
branch=$2
89-
install=$3
90-
91-
# Set install flags
92-
if [ ! -z "$2" ]; then
93-
branch=$2
94-
else
95-
echo -n "Please enter the name of the branch to build from (e.g. master): "
96-
read branch
97-
fi
98-
99108
if [ ! -z "$3" ]; then
100109
install=$3
101110
else

0 commit comments

Comments
 (0)