diff --git a/install_nextcloud.sh b/install_nextcloud.sh index 32b8dd3..4fbf7ae 100755 --- a/install_nextcloud.sh +++ b/install_nextcloud.sh @@ -84,6 +84,11 @@ echo_ok() { echo " [ ok ]" fi } +echo_wait(){ + if $terminal ; then + echo -en "\033[80G[ \033[33m\033[1m\033[5m..\033[m ]" + fi +} echo_warning() { if $terminal ; then echo -e "\033[80G[ \033[33m\033[1mwarn\033[m ]" @@ -312,7 +317,7 @@ fi echo "" -echo " Insert the name of the website containing the nextcloud instance .." +echo " Insert the FQHN hostname of the website containing the nextcloud instance .." echo "" if [[ -n "$WEBSITE" ]] ;then DEFAULT_WEBSITE="$WEBSITE" @@ -335,8 +340,13 @@ else read WEBSITE done fi +IFS=. read -ra parts <<< "${WEBSITE}" +DOMAIN_PART="${parts[-2]}.${parts[-1]}" +HOSTNAME_PART="${WEBSITE%.$DOMAIN_PART}" + DEFAULT_WEB_BASE_DIR="${WEB_DIRS_ROOT}/$WEBSITE" + if [[ ! -d "${WEB_DIRS_ROOT}/$WEBSITE" ]] ; then echo "" echo -e " \033[32m--\033[m" @@ -1073,6 +1083,7 @@ echo " Webserver group......................: $HTTP_GROUP" echo "" echo " PHP version..........................: $PHP_VERSION" echo " PHP Engine...........................: $PHP_ENGINE" +echo " PHP Binary...........................: ${php_binary}" echo "" echo " Databse name.........................: $DATABASE_NAME" echo " Database type........................: $DATABASE_TYPE" @@ -1087,9 +1098,10 @@ if $INSTALL_COLABORA_SERVICE ; then echo " IPv6 ColaboraOnline Service.......: $IPV6_CO" echo " Group of os installed certs.......: $SSL_CERT_GROUP" elif $COLABORA_SERVICE_INSTALLED ; then - echo "" echo " Hostname ColaboraOnline Service......: $HOSTNAME_CO" + echo " Wopi URL..........................: ${WOPI_URL}" fi +echo echo "" echo "" @@ -1164,6 +1176,7 @@ echo "# - Webserver group......................: $HTTP_GROUP" >> $log_file echo "# -" >> $log_file echo "# - PHP version..........................: $PHP_VERSION" >> $log_file echo "# - PHP Engine...........................: $PHP_ENGINE" >> $log_file +echo "# - PHP Binary...........................: ${php_binary}" >> $log_file echo "# -" >> $log_file echo "# - Databse name.........................: $DATABASE_NAME" >> $log_file echo "# - Database type........................: $DATABASE_TYPE" >> $log_file @@ -1179,14 +1192,18 @@ if $INSTALL_COLABORA_SERVICE ; then echo "# - Group of os installed certs.......: $SSL_CERT_GROUP" >> $log_file elif $COLABORA_SERVICE_INSTALLED ; then echo "# - Hostname ColaboraOnline Service...: $HOSTNAME_CO" >> $log_file + echo "# - Wopi URL.......................: $WOPI_URL" >> $log_file fi echo "" >> $log_file echo "" >> $log_file +echo "SRC_BASE_DIR=$SRC_BASE_DIR" +echo "" >> $log_file echo "VERSION=$VERSION" >> $log_file echo "INSTALL_DIR=$INSTALL_DIR" >> $log_file echo "DATA_DIR=$DATA_DIR" >> $log_file +echo "ENABLE_ENCRYPTION=$ENABLE_ENCRYPTION" >> $log_file echo "ADMIN_USER=$ADMIN_USER" >> $log_file echo "ADMIN_PASS=$ADMIN_PASS" >> $log_file echo "WEBSITE=$WEBSITE" >> $log_file @@ -1211,9 +1228,12 @@ echo "INSTALL_REDIS_SERVICE=$INSTALL_REDIS_SERVICE" >> $log_file echo "INSTALL_COLABORA_SERVICE=$INSTALL_COLABORA_SERVICE" >> $log_file echo "" >> $log_file echo "HOSTNAME_CO=$HOSTNAME_CO" >> $log_file +echo "WOPI_URL=$WOPI_URL" >> $log_file echo "IPV4_CO=$IPV4_CO" >> $log_file echo "IPV6_CO=$IPV6_CO" >> $log_file echo "SSL_CERT_GROUP=$SSL_CERT_GROUP" >> $log_file +echo "" >> $log_file +echo "php_binary=$php_binary" >> $log_file echo "" >> $log_file echo "" >> $log_file @@ -3336,13 +3356,13 @@ else echo_skipped fi +echononl "Backup directory '${WEB_BASE_DIR}/nextcloud'.." if [[ -f "${WEB_BASE_DIR}/nextcloud" ]] || [[ -d "${WEB_BASE_DIR}/nextcloud" ]] ; then - warn "File or Directory '${WEB_BASE_DIR}/nextcloud' exists." + #warn "File or Directory '${WEB_BASE_DIR}/nextcloud' exists." echo "" >> $log_file echo "# - Backup directory '${WEB_BASE_DIR}/nextcloud'" >> $log_file echo "# -" >> $log_file - echononl "Backup directory '${WEB_BASE_DIR}/nextcloud'.." echo "mv \"${WEB_BASE_DIR}/nextcloud\" \"${WEB_BASE_DIR}/nextcloud.$backup_date\"" >> $log_file mv "${WEB_BASE_DIR}/nextcloud" "${WEB_BASE_DIR}/nextcloud.$backup_date" >> $log_file 2>&1 @@ -3425,13 +3445,13 @@ else echo_skipped fi +echononl "Backup directory '${WEB_BASE_DIR}/htdocs'.." if [[ -f "${WEB_BASE_DIR}/htdocs" ]] || [[ -d "${WEB_BASE_DIR}/htdocs" ]] ; then - warn "File or Directory '${WEB_BASE_DIR}/htdocs' exists." + #warn "File or Directory '${WEB_BASE_DIR}/htdocs' exists." echo "" >> $log_file echo "# - Backup directory '${WEB_BASE_DIR}/htdocs'" >> $log_file echo "# -" >> $log_file - echononl "Backup directory '${WEB_BASE_DIR}/htdocs'.." echo "mv \"${WEB_BASE_DIR}/htdocs\" \"${WEB_BASE_DIR}/htdocs.$backup_date\"" >> $log_file mv "${WEB_BASE_DIR}/htdocs" "${WEB_BASE_DIR}/htdocs.$backup_date" >> $log_file 2>&1 @@ -3582,66 +3602,6 @@ fi blank_line -echononl "Eabable the (default) encryption module.." -if ${ENABLE_ENCRYPTION} ; then - # - Activate and Enable (default) encryption module - # - - echo "" >> $log_file - echo "# - Eabable the (default) encryption module" >> $log_file - echo "# -" >> $log_file - - echo "sudo -u \"$HTTP_USER\" \"$php_binary\" \"${INSTALL_DIR}/occ\" app:enable encryption" >> $log_file - sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:enable encryption >> $log_file 2>&1 - - if [[ $? -eq 0 ]]; then - echo_ok - else - echo_failed - error "For more informations see log output at '$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 ny user." - fi -else - echo_skipped -fi - - -echononl "Enable encryption.." -if ${ENABLE_ENCRYPTION} ; then - echo "" >> $log_file - echo "# - Enable encryption" >> $log_file - echo "# -" >> $log_file - - echo "sudo -u \"$HTTP_USER\" \"$php_binary\" \"${INSTALL_DIR}/occ\" encryption:enable" >> $log_file - sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" encryption:enable >> $log_file 2>&1 - - if [[ $? -eq 0 ]]; then - echo_ok - else - echo_failed - error "For more informations see log output at '$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 ny user." - fi -else - echo_skipped -fi - - # - Adjust 'trusted_domains' # - _parameter="trusted_domains" @@ -3676,6 +3636,71 @@ else fi + +# - Adjust 'trusted_proxies' +# - +_parameter="trusted_proxies" +_value="${IPV4}" +_type="string" +echo "" >> $log_file +echo "# - Add '${_value}' to ${_parameter}" >> $log_file +echo "# -" >> $log_file +echononl "Add '${_value}' to ${_parameter}.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set ${_parameter} 0 \\ + --value="${_value} --type="${_type}"" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set ${_parameter} 0 \ + --value="${_value}" --type="${_type}" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + +_value="${IPV6}" +echo "" >> $log_file +echo "# - Add '${_value}' to ${_parameter}" >> $log_file +echo "# -" >> $log_file +echononl "Add '${_value}' to ${_parameter}.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set ${_parameter} 1 \\ + --value="${_value} --type="${_type}"" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set ${_parameter} 1 \ + --value="${_value}" --type="${_type}" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + + + # - Adjust 'overwrite.cli.url' # - _parameter="overwrite.cli.url" @@ -4308,6 +4333,174 @@ else [[ $OK = "yes" ]] || fatal "Interrupted ny user." fi +# - Adjust 'maintenance_window_start' +# - +_parameter="maintenance_window_start" +_value=2 +_type="integer" +echo "" >> $log_file +echo "# - Adjust configuration parameter '$_parameter'" >> $log_file +echo "# -" >> $log_file +echononl "Adjust configuration parameter '$_parameter'.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \\ + --value="${_value}" --type="${_type}" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \ + --value="${_value}" --type="${_type}" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + +blank_line + +# - Adjust 'mail_smtpmode' +# - +_parameter="mail_smtpmode" +_value="sendmail" +_type="string" +echo "" >> $log_file +echo "# - Adjust configuration parameter '$_parameter'" >> $log_file +echo "# -" >> $log_file +echononl "Adjust configuration parameter '$_parameter'.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \\ + --value="${_value}" --type="${_type}" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \ + --value="${_value}" --type="${_type}" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + +# - Adjust 'mail_sendmailmode' +# - +_parameter="mail_sendmailmode" +_value="smtp" +_type="string" +echo "" >> $log_file +echo "# - Adjust configuration parameter '$_parameter'" >> $log_file +echo "# -" >> $log_file +echononl "Adjust configuration parameter '$_parameter'.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \\ + --value="${_value}" --type="${_type}" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \ + --value="${_value}" --type="${_type}" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + +# - Adjust 'mail_from_address' +# - +_parameter="mail_from_address" +_value="${HOSTNAME_PART}" +_type="string" +echo "" >> $log_file +echo "# - Adjust configuration parameter '$_parameter'" >> $log_file +echo "# -" >> $log_file +echononl "Adjust configuration parameter '$_parameter'.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \\ + --value="${_value}" --type="${_type}" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \ + --value="${_value}" --type="${_type}" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + +# - Adjust 'mail_domain' +# - +_parameter="mail_domain" +_value="${DOMAIN_PART}" +_type="string" +echo "" >> $log_file +echo "# - Adjust configuration parameter '$_parameter'" >> $log_file +echo "# -" >> $log_file +echononl "Adjust configuration parameter '$_parameter'.." + +cat <> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \\ + --value="${_value}" --type="${_type}" +EOF +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" config:system:set "$_parameter" \ + --value="${_value}" --type="${_type}" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + + blank_line @@ -4683,6 +4876,12 @@ if $apache2_installed ; then Options FollowSymLinks MultiViews + # Proxy for 'notifi_push' Service + # + ProxyPass /push/ws ws://127.0.0.1:7867/ws + ProxyPass /push/ http://127.0.0.1:7867/ + ProxyPassReverse /push/ http://127.0.0.1:7867/ + # - X-Frame-Options # - # - See: https://scotthelme.co.uk/hardening-your-http-response-headers/#x-frame-options @@ -5044,9 +5243,9 @@ elif $nginx_installed ; then # --- -upstream php-handler { - server unix:/run/php//php-${PHP_VERSION}-fpm.www.sock; -} +#upstream php-handler { +# server unix:/run/php//php-${PHP_VERSION}-fpm.www.sock; +#} server { listen 80; @@ -5136,7 +5335,7 @@ server { add_header X-Download-Options "noopen" always; add_header X-Frame-Options "SAMEORIGIN" always; add_header X-Permitted-Cross-Domain-Policies "none" always; - add_header X-Robots-Tag "noindex, nofollowi" always; + add_header X-Robots-Tag "noindex, nofollow" always; add_header X-XSS-Protection "1; mode=block" always; add_header X-Download-Options "noopen" always; @@ -5211,7 +5410,8 @@ server { fastcgi_param modHeadersAvailable true; # Avoid sending the security headers twice fastcgi_param front_controller_active true; # Enable pretty urls - fastcgi_pass php-handler; + #fastcgi_pass php-handler; + fastcgi_pass unix:/run/php//php-${PHP_VERSION}-fpm.www.sock; fastcgi_intercept_errors on; fastcgi_request_buffering off; @@ -5229,6 +5429,15 @@ server { access_log off; # Optional: Don't log access to assets } + location ^~ /push/ { + proxy_pass http://127.0.0.1:7867/; + proxy_http_version 1.1; + proxy_set_header Upgrade \$http_upgrade; + proxy_set_header Connection "Upgrade"; + proxy_set_header Host \$host; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + } + # Service Discovery # # !! we already configured this service inside 'location ~ \.php(?:\$|/) {' !! @@ -5330,6 +5539,213 @@ echo "# - Install/Enable some more nextcloud apps" >> $log_file echo "# -----" >> $log_file +echononl "Enable the (default) encryption module.." +if ${ENABLE_ENCRYPTION} ; then + # - Activate and Enable (default) encryption module + # - + echo "" >> $log_file + echo "# - Enable the (default) encryption module" >> $log_file + echo "# -" >> $log_file + + echo "sudo -u \"$HTTP_USER\" \"$php_binary\" \"${INSTALL_DIR}/occ\" app:enable encryption" >> $log_file + sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:enable encryption >> $log_file 2>&1 + + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "For more informations see log output at '$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 ny user." + fi +else + echo_skipped +fi + +echononl "Enable encryption.." +if ${ENABLE_ENCRYPTION} ; then + echo "" >> $log_file + echo "# - Enable encryption" >> $log_file + echo "# -" >> $log_file + + echo "sudo -u \"$HTTP_USER\" \"$php_binary\" \"${INSTALL_DIR}/occ\" encryption:enable" >> $log_file + sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" encryption:enable >> $log_file 2>&1 + + if [[ $? -eq 0 ]]; then + echo_ok + else + echo_failed + error "For more informations see log output at '$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 ny user." + fi +else + echo_skipped +fi + +blank_line + +# - Install and enable 'Client Push' app named 'notify_push' +# - +_app="notify_push" +echo "" >> $log_file +echo "# -" >> $log_file +echo "# - Install nextcloud app '$_app'" >> $log_file +echononl "Install nextcloud app '$_app'.." + +echo "sudo -u \"$HTTP_USER\" \"$php_binary\" \"${INSTALL_DIR}/occ\" app:install \"$_app\"" >> $log_file +sudo -u "$HTTP_USER" "$php_binary" "${INSTALL_DIR}/occ" app:install "$_app" >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + + +# Create systend service file 'notify_push' +# +echo "" >> $log_file +echo "# -" >> $log_file +echo "# - Create systend service file for 'notify_push' service" >> $log_file + +echononl "Create systend service file for 'notify_push' service" + +echo "cat < /etc/systemd/system/notify_push.service +[Unit] +Description = Push daemon for Nextcloud clients +Documentation=https://github.com/nextcloud/notify_push + +[Service] +# Change if you already have something running on this port +Environment=PORT=7867 +# Run 'curl http://localhost:7868/metrics' to eee some metrivcs +Environment=METRICS_PORT=7868 +Environment=NEXTCLOUD_URL=https://\${WEBSITE} +ExecStart=\${INSTALL_DIR}/apps/notify_push/bin/x86_64/notify_push \${INSTALL_DIR}/config/config.php +# requires the push server to have been build with the systemd feature (enabled by default) +Type=notify +User=\${HTTP_USER} +Restart=always +RestartSec=60 + +[Install] +WantedBy = multi-user.target +EOF" >> $log_file + +cat < /etc/systemd/system/notify_push.service 2>> $log_file +[Unit] +Description = Push daemon for Nextcloud clients +Documentation=https://github.com/nextcloud/notify_push + +[Service] +# Change if you already have something running on this port +Environment=PORT=7867 METRICS_PORT=7868 +Environment=NEXTCLOUD_URL=https://${WEBSITE} +ExecStart=${INSTALL_DIR}/apps/notify_push/bin/x86_64/notify_push ${INSTALL_DIR}/config/config.php +# requires the push server to have been build with the systemd feature (enabled by default) +Type=notify +User=${HTTP_USER} +Restart=always +RestartSec=60 + +[Install] +WantedBy = multi-user.target +EOF +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + + +echo "" >> $log_file +echo "# -" >> $log_file +echo "# - Reload systemd daemon'.." >> $log_file + +echononl "Reload systemd daemon'.." +systemctl daemon-reload >> $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + + +echo "" >> $log_file +echo "# -" >> $log_file +echo "# - Enable and start the new service 'notify_push'.." >> $log_file + +echononl "Enable and start the new service 'notify_push'.." + +echo "systemctl enable --now notify_push" >> $log_file +systemctl enable --now notify_push >> $log_file 2>&1 + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$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 ny user." +fi + + + +blank_line + + # - Install and enable nextcloud app 'calendar' # - _app="calendar" @@ -5856,6 +6272,32 @@ echo "# - Doing some post-installation tasks" >> $log_file echo "# -----" >> $log_file +echo "" >> $log_file +echo "# - Migrating the mimetypes" >> $log_file +echo "# -" >> $log_file +echononl "Migrating the mimetypes .." + +echo -e "sudo -u ${HTTP_USER} ${php_binary} ${INSTALL_DIR}/occ maintenance:repair --include-expensive" >> $log_file +sudo -u ${HTTP_USER} ${php_binary} ${INSTALL_DIR}/occ maintenance:repair --include-expensive >> $log_file 2>&1 +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output: \"$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 ny user." +fi + +blank_line + + echo "" >> $log_file echo "# - Restart PHP engine" >> $log_file echo "# -" >> $log_file @@ -6082,6 +6524,71 @@ else warn "No 'redis' services found at '$(hostname -f)'!" fi +blank_line + +echo "" >> $log_file +echo "# -" >> $log_file +echo "# - Runnning cron but kill ther after 2 seconds" >> $log_file +echo "sudo -u ${HTTP_USER} ${php_binary} ${INSTALL_DIR}/cron.php &" >> $log_file +echo "JOB_PID=\$!" >> $log_file +echo "sleep 2" >> $log_file +echo "kill $JOB_PID 2>/dev/null" >> $log_file + + +echononl "Start cron job, but cancel it again after 2 seconds" +sudo -u ${HTTP_USER} ${php_binary} ${INSTALL_DIR}/cron.php >> $log_file 2>&1 & +JOB_PID=$! +sleep 2 +kill $JOB_PID 2>/dev/null +echo_done + + +echo "" >> $log_file +echo "# -" >> $log_file +echo "# - Runnning cron job again.." >> $log_file +echo -e "sudo -u ${HTTP_USER} ${php_binary} ${INSTALL_DIR}cron.php" >> $log_file +echononl "Runnning cron job again.." + +sudo -u ${HTTP_USER} ${php_binary} ${INSTALL_DIR}/cron.php >> $log_file 2>&1 & + + +if [[ $? -eq 0 ]]; then + echo_ok +else + echo_failed + error "For more informations see log output at '$log_file'." +fi + +blank_line + +echo "" >> $log_file +echo "# -" >> $log_file +echo "# - Final Setup of NC Configuration for use of 'notify_push' app.." >> $log_file + +echononl "Final Setup of NC Configuration for use of 'notify_push' app.." +echo_wait +blank_line + +echo -e "sudo -u ${HTTP_USER} ${php_binary} ${INSTALL_DIR}/occ notify_push:setup\n" >> $log_file + +echo "" +echo +echo -e " \033[33m\033[1m**\033[m Press \033[33m\033[1m\033[m to continue.\033[33m\033[1m**\033[m" +echo +sudo -u ${HTTP_USER} ${php_binary} ${INSTALL_DIR}/occ notify_push:setup + +if [[ $? -gt 0 ]]; then + + error "Final Setup of NC Configuration failed! + + + command was: + +\033[33mprintf \"\\\n\" \\ + | sudo -u ${HTTP_USER} ${php_binary} ${INSTALL_DIR}/occ notify_push:setup\033[m +" + +fi blank_line clean_up 0