|
4 | 4 |
|
5 | 5 | # Define download function |
6 | 6 | 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 |
22 | 37 | 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 |
38 | 38 |
|
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 |
42 | 42 |
|
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 |
48 | 49 | fi |
49 | | - fi |
50 | 50 | } |
51 | 51 |
|
52 | | -# Clear screen output before continuing |
53 | | -clear |
54 | | - |
55 | 52 | # Set compiling directory |
56 | 53 | BUILD_DIR='/tmp/hestiacp-src/' |
57 | 54 | DEB_DIR="$BUILD_DIR/debs/" |
@@ -90,19 +87,23 @@ if [ ! -z "$1" ]; then |
90 | 87 | echo "Error: invalid branch name specified." |
91 | 88 | exit 1 |
92 | 89 | else |
93 | | - branch=$1 |
| 90 | + branch=$1 |
94 | 91 | fi |
95 | 92 | 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 |
98 | 95 | fi |
99 | 96 |
|
100 | 97 | if [ ! -z "$2" ]; then |
101 | | - install=$2 |
| 98 | + install=$2 |
102 | 99 | else |
103 | | - install="y" |
| 100 | + install="y" |
104 | 101 | fi |
105 | 102 |
|
| 103 | +if [ -z "$branch" ]; then |
| 104 | + echo "No branch detected, please provide one using: v-update-sys-hestia-git branch" |
| 105 | + exit |
| 106 | +fi |
106 | 107 |
|
107 | 108 | # Install needed software |
108 | 109 | echo "Updating system APT repositories..." |
@@ -177,7 +178,7 @@ if [ "$NGINX_B" = true ] ; then |
177 | 178 |
|
178 | 179 | # Check install directory and remove if exists |
179 | 180 | if [ -d "$BUILD_DIR$INSTALL_DIR" ]; then |
180 | | - rm -r "$BUILD_DIR$INSTALL_DIR" |
| 181 | + rm -r "$BUILD_DIR$INSTALL_DIR" |
181 | 182 | fi |
182 | 183 |
|
183 | 184 | # Create the files and install them |
@@ -256,14 +257,14 @@ if [ "$PHP_B" = true ] ; then |
256 | 257 | cd php-$PHP_V |
257 | 258 |
|
258 | 259 | # 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 |
267 | 268 |
|
268 | 269 | # Create the files and install them |
269 | 270 | make -j $NUM_CPUS && make INSTALL_ROOT=$BUILD_DIR install |
|
372 | 373 | if [ "$install" = 'yes' ] || [ "$install" = 'y' ]; then |
373 | 374 | echo "Installing packages..." |
374 | 375 | 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 |
377 | 378 | done |
378 | 379 | unset $answer |
379 | 380 | # Remove temporary files |
|
0 commit comments