update_nextcloud.sh: determin PHP_VERSION if not given.
This commit is contained in:
parent
7eeab15a4b
commit
ab407905df
@ -43,6 +43,19 @@ WEBSITE="<site-name-of-cloud-instance>"
|
|||||||
#HTTP_GROUP=
|
#HTTP_GROUP=
|
||||||
|
|
||||||
|
|
||||||
|
# - VHOST_CONFIG_FILE
|
||||||
|
# -
|
||||||
|
# - Vhost configuration file
|
||||||
|
# -
|
||||||
|
# - The script will determin the vhost configuration file by trying
|
||||||
|
# - the following pathes:
|
||||||
|
# - - /usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm
|
||||||
|
# - - /usr/local/apache2/conf/vhosts/${WEBSITE}.conf
|
||||||
|
# - - /etc/apache2/sites-enabled/${WEBSITE}.conf
|
||||||
|
# -
|
||||||
|
#VHOST_CONFIG_FILE=""
|
||||||
|
|
||||||
|
|
||||||
# - Web base directory
|
# - Web base directory
|
||||||
# -
|
# -
|
||||||
# - the directory where the documentroot lives
|
# - the directory where the documentroot lives
|
||||||
@ -61,13 +74,15 @@ WEBSITE="<site-name-of-cloud-instance>"
|
|||||||
|
|
||||||
# - PHP main version
|
# - PHP main version
|
||||||
# -
|
# -
|
||||||
|
# - only needed, if PHP_ENGINE ist set to 'FPM'
|
||||||
|
# -
|
||||||
|
# - The script tries to determin the PHP version (in case of PHP_ENGINE=FPM)
|
||||||
|
# -
|
||||||
# - Examples:
|
# - Examples:
|
||||||
# - PHP_VERSION=5.6
|
# - PHP_VERSION=5.6
|
||||||
# - PHP_VERSION=7.1
|
# - PHP_VERSION=7.1
|
||||||
# -
|
# -
|
||||||
# - only needed, if PHP_ENGINE ist set to 'FPM'
|
#PHP_VERSION=
|
||||||
# -
|
|
||||||
PHP_VERSION=
|
|
||||||
|
|
||||||
# - Database type
|
# - Database type
|
||||||
# -
|
# -
|
||||||
|
@ -295,10 +295,6 @@ fi
|
|||||||
|
|
||||||
[[ -n "$PHP_ENGINE" ]] || PHP_ENGINE=$DEFAULT_PHP_ENGINE
|
[[ -n "$PHP_ENGINE" ]] || PHP_ENGINE=$DEFAULT_PHP_ENGINE
|
||||||
|
|
||||||
if [[ "$PHP_ENGINE" = "FPM" ]] && [[ -z "$PHP_VERSION" ]] ; then
|
|
||||||
fatal "PHP Version must be givven if running PHP-FPM engine (parameter 'PHP_VERSION')"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [[ "$DATABASE_TYPE" != "postgres" ]] && [[ "$DATABASE_TYPE" != "mysql" ]]; then
|
if [[ "$DATABASE_TYPE" != "postgres" ]] && [[ "$DATABASE_TYPE" != "mysql" ]]; then
|
||||||
fatal "Wrong or missing database type (parameter 'DATABASE_TYPE')"
|
fatal "Wrong or missing database type (parameter 'DATABASE_TYPE')"
|
||||||
fi
|
fi
|
||||||
@ -317,6 +313,26 @@ if [[ "$DATABASE_TYPE" = "postgres" ]]; then
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Check PHP Version
|
||||||
|
#
|
||||||
|
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
|
||||||
|
if [[ -z "$PHP_VERSION" ]] ; then
|
||||||
|
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
|
||||||
|
if [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm" ]] ; then
|
||||||
|
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf.php-fpm"
|
||||||
|
elif [[ -f "/usr/local/apache2/conf/vhosts/${WEBSITE}.conf" ]] ; then
|
||||||
|
VHOST_CONFIG_FILE="/usr/local/apache2/conf/vhosts/${WEBSITE}.conf"
|
||||||
|
elif [[ -f "/etc/apache2/sites-enabled/${WEBSITE}.conf" ]] ; then
|
||||||
|
VHOST_CONFIG_FILE="/etc/apache2/sites-enabled/${WEBSITE}.conf"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
PHP_VERSION="$(grep -o -E "php-?.{1}\..{1}-fpm" $VHOST_CONFIG_FILE | grep -o -E ".{1}\..{1}")"
|
||||||
|
if [[ -z "$PHP_VERSION" ]] ; then
|
||||||
|
fatal "PHP Version must be givven if running PHP-FPM engine (parameter 'PHP_VERSION')"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
# - Determin PHP binary
|
# - Determin PHP binary
|
||||||
# -
|
# -
|
||||||
@ -582,7 +598,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
mkdir ${WEB_BASE_DIR}/nextcloud-${VERSION} > $log_file 2>&1
|
mkdir ${WEB_BASE_DIR}/nextcloud-${VERSION} > $log_file 2>&1
|
||||||
|
|
||||||
@ -773,7 +789,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -792,7 +808,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -822,7 +838,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -841,7 +857,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -871,7 +887,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -890,7 +906,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -921,7 +937,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -940,7 +956,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -970,7 +986,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -989,7 +1005,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -1012,7 +1028,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1043,7 +1059,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1063,7 +1079,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
@ -1090,7 +1106,7 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1110,14 +1126,10 @@ else
|
|||||||
echononl "Wrong entry! - repeat [yes/no]: "
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted ny user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# -----
|
# -----
|
||||||
# - Doing some post-update tasks
|
# - Doing some post-update tasks
|
||||||
# -----
|
# -----
|
||||||
@ -1135,7 +1147,16 @@ if [[ "$PHP_ENGINE" = "FPM" ]]; then
|
|||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
echo_failed
|
echo_failed
|
||||||
fatal "$(cat $log_file)"
|
error "$(cat $log_file)"
|
||||||
|
|
||||||
|
echononl "continue anyway [yes/no]: "
|
||||||
|
read OK
|
||||||
|
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||||
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
/etc/init.d/php-${PHP_VERSION}-fpm restart > $log_file 2>&1
|
/etc/init.d/php-${PHP_VERSION}-fpm restart > $log_file 2>&1
|
||||||
@ -1143,7 +1164,16 @@ if [[ "$PHP_ENGINE" = "FPM" ]]; then
|
|||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
echo_failed
|
echo_failed
|
||||||
fatal "$(cat $log_file)"
|
error "$(cat $log_file)"
|
||||||
|
|
||||||
|
echononl "continue anyway [yes/no]: "
|
||||||
|
read OK
|
||||||
|
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||||
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
@ -1161,7 +1191,17 @@ if $IS_HTTPD_RUNNING ; then
|
|||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
echo_failed
|
echo_failed
|
||||||
fatal "$(cat $log_file)"
|
error "$(cat $log_file)"
|
||||||
|
|
||||||
|
echononl "continue anyway [yes/no]: "
|
||||||
|
read OK
|
||||||
|
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||||
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
|
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
/etc/init.d/apache2 start > $log_file 2>&1
|
/etc/init.d/apache2 start > $log_file 2>&1
|
||||||
@ -1169,7 +1209,16 @@ if $IS_HTTPD_RUNNING ; then
|
|||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
echo_failed
|
echo_failed
|
||||||
fatal "$(cat $log_file)"
|
error "$(cat $log_file)"
|
||||||
|
|
||||||
|
echononl "continue anyway [yes/no]: "
|
||||||
|
read OK
|
||||||
|
OK="$(echo "$OK" | tr '[:upper:]' '[:lower:]')"
|
||||||
|
while [[ "$OK" != "yes" ]] && [[ "$OK" != "no" ]] ; do
|
||||||
|
echononl "Wrong entry! - repeat [yes/no]: "
|
||||||
|
read OK
|
||||||
|
done
|
||||||
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user