Add snippet 'get-path-of-php-command.sh' and change concerning code..

This commit is contained in:
Christoph 2023-08-03 00:11:02 +02:00
parent 1df7bb124b
commit d84294cf0b
18 changed files with 287 additions and 117 deletions

View File

@ -294,6 +294,11 @@ source ${snippet_dir}/get-webservice-environment.sh
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
CURRENT_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)" CURRENT_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)"
@ -311,6 +316,8 @@ echo -e " Webserver group......................: $HTTP_GROUP"
echo "" echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo ""
echo -e " PHP Command..........................: $PHP_BIN"
echo "" echo ""
echo -n " Type upper case 'YES' to continue executing with this parameters: " echo -n " Type upper case 'YES' to continue executing with this parameters: "
@ -516,7 +523,7 @@ echo ""
# - Add missing columns # - Add missing columns
# - # -
echononl " Add missing columns .." echononl " Add missing columns .."
su -c "/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ db:add-missing-columns" -s /bin/bash $HTTP_USER > $log_file 2>&1 su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-columns" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok
else else

View File

@ -282,6 +282,7 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
fi fi
fi fi
NGINX_IS_ENABLED=false NGINX_IS_ENABLED=false
APACHE2_IS_ENABLED=false APACHE2_IS_ENABLED=false
@ -289,10 +290,17 @@ APACHE2_IS_ENABLED=false
# #
source ${snippet_dir}/get-webservice-environment.sh source ${snippet_dir}/get-webservice-environment.sh
# Check PHP Version # Check PHP Version
# #
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
CURRENT_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)" CURRENT_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)"
@ -310,6 +318,8 @@ echo -e " Webserver group......................: $HTTP_GROUP"
echo "" echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo ""
echo -e " PHP Command..........................: $PHP_BIN"
echo "" echo ""
echo -n " Type upper case 'YES' to continue executing with this parameters: " echo -n " Type upper case 'YES' to continue executing with this parameters: "
@ -515,7 +525,7 @@ echo ""
# - Create missing indices # - Create missing indices
# - # -
echononl " Add missing indices .." echononl " Add missing indices .."
su -c "/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ db:add-missing-indices" -s /bin/bash $HTTP_USER > $log_file 2>&1 su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-indices" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok
else else

View File

@ -294,6 +294,11 @@ source ${snippet_dir}/get-webservice-environment.sh
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" CURRENT_INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
CURRENT_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)" CURRENT_VERSION="$(basename $CURRENT_INSTALL_DIR | cut -d"-" -f2)"
@ -311,6 +316,8 @@ echo -e " Webserver group......................: $HTTP_GROUP"
echo "" echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo ""
echo -e " PHP Command..........................: $PHP_BIN"
echo "" echo ""
echo -n " Type upper case 'YES' to continue executing with this parameters: " echo -n " Type upper case 'YES' to continue executing with this parameters: "
@ -516,7 +523,7 @@ echo ""
# - Create missing indices # - Create missing indices
# - # -
echononl " Add missing primary keys .." echononl " Add missing primary keys .."
su -c "/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ db:add-missing-primary-keys" -s /bin/bash $HTTP_USER > $log_file 2>&1 su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ db:add-missing-primary-keys" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok
else else

View File

