update_nextcloud.sh: add support for nginx webserver.
This commit is contained in:
parent
84c890dfcd
commit
146bcee838
@ -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,15 +1065,17 @@ fi
|
|||||||
blank_line
|
blank_line
|
||||||
|
|
||||||
|
|
||||||
# - Install and enable nextcloud app 'richdocuments'
|
|
||||||
# -
|
|
||||||
_app="richdocuments"
|
|
||||||
|
|
||||||
echononl "Install nextcloud app '$_app'.."
|
if $INSTALL_COLABORA_ONLINE_APP ; then
|
||||||
sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1
|
# - Install and enable nextcloud app 'richdocuments'
|
||||||
if [[ $? -eq 0 ]]; then
|
# -
|
||||||
|
_app="richdocuments"
|
||||||
|
|
||||||
|
echononl "Install nextcloud app '$_app'.."
|
||||||
|
sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" > $log_file 2>&1
|
||||||
|
if [[ $? -eq 0 ]]; then
|
||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
if grep -q -E "${_app}\s+already\s+installed" $log_file ; then
|
if grep -q -E "${_app}\s+already\s+installed" $log_file ; then
|
||||||
echo_skipped
|
echo_skipped
|
||||||
warn "$(cat $log_file)"
|
warn "$(cat $log_file)"
|
||||||
@ -1019,13 +1092,13 @@ else
|
|||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
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_binary" "${INSTALL_DIR}/occ" app:enable "$_app" > $log_file 2>&1
|
||||||
if [[ $? -eq 0 ]]; then
|
if [[ $? -eq 0 ]]; then
|
||||||
echo_ok
|
echo_ok
|
||||||
else
|
else
|
||||||
echo_failed
|
echo_failed
|
||||||
error "$(cat $log_file)"
|
error "$(cat $log_file)"
|
||||||
|
|
||||||
@ -1037,14 +1110,14 @@ else
|
|||||||
read OK
|
read OK
|
||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echononl "Configure nextcloud app '$_app'.."
|
echononl "Configure nextcloud app '$_app'.."
|
||||||
if [[ -z "$WOPI_URL" ]] ; then
|
if [[ -z "$WOPI_URL" ]] ; then
|
||||||
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_binary" "${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
|
||||||
@ -1061,6 +1134,7 @@ else
|
|||||||
done
|
done
|
||||||
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
[[ $OK = "yes" ]] || fatal "Interrupted by user."
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user