11#! /bin/bash
22
3+ # Checking root permissions
4+ if [ " x$( id -u) " != ' x0' ]; then
5+ echo " Error: Script can be run executed only by root"
6+ exit 10
7+ fi
8+
39if [ -z " $HESTIA " ]; then
410 HESTIA=" /usr/local/hestia"
511fi
612
7- # Hestia php-fpm pool user
813user=' admin'
9-
1014source $HESTIA /func/main.sh
1115
16+ if [ -z " $HOMEDIR " ] || [ -z " $HESTIA_INSTALL_DIR " ]; then
17+ echo " Error: Hestia environment vars not present"
18+ exit 2
19+ fi
20+
1221FM_INSTALL_DIR=" $HESTIA /web/fm"
1322
1423FM_V=" 7.4.1"
@@ -27,15 +36,15 @@ if [ ! -f "$COMPOSER_BIN" ]; then
2736 check_result $? " Create temp file"
2837 chown $user : " $COMPOSER_SETUP_FILE "
2938
30- signature=" $( curl https://composer.github.io/installer.sig) "
39+ signature=" $( curl --silent --show-error https://composer.github.io/installer.sig) "
3140 check_result $? " Download signature"
3241
3342 user_exec wget --tries=3 --timeout=15 --read-timeout=15 --waitretry=3 --no-dns-cache https://getcomposer.org/installer --quiet -O " $COMPOSER_SETUP_FILE "
3443 check_result $? " Download composer installer"
3544
3645 [[ " $signature " = $( sha384sum $COMPOSER_SETUP_FILE | cut -f 1 -d " " ) ]] || check_result $E_INVALID " Composer signature does not match"
3746
38- COMPOSER_HOME=" $HOMEDIR /$user /.config/composer" user_exec /usr/bin/php " $COMPOSER_SETUP_FILE " --install-dir=" $COMPOSER_DIR " --filename=composer
47+ COMPOSER_HOME=" $HOMEDIR /$user /.config/composer" user_exec /usr/bin/php " $COMPOSER_SETUP_FILE " --quiet --install-dir=" $COMPOSER_DIR " --filename=composer
3948 check_result $? " Composer install failed"
4049
4150 [ -f " $COMPOSER_SETUP_FILE " ] && rm -f " $COMPOSER_SETUP_FILE "
@@ -50,12 +59,14 @@ cd "$FM_INSTALL_DIR"
5059unzip -qq " ${FM_INSTALL_DIR} /${FM_FILE} "
5160mv --force ${FM_INSTALL_DIR} /filegator/* " ${FM_INSTALL_DIR} "
5261rm --recursive --force ${FM_INSTALL_DIR} /filegator
53- chown root: " ${FM_INSTALL_DIR} "
5462
5563cp --recursive --force ${HESTIA_INSTALL_DIR} /filemanager/filegator/* " ${FM_INSTALL_DIR} "
5664
57- COMPOSER_HOME=" $HOMEDIR /$user /.config/composer" $COMPOSER_BIN require league/flysystem-sftp
65+ chown $user : -R " ${FM_INSTALL_DIR} "
66+ COMPOSER_HOME=" $HOMEDIR /$user /.config/composer" user_exec /usr/bin/php $COMPOSER_BIN --quiet require league/flysystem-sftp
67+ check_result $? " Install filemanager dependency"
5868
69+ chown root: -R " ${FM_INSTALL_DIR} "
5970chown $user : " ${FM_INSTALL_DIR} /private"
6071chown $user : " ${FM_INSTALL_DIR} /private/logs"
6172chown $user : " ${FM_INSTALL_DIR} /repository"
0 commit comments