@ -333,6 +333,11 @@ source ${snippet_dir}/get-webservice-environment.sh
# #
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud` CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud`
CURRENT_DATA_DIR=`realpath ${WEB_BASE_DIR}/data` CURRENT_DATA_DIR=`realpath ${WEB_BASE_DIR}/data`
CURRENT_VERSION=`basename $CURRENT_INSTALL_DIR | cut -d"-" -f2` CURRENT_VERSION=`basename $CURRENT_INSTALL_DIR | cut -d"-" -f2`
@ -391,6 +396,8 @@ echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo "" echo ""
echo -e " PHP Command..........................: $PHP_BIN"
echo ""
echo -e " Databse name.........................: $DATABASE_NAME" echo -e " Databse name.........................: $DATABASE_NAME"
echo -e " Database type........................: $DATABASE_TYPE" echo -e " Database type........................: $DATABASE_TYPE"
echo "" echo ""
@ -429,7 +436,7 @@ echo ""
# - # -
echononl " Add user \033[37m\033[1m$USER\033[m to group \033[37m\033[1m$GROUP\033[m .." echononl " Add user \033[37m\033[1m$USER\033[m to group \033[37m\033[1m$GROUP\033[m .."
su -c "/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ group:adduser '$GROUP' '$USER'" -s /bin/bash $HTTP_USER > $log_file 2>&1 su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ group:adduser '$GROUP' '$USER'" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok
else else
@ -437,7 +444,7 @@ else
blank_line blank_line
echo "" echo ""
echo -e "\033[37m\033[1mcommandline was:\033[m" echo -e "\033[37m\033[1mcommandline was:\033[m"
echo "su -c \"/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ group:adduser '$GROUP' '$USER'\" -s /bin/bash $HTTP_USER" echo "su -c \"${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ group:adduser '$GROUP' '$USER'\" -s /bin/bash $HTTP_USER"
blank_line blank_line
warn "Despite errors, it is possible that the user \033[37m\033[1m$USER\033[m was added to the group \033[37m\033[1m$GROUP\033[m" warn "Despite errors, it is possible that the user \033[37m\033[1m$USER\033[m was added to the group \033[37m\033[1m$GROUP\033[m"
fatal "$(cat $log_file)" fatal "$(cat $log_file)"

View File

