Skip to content

Commit 4f3ab58

Browse files
authored
Merge pull request hestiacp#409 from hestiacp/develop
No www alias for subdomain and adjust git update script.
2 parents 34e37c3 + 09223e5 commit 4f3ab58

File tree

1 file changed

+59
-58
lines changed

1 file changed

+59
-58
lines changed

bin/v-update-sys-hestia-git

Lines changed: 59 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,51 @@
44

55
# Define download function
66
download_file() {
7-
local url=$1
8-
local destination=$2
9-
local force=$3
10-
11-
# Default destination is the curent working directory
12-
local dstopt=""
13-
14-
if [ ! -z "$(echo "$url" | grep -E "\.(gz|gzip|bz2|zip|xz)$")" ]; then
15-
# When an archive file is downloaded it will be first saved localy
16-
dstopt="--directory-prefix=$ARCHIVE_DIR"
17-
local is_archive="true"
18-
local filename="${url##*/}"
19-
if [ -z "$filename" ]; then
20-
>&2 echo "[!] No filename was found in url, exiting ($url)"
21-
exit 1
7+
local url=$1
8+
local destination=$2
9+
local force=$3
10+
11+
# Default destination is the curent working directory
12+
local dstopt=""
13+
14+
if [ ! -z "$(echo "$url" | grep -E "\.(gz|gzip|bz2|zip|xz)$")" ]; then
15+
# When an archive file is downloaded it will be first saved localy
16+
dstopt="--directory-prefix=$ARCHIVE_DIR"
17+
local is_archive="true"
18+
local filename="${url##*/}"
19+
if [ -z "$filename" ]; then
20+
>&2 echo "[!] No filename was found in url, exiting ($url)"
21+
exit 1
22+
fi
23+
if [ ! -z "$force" ] && [ -f "$ARCHIVE_DIR/$filename" ]; then
24+
rm -f $ARCHIVE_DIR/$filename
25+
fi
26+
elif [ ! -z "$destination" ]; then
27+
# Plain files will be written to specified location
28+
dstopt="-O $destination"
29+
fi
30+
# check for corrupted archive
31+
if [ -f "$ARCHIVE_DIR/$filename" ] && [ "$is_archive" = "true" ]; then
32+
tar -tzf "$ARCHIVE_DIR/$filename" > /dev/null 2>&1
33+
if [ $? -ne 0 ]; then
34+
>&2 echo "[!] Archive $ARCHIVE_DIR/$filename is corrupted, redownloading"
35+
rm -f $ARCHIVE_DIR/$filename
36+
fi
2237
fi
23-
if [ ! -z "$force" ] && [ -f "$ARCHIVE_DIR/$filename" ]; then
24-
rm -f $ARCHIVE_DIR/$filename
25-
fi
26-
elif [ ! -z "$destination" ]; then
27-
# Plain files will be written to specified location
28-
dstopt="-O $destination"
29-
fi
30-
# check for corrupted archive
31-
if [ -f "$ARCHIVE_DIR/$filename" ] && [ "$is_archive" = "true" ]; then
32-
tar -tzf "$ARCHIVE_DIR/$filename" > /dev/null 2>&1
33-
if [ $? -ne 0 ]; then
34-
>&2 echo "[!] Archive $ARCHIVE_DIR/$filename is corrupted, redownloading"
35-
rm -f $ARCHIVE_DIR/$filename
36-
fi
37-
fi
3838

39-
if [ ! -f "$ARCHIVE_DIR/$filename" ]; then
40-
wget $url -q $dstopt --show-progress --progress=bar:force --limit-rate=3m
41-
fi
39+
if [ ! -f "$ARCHIVE_DIR/$filename" ]; then
40+
wget $url -q $dstopt --show-progress --progress=bar:force --limit-rate=3m
41+
fi
4242

43-
if [ ! -z "$destination" ] && [ "$is_archive" = "true" ]; then
44-
if [ "$destination" = "-" ]; then
45-
cat "$ARCHIVE_DIR/$filename"
46-
elif [ -d "$(dirname $destination)" ]; then
47-
cp "$ARCHIVE_DIR/$filename" "$destination"
43+
if [ ! -z "$destination" ] && [ "$is_archive" = "true" ]; then
44+
if [ "$destination" = "-" ]; then
45+
cat "$ARCHIVE_DIR/$filename"
46+
elif [ -d "$(dirname $destination)" ]; then
47+
cp "$ARCHIVE_DIR/$filename" "$destination"
48+
fi
4849
fi
49-
fi
5050
}
5151

52-
# Clear screen output before continuing
53-
clear
54-
5552
# Set compiling directory
5653
BUILD_DIR='/tmp/hestiacp-src/'
5754
DEB_DIR="$BUILD_DIR/debs/"
@@ -90,19 +87,23 @@ if [ ! -z "$1" ]; then
9087
echo "Error: invalid branch name specified."
9188
exit 1
9289
else
93-
branch=$1
90+
branch=$1
9491
fi
9592
else
96-
source /usr/local/hestia/conf/hestia.conf
97-
branch=$RELEASE_BRANCH
93+
source /usr/local/hestia/conf/hestia.conf
94+
branch=$RELEASE_BRANCH
9895
fi
9996

10097
if [ ! -z "$2" ]; then
101-
install=$2
98+
install=$2
10299
else
103-
install="y"
100+
install="y"
104101
fi
105102

103+
if [ -z "$branch" ]; then
104+
echo "No branch detected, please provide one using: v-update-sys-hestia-git branch"
105+
exit
106+
fi
106107

107108
# Install needed software
108109
echo "Updating system APT repositories..."
@@ -177,7 +178,7 @@ if [ "$NGINX_B" = true ] ; then
177178

178179
# Check install directory and remove if exists
179180
if [ -d "$BUILD_DIR$INSTALL_DIR" ]; then
180-
rm -r "$BUILD_DIR$INSTALL_DIR"
181+
rm -r "$BUILD_DIR$INSTALL_DIR"
181182
fi
182183

183184
# Create the files and install them
@@ -256,14 +257,14 @@ if [ "$PHP_B" = true ] ; then
256257
cd php-$PHP_V
257258

258259
# Configure PHP
259-
./configure --prefix=/usr/local/hestia/php \
260-
--enable-fpm \
261-
--with-fpm-user=admin \
262-
--with-fpm-group=admin \
263-
--with-libdir=lib/x86_64-linux-gnu \
264-
--with-mysqli \
265-
--with-curl \
266-
--enable-mbstring
260+
./configure --prefix=/usr/local/hestia/php \
261+
--enable-fpm \
262+
--with-fpm-user=admin \
263+
--with-fpm-group=admin \
264+
--with-libdir=lib/x86_64-linux-gnu \
265+
--with-mysqli \
266+
--with-curl \
267+
--enable-mbstring
267268

268269
# Create the files and install them
269270
make -j $NUM_CPUS && make INSTALL_ROOT=$BUILD_DIR install
@@ -372,8 +373,8 @@ fi
372373
if [ "$install" = 'yes' ] || [ "$install" = 'y' ]; then
373374
echo "Installing packages..."
374375
for i in $DEB_DIR/*.deb; do
375-
# Install all available packages
376-
dpkg -i $i
376+
# Install all available packages
377+
dpkg -i $i
377378
done
378379
unset $answer
379380
# Remove temporary files

0 commit comments

Comments
 (0)