update_nextcloud.sh: add support for nginx webserver.

This commit is contained in:
Christoph 2021-03-31 04:19:19 +02:00
parent 84c890dfcd
commit 146bcee838

View File

@ -5,7 +5,7 @@ script_dir="$(dirname $(realpath $0))"
conf_dir="${script_dir}/conf" conf_dir="${script_dir}/conf"
declare -a unsorted_website_arr+ declare -a unsorted_website_arr
declare -a website_arr declare -a website_arr
log_file="$(mktemp)" log_file="$(mktemp)"
@ -139,6 +139,35 @@ info (){
echo "" echo ""
} }
detect_os_1 () {
if $(which lsb_release > /dev/null 2>&1) ; then
os_dist="$(lsb_release -i | awk '{print tolower($3)}')"
os_version="$(lsb_release -r | awk '{print tolower($2)}')"
os_codename="$(lsb_release -c | awk '{print tolower($2)}')"
if [[ "$os_dist" = "debian" ]]; then
if $(echo "$os_version" | grep -q '\.') ; then
os_version=$(echo "$os_version" | cut --delimiter='.' -f1)
fi
fi
elif [[ -e "/etc/os-release" ]]; then
. /etc/os-release
os_dist=$ID
os_version=${VERSION_ID}
fi
# remove whitespace from os_dist and os_version
os_dist="${os_dist// /}"
os_version="${os_version// /}"
}
## - Check if a given array (parameter 2) contains a given string (parameter 1) ## - Check if a given array (parameter 2) contains a given string (parameter 1)
## - ## -
containsElement () { containsElement () {
@ -255,6 +284,46 @@ do
done done
# - Detect Detect OS distribution and Version
# -
echo ""
echo -e " \033[32m--\033[m"
echo ""
echononl "Detect OS distribution and Version"
detect_os_1 > /dev/null 2>&1
if [[ $? -gt 0 ]] ; then
echo_failed
else
echo_ok
fi
if [[ "${os_dist,,}" = "debian" ]] ; then
declare -a dpkg_pkg_colabora_online=()
check_package="loolwsd"
if ! $(dpkg -l "$check_package" 2> /devnull | grep -q -E "^ii\s+${check_package}\s+" 2>/dev/null) ; then
echononl "Install ColaboraOnline App (yes/no) [yes]: "
read OK
while [[ "${OK,,}" != "yes" ]] && [[ "${OK,,}" != "no" ]] ; do
echononl "Wrong entry! - repeat (yes/no) [yes]: "
read OK
[[ -z "${OK,,}" ]] && OK="yes"
done
if [[ ${OK,,} = "yes" ]] ; then
INSTALL_COLABORA_ONLINE_APP=true
else
INSTALL_COLABORA_ONLINE_APP=false
fi
else
INSTALL_COLABORA_ONLINE_APP=true
fi
fi
echo "" echo ""
echononl " Include Configuration file.." echononl " Include Configuration file.."
if [[ ! -f $conf_file ]]; then if [[ ! -f $conf_file ]]; then
@ -441,6 +510,8 @@ 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 ""
echo -e " Install ColaboraOnline App...........: $INSTALL_COLABORA_ONLINE_APP"
echo ""
if [[ "$DATABASE_TYPE" = "mysql" ]] ; then if [[ "$DATABASE_TYPE" = "mysql" ]] ; then
echo -e " Mysql Credentials....................: $MYSQL_CREDENTIALS" echo -e " Mysql Credentials....................: $MYSQL_CREDENTIALS"
fi fi
@ -994,6 +1065,8 @@ fi
blank_line blank_line
if $INSTALL_COLABORA_ONLINE_APP ; then
# - Install and enable nextcloud app 'richdocuments' # - Install and enable nextcloud app 'richdocuments'
# - # -
_app="richdocuments" _app="richdocuments"
@ -1062,6 +1135,7 @@ else
[[ $OK = "yes" ]] || fatal "Interrupted by user." [[ $OK = "yes" ]] || fatal "Interrupted by user."
fi fi
fi fi
fi
blank_line blank_line