@ -306,13 +306,11 @@ source ${snippet_dir}/get-webservice-environment.sh
# #
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php" # Get full qualified PHP command
elif [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then #
PHP_BIN="/usr/local/php/bin/php" source ${snippet_dir}/get-path-of-php-command.sh
else
PHP_BIN="$(which php)"
fi
if [[ ! -x "$PHP_BIN" ]]; then if [[ ! -x "$PHP_BIN" ]]; then
fatal "No PHP binary found!" fatal "No PHP binary found!"

View File

@ -307,13 +307,11 @@ source ${snippet_dir}/get-webservice-environment.sh
# #
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php" # Get full qualified PHP command
elif [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then #
PHP_BIN="/usr/local/php/bin/php" source ${snippet_dir}/get-path-of-php-command.sh
else
PHP_BIN="$(which php)"
fi
if [[ ! -x "$PHP_BIN" ]]; then if [[ ! -x "$PHP_BIN" ]]; then
fatal "No PHP binary found!" fatal "No PHP binary found!"
@ -379,7 +377,7 @@ echo ""
# - # -
echononl " Check, if we can disable legacy encryption - Checking for old files.." echononl " Check, if we can disable legacy encryption - Checking for old files.."
su -c "/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ encryption:scan:legacy-format" -s /bin/bash $HTTP_USER > $log_file 2>&1 su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ encryption:scan:legacy-format" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok
info "Output of command \033[37m\033[1mocc encryption:scan:legacy-format\033[m was:\n\n$(cat $log_file)" info "Output of command \033[37m\033[1mocc encryption:scan:legacy-format\033[m was:\n\n$(cat $log_file)"
@ -388,7 +386,7 @@ else
blank_line blank_line
echo "" echo ""
echo -e "\033[37m\033[1mcommandline was:\033[m" echo -e "\033[37m\033[1mcommandline was:\033[m"
echo "su -c \"/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ encryption:scan:legacy-format\" -s /bin/bash $HTTP_USER" echo "su -c \"${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ encryption:scan:legacy-format\" -s /bin/bash $HTTP_USER"
error "Output of command \033[37m\033[1mocc encryption:scan:legacy-format\033[m was:\n\n$(cat $log_file)" error "Output of command \033[37m\033[1mocc encryption:scan:legacy-format\033[m was:\n\n$(cat $log_file)"
fi fi

View File

@ -306,13 +306,11 @@ source ${snippet_dir}/get-webservice-environment.sh
# #
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php" # Get full qualified PHP command
elif [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then #
PHP_BIN="/usr/local/php/bin/php" source ${snippet_dir}/get-path-of-php-command.sh
else
PHP_BIN="$(which php)"
fi
if [[ ! -x "$PHP_BIN" ]]; then if [[ ! -x "$PHP_BIN" ]]; then
fatal "No PHP binary found!" fatal "No PHP binary found!"

View File

@ -216,13 +216,38 @@ if [[ -z "$WEBSITE" ]] ; then
fi fi
WEB_BASE_DIR="/var/www/${WEBSITE}"
# - Reset IFS
# -
IFS=$CUR_IFS
DEFAULT_SRC_BASE_DIR="/usr/local/src/nextcloud"
DEFAULT_HTTP_USER="www-data"
DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE='FPM'
echo ""
echononl " Include Configuration file.."
if [[ ! -f $conf_file ]]; then
echo_failed
fatal "Missing configuration file '$conf_file'."
else
source $conf_file
echo_ok
fi
echo ""
DEFAULT_WEB_BASE_DIR="/var/www/${WEBSITE}"
[[ -n "$WEB_BASE_DIR" ]] || WEB_BASE_DIR=$DEFAULT_WEB_BASE_DIR
if [[ ! -d ${WEB_BASE_DIR} ]] ; then if [[ ! -d ${WEB_BASE_DIR} ]] ; then
fatal "Web base directory '$WEB_BASE_DIR' not found!" fatal "Web base directory '$WEB_BASE_DIR' not found!"
fi fi
DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)" DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)"
[[ -n "$PHP_ENGINE" ]] || PHP_ENGINE=$DEFAULT_PHP_ENGINE
INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)"
@ -275,11 +300,15 @@ APACHE2_IS_ENABLED=false
source ${snippet_dir}/get-webservice-environment.sh source ${snippet_dir}/get-webservice-environment.sh
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then # Check PHP Version
PHP_BIN="/usr/local/php/bin/php" #
else source ${snippet_dir}/get-php-major-version.sh
PHP_BIN="$(which php)"
fi
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
if [[ ! -x "$PHP_BIN" ]]; then if [[ ! -x "$PHP_BIN" ]]; then
fatal "No PHP binary found!" fatal "No PHP binary found!"

View File

@ -228,14 +228,33 @@ fi
# - # -
IFS=$CUR_IFS IFS=$CUR_IFS
DEFAULT_SRC_BASE_DIR="/usr/local/src/nextcloud"
DEFAULT_HTTP_USER="www-data"
DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE='FPM'
WEB_BASE_DIR="/var/www/${WEBSITE}" echo ""
echononl " Include Configuration file.."
if [[ ! -f $conf_file ]]; then
echo_failed
fatal "Missing configuration file '$conf_file'."
else
source $conf_file
echo_ok
fi
echo ""
DEFAULT_WEB_BASE_DIR="/var/www/${WEBSITE}"
[[ -n "$WEB_BASE_DIR" ]] || WEB_BASE_DIR=$DEFAULT_WEB_BASE_DIR
if [[ ! -d ${WEB_BASE_DIR} ]] ; then if [[ ! -d ${WEB_BASE_DIR} ]] ; then
fatal "Web base directory '$WEB_BASE_DIR' not found!" fatal "Web base directory '$WEB_BASE_DIR' not found!"
fi fi
DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)" DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)"
[[ -n "$PHP_ENGINE" ]] || PHP_ENGINE=$DEFAULT_PHP_ENGINE
INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)"
@ -288,11 +307,15 @@ APACHE2_IS_ENABLED=false
source ${snippet_dir}/get-webservice-environment.sh source ${snippet_dir}/get-webservice-environment.sh
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then # Check PHP Version
PHP_BIN="/usr/local/php/bin/php" #
else source ${snippet_dir}/get-php-major-version.sh
PHP_BIN="$(which php)"
fi
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
if [[ ! -x "$PHP_BIN" ]]; then if [[ ! -x "$PHP_BIN" ]]; then
fatal "No PHP binary found!" fatal "No PHP binary found!"

