add snippet 'get-cloud-instance-to-update'..

This commit is contained in:
Christoph 2023-08-02 14:23:46 +02:00
parent f244232347
commit 08a9bc984d
17 changed files with 103 additions and 685 deletions

View File

@ -217,34 +217,9 @@ echo -e "\033[32m-----\033[m"
echo "Add missing columns"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
DEFAULT_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS

View File

@ -217,34 +217,9 @@ echo -e "\033[32m-----\033[m"
echo "Create missing indices"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
DEFAULT_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS

View File

@ -217,34 +217,9 @@ echo -e "\033[32m-----\033[m"
echo "Create missing indices"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
DEFAULT_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS

View File

@ -255,34 +255,9 @@ echo -e "\033[32m-----\033[m"
echo -e "Add User to Group - \033[1mBoth, User and Group has to exist\033[m"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Cloud instance that you want to change?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
DEFAULT_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS

View File

@ -226,33 +226,9 @@ echo "Create missing indices"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
DEFAULT_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS
@ -420,81 +396,7 @@ fi
# Check PHP Version
#
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; 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
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
if $NGINX_IS_ENABLED ; then
upstream_handler="$(grep -o -E "^[^#]*fastcgi_pass\s+[^;]+" ${VHOST_CONFIG_FILE} | awk '{print$2}' )"
for _file in $(ls /etc/nginx/conf.d/) ; do
_rp_file="$(realpath "/etc/nginx/conf.d/${_file}")"
if $(grep -q -E "\s+${upstream_handler}\s*" ${_rp_file} 2> /dev/null) ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" ${_rp_file} \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
break
fi
done
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "Cannot determin the PHP version\! Enter it manually"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.2 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
fi
source ${snippet_dir}/get-php-major-version
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php"

View File

@ -226,32 +226,9 @@ echo -e "Add User to Group - \033[1mBoth, User and Group has to exist\033[m"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Cloud instance that you want to change?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS
@ -420,81 +397,7 @@ fi
# Check PHP Version
#
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; 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
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
if $NGINX_IS_ENABLED ; then
upstream_handler="$(grep -o -E "^[^#]*fastcgi_pass\s+[^;]+" ${VHOST_CONFIG_FILE} | awk '{print$2}' )"
for _file in $(ls /etc/nginx/conf.d/) ; do
_rp_file="$(realpath "/etc/nginx/conf.d/${_file}")"
if $(grep -q -E "\s+${upstream_handler}\s*" ${_rp_file} 2> /dev/null) ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" ${_rp_file} \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
break
fi
done
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "Cannot determin the PHP version\! Enter it manually"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.2 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
fi
source ${snippet_dir}/get-php-major-version
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php"

View File

@ -226,33 +226,9 @@ echo "Create missing indices"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
DEFAULT_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS
@ -420,81 +396,7 @@ fi
# Check PHP Version
#
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE="$(realpath "/etc/nginx/sites-enabled/${WEBSITE}.conf")"
fi
elif $APACHE2_IS_ENABLED ; 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
fi
if [[ -n "$VHOST_CONFIG_FILE" ]] ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" $VHOST_CONFIG_FILE \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
fi
if [[ -z "$PHP_VERSION" ]] ; then
if $NGINX_IS_ENABLED ; then
upstream_handler="$(grep -o -E "^[^#]*fastcgi_pass\s+[^;]+" ${VHOST_CONFIG_FILE} | awk '{print$2}' )"
for _file in $(ls /etc/nginx/conf.d/) ; do
_rp_file="$(realpath "/etc/nginx/conf.d/${_file}")"
if $(grep -q -E "\s+${upstream_handler}\s*" ${_rp_file} 2> /dev/null) ; then
PHP_VERSION="$(grep -o -E "^[^#]*php-?[[:digit:]]{1,2}\.[[:digit:]]{1}-fpm" ${_rp_file} \
| grep -o -E "[[:digit:]]{1,2}\.[[:digit:]]{1}")"
break
fi
done
fi
if [[ -z "$PHP_VERSION" ]] ; then
warn "Cannot determin the PHP version\! Enter it manually"
main_version_regex="^[[:digit:]]{1,2}\.[[:digit:]]{1}$"
echo ""
echo -e "\033[32m--\033[m"
echo ""
echo "Enter the PHP main version, e.g. 7.4 or 8.2 .."
echo ""
echo ""
PHP_VERSION=
while [ "X$PHP_VERSION" = "X" ]
do
echononl " PHP main version: "
read PHP_VERSION
if [ "X$PHP_VERSION" = "X" ]; then
echo ""
echo -e "\033[33m\033[1mInput is required !!\033[m"
echo ""
fi
if [[ ! $PHP_VERSION =~ $main_version_regex ]] ; then
echo ""
echo -e "\033[33m\033[1mWrong entry (${PHP_VERSION}) for main PHP version !!\033[m"
echo ""
PHP_VERSION=
fi
done
fi
fi
fi
fi
source ${snippet_dir}/get-php-major-version
if [[ -x "/usr/local/php-${PHP_VERSION}/bin/php" ]] ; then
PHP_BIN="/usr/local/php-${PHP_VERSION}/bin/php"

View File

@ -197,7 +197,23 @@ while getopts hs: opt ; do
done
if [[ -z "$WEBSITE" ]] ; then
fatal "No website ios given on commandline - Missing Parameter '-s <website>'"
while IFS='' read -r -d '' _conf_file ; do
source $_conf_file
if [[ -n "$WEBSITE" ]] ; then
unsorted_website_arr+=("${WEBSITE}:$_conf_file")
fi
WEBSITE=""
done < <(find "${conf_dir}" -maxdepth 1 -type f -name "*.conf" -print0)
# - Sort array
# -
IFS=$'\n' website_arr=($(sort <<<"${unsorted_website_arr[*]}"))
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
fi
WEB_BASE_DIR="/var/www/${WEBSITE}"

View File

@ -217,38 +217,10 @@ if [[ -z "$WEBSITE" ]] ; then
# -
IFS=$'\n' website_arr=($(sort <<<"${unsorted_website_arr[*]}"))
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
WEBSITE="$_WEBSITE"
#fatal "No website ios given on commandline - Missing Parameter '-s <website>'"
fi

View File

@ -216,35 +216,9 @@ if [[ -z "$WEBSITE" ]] ; then
# -
IFS=$'\n' website_arr=($(sort <<<"${unsorted_website_arr[*]}"))
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
WEBSITE="$_WEBSITE"
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
#fatal "No website ios given on commandline - Missing Parameter '-s <website>'"
fi

View File

@ -216,35 +216,9 @@ if [[ -z "$WEBSITE" ]] ; then
# -
IFS=$'\n' website_arr=($(sort <<<"${unsorted_website_arr[*]}"))
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
WEBSITE="$_WEBSITE"
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
#fatal "No website ios given on commandline - Missing Parameter '-s <website>'"
fi

View File

@ -256,33 +256,9 @@ echo -e "Remove User from Group - \033[1mBoth, User and Group has to exist\033[m
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Cloud instance that you want to change?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
DEFAULT_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS

View File

@ -214,37 +214,13 @@ clear
echo ""
echo -e "\033[32m-----\033[m"
echo "Create missing indices"
echo "Replace favicon icon"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
DEFAULT_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS
@ -278,10 +254,6 @@ DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE="FPM"
if [[ -z ${WEBSITE} ]] ; then
WEBSITE="$DEFAULT_WEBSITE"
fi
DEFAULT_WEB_BASE_DIR="/var/www/$WEBSITE"
[[ -n "$WEB_BASE_DIR" ]] || WEB_BASE_DIR=$DEFAULT_WEB_BASE_DIR

View File

@ -218,33 +218,9 @@ echo "Create missing indices"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to update?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
DEFAULT_WEBSITE="${_arr[0]}"
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS
@ -278,10 +254,6 @@ DEFAULT_HTTP_GROUP="www-data"
DEFAULT_PHP_ENGINE="FPM"
if [[ -z ${WEBSITE} ]] ; then
WEBSITE="$DEFAULT_WEBSITE"
fi
DEFAULT_WEB_BASE_DIR="/var/www/$WEBSITE"
[[ -n "$WEB_BASE_DIR" ]] || WEB_BASE_DIR=$DEFAULT_WEB_BASE_DIR

View File

@ -223,32 +223,9 @@ echo "Update Nextcloud"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
echo ""
echo "Which site would you like to restore?"
echo ""
declare -i i=0
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS
@ -405,33 +382,7 @@ fi
# Check PHP Version
#
if [[ "$PHP_ENGINE" = "FPM" ]] ; then
if [[ -z "$PHP_VERSION" ]] ; then
if [[ -z "$VHOST_CONFIG_FILE" ]] ; then
if $NGINX_IS_ENABLED ; then
if [[ -f "/etc/nginx/sites-enabled/${WEBSITE}.conf" ]] ; then
VHOST_CONFIG_FILE=""
fi
elif $APACHE2_IS_ENABLED ; 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
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
source ${snippet_dir}/get-php-major-version

View File

@ -0,0 +1,36 @@
WEBSITE=
_OK=false
declare -i i=0
if [[ ${#website_arr[@]} -eq 1 ]] ; then
IFS=':' read -a _arr <<< ${website_arr[0]}
conf_file=${_arr[1]}
WEBSITE=${_arr[0]}
echo ""
echo -e "Update site \033[1m ${_arr[0]}"
echo ""
else
echo ""
echo "Which site would you like to update?"
echo ""
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
WEBSITE=${_arr[0]}
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
fi

View File

@ -247,41 +247,9 @@ echo "Update Nextcloud"
echo -e "\033[32m-----\033[m"
WEBSITE=
_OK=false
_HEAD=false
declare -i i=0
if [[ ${#website_arr[@]} -eq 1 ]] ; then
IFS=':' read -a _arr <<< ${website_arr[0]}
conf_file=${_arr[1]}
echo ""
echo -e "Update site \033[1m ${_arr[0]}"
echo ""
else
echo ""
echo "Which site would you like to update?"
echo ""
for _site in ${website_arr[@]} ; do
IFS=':' read -a _arr <<< ${_site}
echo " [$i] ${_arr[0]}"
((i++))
done
echo
echononl " Eingabe: "
while ! $_OK ; do
read _IN
if is_number "$_IN" && [[ -n ${website_arr[$_IN]} ]]; then
IFS=':' read -a _arr <<< ${website_arr[$_IN]}
conf_file=${_arr[1]}
_OK=true
else
echo ""
echo -e "\tFalsche Eingabe !"
echo ""
echononl " Eingabe: "
fi
done
fi
# Which cloud instance (website) would you like to update
#
source ${snippet_dir}/get-cloud-instance-to-update
# - Reset IFS