View File

@ -228,13 +228,33 @@ fi
# - # -
IFS=$CUR_IFS IFS=$CUR_IFS
WEB_BASE_DIR="/var/www/${WEBSITE}" DEFAULT_SRC_BASE_DIR="/usr/local/src/nextcloud"
DEFAULT_HTTP_USER="www-data"
DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE='FPM'
echo ""
echononl " Include Configuration file.."
if [[ ! -f $conf_file ]]; then
echo_failed
fatal "Missing configuration file '$conf_file'."
else
source $conf_file
echo_ok
fi
echo ""
DEFAULT_WEB_BASE_DIR="/var/www/${WEBSITE}"
[[ -n "$WEB_BASE_DIR" ]] || WEB_BASE_DIR=$DEFAULT_WEB_BASE_DIR
if [[ ! -d ${WEB_BASE_DIR} ]] ; then if [[ ! -d ${WEB_BASE_DIR} ]] ; then
fatal "Web base directory '$WEB_BASE_DIR' not found!" fatal "Web base directory '$WEB_BASE_DIR' not found!"
fi fi
DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)" DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)"
[[ -n "$PHP_ENGINE" ]] || PHP_ENGINE=$DEFAULT_PHP_ENGINE
INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)"
@ -293,11 +313,15 @@ APACHE2_IS_ENABLED=false
source ${snippet_dir}/get-webservice-environment.sh source ${snippet_dir}/get-webservice-environment.sh
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then # Check PHP Version
PHP_BIN="/usr/local/php/bin/php" #
else source ${snippet_dir}/get-php-major-version.sh
PHP_BIN="$(which php)"
fi
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
if [[ ! -x "$PHP_BIN" ]]; then if [[ ! -x "$PHP_BIN" ]]; then
fatal "No PHP binary found!" fatal "No PHP binary found!"

View File

@ -228,13 +228,33 @@ fi
# - # -
IFS=$CUR_IFS IFS=$CUR_IFS
WEB_BASE_DIR="/var/www/${WEBSITE}" DEFAULT_SRC_BASE_DIR="/usr/local/src/nextcloud"
DEFAULT_HTTP_USER="www-data"
DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE='FPM'
echo ""
echononl " Include Configuration file.."
if [[ ! -f $conf_file ]]; then
echo_failed
fatal "Missing configuration file '$conf_file'."
else
source $conf_file
echo_ok
fi
echo ""
DEFAULT_WEB_BASE_DIR="/var/www/${WEBSITE}"
[[ -n "$WEB_BASE_DIR" ]] || WEB_BASE_DIR=$DEFAULT_WEB_BASE_DIR
if [[ ! -d ${WEB_BASE_DIR} ]] ; then if [[ ! -d ${WEB_BASE_DIR} ]] ; then
fatal "Web base directory '$WEB_BASE_DIR' not found!" fatal "Web base directory '$WEB_BASE_DIR' not found!"
fi fi
DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)" DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)"
[[ -n "$PHP_ENGINE" ]] || PHP_ENGINE=$DEFAULT_PHP_ENGINE
INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)"
@ -293,11 +313,15 @@ APACHE2_IS_ENABLED=false
source ${snippet_dir}/get-webservice-environment.sh source ${snippet_dir}/get-webservice-environment.sh
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then # Check PHP Version
PHP_BIN="/usr/local/php/bin/php" #
else source ${snippet_dir}/get-php-major-version.sh
PHP_BIN="$(which php)"
fi
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
if [[ ! -x "$PHP_BIN" ]]; then if [[ ! -x "$PHP_BIN" ]]; then
fatal "No PHP binary found!" fatal "No PHP binary found!"

View File

@ -228,13 +228,33 @@ fi
# - # -
IFS=$CUR_IFS IFS=$CUR_IFS
WEB_BASE_DIR="/var/www/${WEBSITE}" DEFAULT_SRC_BASE_DIR="/usr/local/src/nextcloud"
DEFAULT_HTTP_USER="www-data"
DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE='FPM'
echo ""
echononl " Include Configuration file.."
if [[ ! -f $conf_file ]]; then
echo_failed
fatal "Missing configuration file '$conf_file'."
else
source $conf_file
echo_ok
fi
echo ""
DEFAULT_WEB_BASE_DIR="/var/www/${WEBSITE}"
[[ -n "$WEB_BASE_DIR" ]] || WEB_BASE_DIR=$DEFAULT_WEB_BASE_DIR
if [[ ! -d ${WEB_BASE_DIR} ]] ; then if [[ ! -d ${WEB_BASE_DIR} ]] ; then
fatal "Web base directory '$WEB_BASE_DIR' not found!" fatal "Web base directory '$WEB_BASE_DIR' not found!"
fi fi
DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)" DATA_DIR="$(realpath ${WEB_BASE_DIR}/data)"
[[ -n "$PHP_ENGINE" ]] || PHP_ENGINE=$DEFAULT_PHP_ENGINE
INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)" INSTALL_DIR="$(realpath ${WEB_BASE_DIR}/nextcloud)"
CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)" CURRENT_VERSION="$(basename $INSTALL_DIR | cut -d"-" -f2)"
@ -292,11 +312,15 @@ APACHE2_IS_ENABLED=false
source ${snippet_dir}/get-webservice-environment.sh source ${snippet_dir}/get-webservice-environment.sh
if [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then # Check PHP Version
PHP_BIN="/usr/local/php/bin/php" #
else source ${snippet_dir}/get-php-major-version.sh
PHP_BIN="$(which php)"
fi
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
if [[ ! -x "$PHP_BIN" ]]; then if [[ ! -x "$PHP_BIN" ]]; then
fatal "No PHP binary found!" fatal "No PHP binary found!"

View File

@ -334,6 +334,12 @@ source ${snippet_dir}/get-webservice-environment.sh
# #
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud` CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud`
CURRENT_DATA_DIR=`realpath ${WEB_BASE_DIR}/data` CURRENT_DATA_DIR=`realpath ${WEB_BASE_DIR}/data`
CURRENT_VERSION=`basename $CURRENT_INSTALL_DIR | cut -d"-" -f2` CURRENT_VERSION=`basename $CURRENT_INSTALL_DIR | cut -d"-" -f2`
@ -392,6 +398,8 @@ echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo "" echo ""
echo -e " PHP command..........................: $PHP_BIN"
echo ""
echo -e " Databse name.........................: $DATABASE_NAME" echo -e " Databse name.........................: $DATABASE_NAME"
echo -e " Database type........................: $DATABASE_TYPE" echo -e " Database type........................: $DATABASE_TYPE"
echo "" echo ""
@ -430,7 +438,7 @@ echo ""
# - # -
echononl " Remove user \033[37m\033[1m$USER\033[m from group \033[37m\033[1m$GROUP\033[m .." echononl " Remove user \033[37m\033[1m$USER\033[m from group \033[37m\033[1m$GROUP\033[m .."
su -c "/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ group:removeuser '$GROUP' '$USER'" -s /bin/bash $HTTP_USER > $log_file 2>&1 su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ group:removeuser '$GROUP' '$USER'" -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok
else else
@ -438,7 +446,7 @@ else
blank_line blank_line
echo "" echo ""
echo -e "\033[37m\033[1mcommandline was:\033[m" echo -e "\033[37m\033[1mcommandline was:\033[m"
echo -e "su -c \"/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ group:removeuser '$GROUP' '$USER'\" -s /bin/bash $HTTP_USER" echo -e "su -c \"${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ group:removeuser '$GROUP' '$USER'\" -s /bin/bash $HTTP_USER"
blank_line blank_line
warn "Despite errors, it is possible that the user \033[37m\033[1m$USER\033[m was removed from the group \033[37m\033[1m$GROUP\033[m" warn "Despite errors, it is possible that the user \033[37m\033[1m$USER\033[m was removed from the group \033[37m\033[1m$GROUP\033[m"
fatal "$(cat $log_file)" fatal "$(cat $log_file)"

View File

@ -295,6 +295,16 @@ source ${snippet_dir}/get-webservice-environment.sh
# #
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
if [[ ! -x "$PHP_BIN" ]]; then
fatal "No PHP binary found!"
fi
echo "" echo ""
echo -e " \033[32m--\033[m" echo -e " \033[32m--\033[m"
echo "" echo ""
@ -347,6 +357,8 @@ echo -e " Webserver group......................: $HTTP_GROUP"
echo "" echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo ""
echo -e " PHP Command..........................: $PHP_BIN"
echo "" echo ""
echo -n " Type upper case 'YES' to continue executing with this parameters: " echo -n " Type upper case 'YES' to continue executing with this parameters: "
@ -376,7 +388,7 @@ echo ""
# - Create missing indices # - Create missing indices
# - # -
echononl " Replace Favicon Icon with \033[1m$(basename ${CUSTOM_FAVICON_PATH})\033[m .." echononl " Replace Favicon Icon with \033[1m$(basename ${CUSTOM_FAVICON_PATH})\033[m .."
su -c "/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ theming:config favicon ${CUSTOM_FAVICON_PATH}" \ su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ theming:config favicon ${CUSTOM_FAVICON_PATH}" \
-s /bin/bash $HTTP_USER > $log_file 2>&1 -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok

View File

@ -223,6 +223,16 @@ echo -e "\033[32m-----\033[m"
source ${snippet_dir}/get-cloud-instance-to-update.sh source ${snippet_dir}/get-cloud-instance-to-update.sh
# Check PHP Version
#
source ${snippet_dir}/get-php-major-version.sh
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
# - Reset IFS # - Reset IFS
# - # -
IFS=$CUR_IFS IFS=$CUR_IFS
@ -296,6 +306,11 @@ source ${snippet_dir}/get-webservice-environment.sh
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
echo "" echo ""
echo -e " \033[32m--\033[m" echo -e " \033[32m--\033[m"
echo "" echo ""
@ -348,6 +363,8 @@ echo -e " Webserver group......................: $HTTP_GROUP"
echo "" echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo ""
echo -e " PHP Command..........................: $PHP_BIN"
echo "" echo ""
echo -n " Type upper case 'YES' to continue executing with this parameters: " echo -n " Type upper case 'YES' to continue executing with this parameters: "
@ -377,7 +394,7 @@ echo ""
# - Create missing indices # - Create missing indices
# - # -
echononl " Replace Logo with \033[1m$(basename ${CUSTOM_LOGO_PATH})\033[m .." echononl " Replace Logo with \033[1m$(basename ${CUSTOM_LOGO_PATH})\033[m .."
su -c "/usr/local/php/bin/php ${WEB_BASE_DIR}/htdocs/occ theming:config logo ${CUSTOM_LOGO_PATH}" \ su -c "${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ theming:config logo ${CUSTOM_LOGO_PATH}" \
-s /bin/bash $HTTP_USER > $log_file 2>&1 -s /bin/bash $HTTP_USER > $log_file 2>&1
if [[ $? -eq 0 ]]; then if [[ $? -eq 0 ]]; then
echo_ok echo_ok

View File

@ -301,25 +301,9 @@ source ${snippet_dir}/get-webservice-environment.sh
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
# Get full qualified PHP command
# - Determin PHP binary #
# - source ${snippet_dir}/get-path-of-php-command.sh
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
php_binary="/usr/local/php-${PHP_VERSION}/bin/php"
else
php_binary="$(realpath "$(which php)")"
if [[ -z "$php_binary" ]]; then
if [[ -x "/usr/local/php/bin/php" ]]; then
php_binary="/usr/local/php/bin/php"
else
fatal "No PHP binary present"
fi
else
if [[ ! -x "$php_binary" ]]; then
fatal "Found PHP binary '$php_binary', but this file is not executable!"
fi
fi
fi
@ -371,7 +355,7 @@ read _IN
done done
CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud` CURRENT_INSTALL_DIR=`realpath ${WEB_BASE_DIR}/nextcloud`
CURRENT_VERSION="$(sudo -u $HTTP_USER $php_binary ${WEB_BASE_DIR}/htdocs/occ --version | cut -d' ' -f2)" CURRENT_VERSION="$(sudo -u $HTTP_USER ${PHP_BIN} ${WEB_BASE_DIR}/htdocs/occ --version | cut -d' ' -f2)"
DATA_DIR=${WEB_BASE_DIR}/data DATA_DIR=${WEB_BASE_DIR}/data
@ -389,7 +373,8 @@ echo -e " Webserver user.......................: $HTTP_USER"
echo "" echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo -e " PHP binary...........................: $php_binary" echo ""
echo -e " PHP Command..........................: $PHP_BIN"
echo "" echo ""
echo -e " Version to rstore....................: $RESTORE_VERSION" echo -e " Version to rstore....................: $RESTORE_VERSION"
echo -e " Backup date was......................: $DATE_RESTORE_VERSION" echo -e " Backup date was......................: $DATE_RESTORE_VERSION"

View File

@ -0,0 +1,7 @@
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php"
elif [[ -x "$(realpath /usr/local/php/bin/php)" ]]; then
PHP_BIN="/usr/local/php/bin/php"
else
PHP_BIN="$(which php)"
fi

View File

@ -252,6 +252,11 @@ echo -e "\033[32m-----\033[m"
source ${snippet_dir}/get-cloud-instance-to-update.sh source ${snippet_dir}/get-cloud-instance-to-update.sh
# Get full qualified PHP command
#
source ${snippet_dir}/get-path-of-php-command.sh
# - Reset IFS # - Reset IFS
# - # -
IFS=$CUR_IFS IFS=$CUR_IFS
@ -386,24 +391,10 @@ source ${snippet_dir}/get-webservice-environment.sh
source ${snippet_dir}/get-php-major-version.sh source ${snippet_dir}/get-php-major-version.sh
# - Determin PHP binary # Get full qualified PHP command
# - #
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then source ${snippet_dir}/get-path-of-php-command.sh
php_binary="/usr/local/php-${PHP_VERSION}/bin/php"
else
php_binary="$(realpath "$(which php)")"
if [[ -z "$php_binary" ]]; then
if [[ -x "/usr/local/php/bin/php" ]]; then
php_binary="/usr/local/php/bin/php"
else
fatal "No PHP binary present"
fi
else
if [[ ! -x "$php_binary" ]]; then
fatal "Found PHP binary '$php_binary', but this file is not executable!"
fi
fi
fi
# --- # ---
@ -452,7 +443,8 @@ echo -e " Webserver user.......................: $HTTP_USER"
echo "" echo ""
echo -e " PHP version..........................: $PHP_VERSION" echo -e " PHP version..........................: $PHP_VERSION"
echo -e " PHP Engine...........................: $PHP_ENGINE" echo -e " PHP Engine...........................: $PHP_ENGINE"
echo -e " PHP binary...........................: $php_binary" echo ""
echo -e " PHP Command..........................: $PHP_BIN"
echo "" echo ""
echo -e " Databse name.........................: $DATABASE_NAME" echo -e " Databse name.........................: $DATABASE_NAME"
echo -e " Database type........................: $DATABASE_TYPE" echo -e " Database type........................: $DATABASE_TYPE"
@ -897,7 +889,7 @@ fi
#_app="calendar" #_app="calendar"
# #
#echononl "Install nextcloud app '$_app'.." #echononl "Install nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
#else #else
@ -920,7 +912,7 @@ fi
#fi #fi
# #
#echononl "Eanable nextcloud app '$_app'.." #echononl "Eanable nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
#else #else
@ -946,7 +938,7 @@ fi
#_app="contacts" #_app="contacts"
# #
#echononl "Install nextcloud app '$_app'.." #echononl "Install nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
#else #else
@ -969,7 +961,7 @@ fi
#fi #fi
# #
#echononl "Enable nextcloud app '$_app'.." #echononl "Enable nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
#else #else
@ -995,7 +987,7 @@ fi
#_app="notes" #_app="notes"
# #
#echononl "Install nextcloud app '$_app'.." #echononl "Install nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
#else #else
@ -1018,7 +1010,7 @@ fi
#fi #fi
# #
#echononl "Eanable nextcloud app '$_app'.." #echononl "Eanable nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
#else #else
@ -1044,7 +1036,7 @@ fi
#_app="tasks" #_app="tasks"
# #
#echononl "Install nextcloud app '$_app'.." #echononl "Install nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1
# #
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
@ -1068,7 +1060,7 @@ fi
#fi #fi
# #
#echononl "Eanable nextcloud app '$_app'.." #echononl "Eanable nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
#else #else
@ -1096,7 +1088,7 @@ fi
# _app="richdocuments" # _app="richdocuments"
# #
# echononl "Install nextcloud app '$_app'.." # echononl "Install nextcloud app '$_app'.."
# sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1 # sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1
# if [[ $? -eq 0 ]]; then # if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
# else # else
@ -1119,7 +1111,7 @@ fi
# fi # fi
# #
# echononl "Eanable nextcloud app '$_app'.." # echononl "Eanable nextcloud app '$_app'.."
# sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1 # sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1
# if [[ $? -eq 0 ]]; then # if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
# else # else
@ -1142,7 +1134,7 @@ fi
# echo_skipped # echo_skipped
# error "No Wopi URL given (variable 'WOPI_URL')." # error "No Wopi URL given (variable 'WOPI_URL')."
# else # else
# sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:app:set richdocuments wopi_url --value="$WOPI_URL" >> $log_file 2>&1 # sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" config:app:set richdocuments wopi_url --value="$WOPI_URL" >> $log_file 2>&1
# if [[ $? -eq 0 ]]; then # if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
# else # else
@ -1170,7 +1162,7 @@ fi
#_app="bruteforcesettings" #_app="bruteforcesettings"
# #
#echononl "Install nextcloud app '$_app'.." #echononl "Install nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
#else #else
@ -1193,7 +1185,7 @@ fi
#fi #fi
# #
#echononl "Eanable nextcloud app '$_app'.." #echononl "Eanable nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1
# #
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
@ -1217,7 +1209,7 @@ fi
#_app="announcementcenter" #_app="announcementcenter"
# #
#echononl "Install nextcloud app '$_app'.." #echononl "Install nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok
#else #else
@ -1240,7 +1232,7 @@ fi
#fi #fi
# #
#echononl "Eanable nextcloud app '$_app'.." #echononl "Eanable nextcloud app '$_app'.."
#sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1 #sudo -u "$HTTP_USER" "${PHP_BIN}" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1
# #
#if [[ $? -eq 0 ]]; then #if [[ $? -eq 0 ]]; then
# echo_ok # echo_ok