diff options
author | Daniel Hansson <github@hanssonit.se> | 2020-10-08 20:51:21 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-08 20:51:21 +0300 |
commit | f571448c1a99f4b724b0072f2c6bcdef6ca00cf2 (patch) | |
tree | 23e8bdc4d2d944645c8e0c206a72e74e8e018326 | |
parent | fab0e56bb296231143ab057ec4bca126795de913 (diff) |
standarlize nextcloud_occ (#1544)
-rw-r--r-- | addons/automatic_updates.sh | 2 | ||||
-rw-r--r-- | apps/clamav.sh | 12 | ||||
-rw-r--r-- | apps/collabora_docker.sh | 20 | ||||
-rw-r--r-- | apps/collabora_integrated.sh | 24 | ||||
-rw-r--r-- | apps/fail2ban.sh | 22 | ||||
-rw-r--r-- | apps/fulltextsearch.sh | 28 | ||||
-rw-r--r-- | apps/onlyoffice_docker.sh | 20 | ||||
-rw-r--r-- | apps/onlyoffice_integrated.sh | 24 | ||||
-rw-r--r-- | apps/previewgenerator.sh | 62 | ||||
-rw-r--r-- | apps/smbmount.sh | 28 | ||||
-rw-r--r-- | apps/talk.sh | 18 | ||||
-rw-r--r-- | apps/talk_signaling.sh | 24 | ||||
-rw-r--r-- | disk/prune_zfs_snaphots.sh | 2 | ||||
-rw-r--r-- | lib.sh | 45 | ||||
-rw-r--r-- | menu/nextcloud_configuration.sh | 8 | ||||
-rw-r--r-- | menu/startup_configuration.sh | 2 | ||||
-rw-r--r-- | nextcloud-startup-script.sh | 14 | ||||
-rw-r--r-- | nextcloud_install_production.sh | 36 | ||||
-rw-r--r-- | nextcloud_update.sh | 36 | ||||
-rw-r--r-- | not-supported/smbserver.sh | 32 | ||||
-rw-r--r-- | old/spreedme.sh | 8 | ||||
-rw-r--r-- | static/cookielifetime.sh | 14 |
22 files changed, 245 insertions, 236 deletions
diff --git a/addons/automatic_updates.sh b/addons/automatic_updates.sh index f328c5a7..557ca63d 100644 --- a/addons/automatic_updates.sh +++ b/addons/automatic_updates.sh @@ -34,7 +34,7 @@ In the next step you will be able to choose to proceed or exit." if yesno_box_yes "Do you want to enable automatic updates?" then # TODO: delete the following line after a few releases. It was copied to the install-script. - occ_command config:app:set updatenotification notify_groups --value="[]" + nextcloud_occ config:app:set updatenotification notify_groups --value="[]" touch $VMLOGS/update.log crontab -u root -l | { cat; echo "0 $AUT_UPDATES_TIME * * 6 $SCRIPTS/update.sh minor >> $VMLOGS/update.log"; } | crontab -u root - if yesno_box_yes "Do you want to reboot your server after every update? *recommended*" diff --git a/apps/clamav.sh b/apps/clamav.sh index 828d771b..32110937 100644 --- a/apps/clamav.sh +++ b/apps/clamav.sh @@ -44,7 +44,7 @@ then crontab -u root -l | grep -v 'clamav-fullscan.sh' | crontab -u root - if is_app_installed files_antivirus then - occ_command_no_check app:remove files_antivirus + nextcloud_occ_no_check app:remove files_antivirus fi # Show successful uninstall if applicable removal_popup @@ -98,11 +98,11 @@ check_command systemctl restart clamav-daemon install_and_enable_app files_antivirus # Configure Nextcloud app -occ_command config:app:set files_antivirus av_mode --value="socket" -occ_command config:app:set files_antivirus av_socket --value="/var/run/clamav/clamd.ctl" -occ_command config:app:set files_antivirus av_stream_max_length --value="104857600" -occ_command config:app:set files_antivirus av_max_file_size --value="-1" -occ_command config:app:set files_antivirus av_infected_action --value="only_log" +nextcloud_occ config:app:set files_antivirus av_mode --value="socket" +nextcloud_occ config:app:set files_antivirus av_socket --value="/var/run/clamav/clamd.ctl" +nextcloud_occ config:app:set files_antivirus av_stream_max_length --value="104857600" +nextcloud_occ config:app:set files_antivirus av_max_file_size --value="-1" +nextcloud_occ config:app:set files_antivirus av_infected_action --value="only_log" # Inform the user msg_box "ClamAV was succesfully installed. diff --git a/apps/collabora_docker.sh b/apps/collabora_docker.sh index 4c0bf0b4..e4099740 100644 --- a/apps/collabora_docker.sh +++ b/apps/collabora_docker.sh @@ -63,15 +63,15 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ # Disable RichDocuments (Collabora App) if activated if is_app_installed richdocuments then - occ_command app:remove richdocuments + nextcloud_occ app:remove richdocuments fi # Remove trusted domain count=0 while [ "$count" -lt 10 ] do - if [ "$(occ_command_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] + if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] then - occ_command_no_check config:system:delete trusted_domains "$count" + nextcloud_occ_no_check config:system:delete trusted_domains "$count" break else count=$((count+1)) @@ -124,9 +124,9 @@ then count=0 while [ "$count" -lt 10 ] do - if [ "$(occ_command_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] + if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] then - occ_command_no_check config:system:delete trusted_domains "$count" + nextcloud_occ_no_check config:system:delete trusted_domains "$count" break else count=$((count+1)) @@ -138,20 +138,20 @@ fi if is_app_enabled documentserver_community then any_key "OnlyOffice will get uninstalled. Press any key to continue. Press CTRL+C to abort" - occ_command app:remove documentserver_community + nextcloud_occ app:remove documentserver_community fi # Disable OnlyOffice App if activated if is_app_installed onlyoffice then - occ_command app:remove onlyoffice + nextcloud_occ app:remove onlyoffice fi # Ask for the domain for Collabora SUBDOMAIN=$(input_box_flow "Collabora subdomain e.g: office.yourdomain.com\n\nNOTE: This domain must be different than your Nextcloud domain. They can however be hosted on the same server, but would require seperate DNS entries.") # Nextcloud Main Domain -NCDOMAIN=$(occ_command_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||') +NCDOMAIN=$(nextcloud_occ_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||') # Nextcloud Main Domain dot-escaped NCDOMAIN_ESCAPED=${NCDOMAIN//[.]/\\\\.} @@ -331,9 +331,9 @@ fi # Set config for RichDocuments (Collabora App) if is_app_installed richdocuments then - occ_command config:app:set richdocuments wopi_url --value=https://"$SUBDOMAIN" + nextcloud_occ config:app:set richdocuments wopi_url --value=https://"$SUBDOMAIN" chown -R www-data:www-data "$NC_APPS_PATH" - occ_command config:system:set trusted_domains 3 --value="$SUBDOMAIN" + nextcloud_occ config:system:set trusted_domains 3 --value="$SUBDOMAIN" # Add prune command add_dockerprune # Restart Docker diff --git a/apps/collabora_integrated.sh b/apps/collabora_integrated.sh index d5fc0cf1..573f188d 100644 --- a/apps/collabora_integrated.sh +++ b/apps/collabora_integrated.sh @@ -40,12 +40,12 @@ then # Disable RichDocuments (Collabora App) if activated if is_app_installed richdocuments then - occ_command app:remove richdocuments + nextcloud_occ app:remove richdocuments fi # Disable OnlyOffice (Collabora App) if activated if is_app_installed onlyoffice then - occ_command app:remove onlyoffice + nextcloud_occ app:remove onlyoffice fi # Revoke LE SUBDOMAIN=$(input_box_flow "Please enter the subdomain you are using for Collabora, e.g: office.yourdomain.com") @@ -68,9 +68,9 @@ then count=0 while [ "$count" -lt 10 ] do - if [ "$(occ_command_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] + if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] then - occ_command_no_check config:system:delete trusted_domains "$count" + nextcloud_occ_no_check config:system:delete trusted_domains "$count" break else count=$((count+1)) @@ -90,18 +90,18 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ case "$choice" in "Uninstall Collabora") print_text_in_color "$ICyan" "Uninstalling Collabora..." - occ_command app:remove richdocumentscode + nextcloud_occ app:remove richdocumentscode # Disable Collabora App if activated if is_app_installed richdocuments then - occ_command app:remove richdocuments + nextcloud_occ app:remove richdocuments fi msg_box "Collabora was successfully uninstalled." exit ;; "Reinstall Collabora") print_text_in_color "$ICyan" "Reinstalling Collabora..." - occ_command app:remove richdocumentscode + nextcloud_occ app:remove richdocumentscode ;; "") exit 1 @@ -138,9 +138,9 @@ then count=0 while [ "$count" -lt 10 ] do - if [ "$(occ_command_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] + if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] then - occ_command_no_check config:system:delete trusted_domains "$count" + nextcloud_occ_no_check config:system:delete trusted_domains "$count" break else count=$((count+1)) @@ -150,7 +150,7 @@ else # Remove OnlyOffice app if is_app_installed onlyoffice then - occ_command app:remove onlyoffice + nextcloud_occ app:remove onlyoffice fi fi @@ -158,13 +158,13 @@ fi if is_app_enabled documentserver_community then any_key "OnlyOffice will get uninstalled. Press any key to continue. Press CTRL+C to abort" - occ_command app:remove documentserver_community + nextcloud_occ app:remove documentserver_community fi # Disable OnlyOffice App if activated if is_app_installed onlyoffice then - occ_command app:remove onlyoffice + nextcloud_occ app:remove onlyoffice fi # Install Collabora diff --git a/apps/fail2ban.sh b/apps/fail2ban.sh index 3ec26431..081789ad 100644 --- a/apps/fail2ban.sh +++ b/apps/fail2ban.sh @@ -69,21 +69,21 @@ mkdir -p "$VMLOGS" print_text_in_color "$ICyan" "Finding nextcloud.log..." while : do - if [ "$(occ_command_no_check config:system:get logfile)" = "$VMLOGS/nextcloud.log" ] + if [ "$(nextcloud_occ_no_check config:system:get logfile)" = "$VMLOGS/nextcloud.log" ] then if [ -f "$VMLOGS/nextcloud.log" ] then chown www-data:www-data "$VMLOGS/nextcloud.log" - occ_command config:system:set log_type --value=file - occ_command config:system:set loglevel --value=2 + nextcloud_occ config:system:set log_type --value=file + nextcloud_occ config:system:set loglevel --value=2 break fi - elif [ "$(occ_command_no_check config:system:get logfile)" != "" ] + elif [ "$(nextcloud_occ_no_check config:system:get logfile)" != "" ] then # Set logging - occ_command config:system:set log_type --value=file - occ_command config:system:set logfile --value="$VMLOGS/nextcloud.log" - occ_command config:system:set loglevel --value=2 + nextcloud_occ config:system:set log_type --value=file + nextcloud_occ config:system:set logfile --value="$VMLOGS/nextcloud.log" + nextcloud_occ config:system:set loglevel --value=2 touch "$VMLOGS/nextcloud.log" chown www-data:www-data "$VMLOGS/nextcloud.log" break @@ -95,9 +95,9 @@ do print_text_in_color "$ICyan" "Unexpected or non-existent logging configuration - deleting any discovered nextcloud.log files and creating a new one at $VMLOGS/nextcloud.log..." xargs rm -f <<< "$NCLOG" # Set logging - occ_command config:system:set log_type --value=file - occ_command config:system:set logfile --value="$VMLOGS/nextcloud.log" - occ_command config:system:set loglevel --value=2 + nextcloud_occ config:system:set log_type --value=file + nextcloud_occ config:system:set logfile --value="$VMLOGS/nextcloud.log" + nextcloud_occ config:system:set loglevel --value=2 touch "$VMLOGS/nextcloud.log" chown www-data:www-data "$VMLOGS/nextcloud.log" break @@ -118,7 +118,7 @@ check_command apt install fail2ban -y check_command update-rc.d fail2ban disable # Set timezone -occ_command config:system:set logtimezone --value="$(cat /etc/timezone)" +nextcloud_occ config:system:set logtimezone --value="$(cat /etc/timezone)" # Create nextcloud.conf file # Test: failregex = Login failed.*Remote IP.*<HOST> diff --git a/apps/fulltextsearch.sh b/apps/fulltextsearch.sh index 7d63d440..3efb5f90 100644 --- a/apps/fulltextsearch.sh +++ b/apps/fulltextsearch.sh @@ -55,16 +55,16 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ if is_app_installed fulltextsearch then print_text_in_color "$ICyan" "Removing old version of Full Text Search and resetting the app..." - occ_command_no_check fulltextsearch:reset - occ_command app:remove fulltextsearch + nextcloud_occ_no_check fulltextsearch:reset + nextcloud_occ app:remove fulltextsearch fi if is_app_installed fulltextsearch_elasticsearch then - occ_command app:remove fulltextsearch_elasticsearch + nextcloud_occ app:remove fulltextsearch_elasticsearch fi if is_app_installed files_fulltextsearch then - occ_command app:remove files_fulltextsearch + nextcloud_occ app:remove files_fulltextsearch fi # Remove nc_fts docker if installed docker_prune_this "$nc_fts" @@ -82,16 +82,16 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ # Reset database table check_command sudo -Hiu postgres psql "$NCCONFIGDB" -c "TRUNCATE TABLE oc_fulltextsearch_ticks;" # Reset Full Text Search to be able to index again, and also remove the app to be able to install it again - occ_command_no_check fulltextsearch:reset - occ_command app:remove fulltextsearch + nextcloud_occ_no_check fulltextsearch:reset + nextcloud_occ app:remove fulltextsearch fi if is_app_installed fulltextsearch_elasticsearch then - occ_command app:remove fulltextsearch_elasticsearch + nextcloud_occ app:remove fulltextsearch_elasticsearch fi if is_app_installed files_fulltextsearch then - occ_command app:remove files_fulltextsearch + nextcloud_occ app:remove files_fulltextsearch fi # Remove nc_fts docker if installed @@ -108,7 +108,7 @@ else fi # Make sure there is an Nextcloud installation -if ! [ "$(occ_command -V)" ] +if ! [ "$(nextcloud_occ -V)" ] then msg_box "It seems there is no Nextcloud server installed, please check your installation." exit 1 @@ -119,7 +119,7 @@ if is_app_installed nextant then # Remove Nextant msg_box "We will now remove Nextant + Solr and replace it with Full Text Search" - occ_command app:remove nextant + nextcloud_occ app:remove nextant # Remove Solr systemctl stop solr.service @@ -180,10 +180,10 @@ install_and_enable_app files_fulltextsearch chown -R www-data:www-data $NC_APPS_PATH # Final setup -occ_command fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_ElasticSearch\\Platform\\ElasticSearchPlatform"}' -occ_command fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://${INDEX_USER}:${ROREST}@localhost:9200\",\"elastic_index\":\"${INDEX_USER}-index\"}" -occ_command files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}" -if occ_command fulltextsearch:index < /dev/null +nextcloud_occ fulltextsearch:configure '{"search_platform":"OCA\\FullTextSearch_ElasticSearch\\Platform\\ElasticSearchPlatform"}' +nextcloud_occ fulltextsearch_elasticsearch:configure "{\"elastic_host\":\"http://${INDEX_USER}:${ROREST}@localhost:9200\",\"elastic_index\":\"${INDEX_USER}-index\"}" +nextcloud_occ files_fulltextsearch:configure "{\"files_pdf\":\"1\",\"files_office\":\"1\"}" +if nextcloud_occ fulltextsearch:index < /dev/null then msg_box "Full Text Search was successfully installed!" fi diff --git a/apps/onlyoffice_docker.sh b/apps/onlyoffice_docker.sh index c4c97c55..0e418121 100644 --- a/apps/onlyoffice_docker.sh +++ b/apps/onlyoffice_docker.sh @@ -31,7 +31,7 @@ check_nextcloud_https "OnlyOffice (Docker)" if is_app_enabled documentserver_community then any_key "The integrated OnlyOffice Documentserver will get uninstalled. Press any key to continue. Press CTRL+C to abort" - occ_command app:remove documentserver_community + nextcloud_occ app:remove documentserver_community fi # Check if collabora is already installed @@ -70,15 +70,15 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ # Disable RichDocuments (Collabora App) if activated if is_app_installed onlyoffice then - occ_command app:remove onlyoffice + nextcloud_occ app:remove onlyoffice fi # Remove trusted domain count=0 while [ "$count" -lt 10 ] do - if [ "$(occ_command_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] + if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] then - occ_command_no_check config:system:delete trusted_domains "$count" + nextcloud_occ_no_check config:system:delete trusted_domains "$count" break else count=$((count+1)) @@ -131,15 +131,15 @@ then # Disable Collabora App if activated if is_app_installed richdocuments then - occ_command app:remove richdocuments + nextcloud_occ app:remove richdocuments fi # Remove trusted domain count=0 while [ "$count" -lt 10 ] do - if [ "$(occ_command_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] + if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] then - occ_command_no_check config:system:delete trusted_domains "$count" + nextcloud_occ_no_check config:system:delete trusted_domains "$count" break else count=$((count+1)) @@ -166,7 +166,7 @@ fi SUBDOMAIN=$(input_box_flow "OnlyOffice subdomain e.g: office.yourdomain.com\n\nNOTE: This domain must be different than your Nextcloud domain. They can however be hosted on the same server, but would require seperate DNS entries.") # Nextcloud Main Domain -NCDOMAIN=$(occ_command_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||') +NCDOMAIN=$(nextcloud_occ_no_check config:system:get overwrite.cli.url | sed 's|https://||;s|/||') # shellcheck disable=2034,2059 true @@ -334,9 +334,9 @@ fi # Set config for OnlyOffice if [ -d "$NC_APPS_PATH"/onlyoffice ] then - occ_command config:app:set onlyoffice DocumentServerUrl --value=https://"$SUBDOMAIN/" + nextcloud_occ config:app:set onlyoffice DocumentServerUrl --value=https://"$SUBDOMAIN/" chown -R www-data:www-data "$NC_APPS_PATH" - occ_command config:system:set trusted_domains 3 --value="$SUBDOMAIN" + nextcloud_occ config:system:set trusted_domains 3 --value="$SUBDOMAIN" # Add prune command add_dockerprune # Restart Docker diff --git a/apps/onlyoffice_integrated.sh b/apps/onlyoffice_integrated.sh index 01c9d005..83c2c14f 100644 --- a/apps/onlyoffice_integrated.sh +++ b/apps/onlyoffice_integrated.sh @@ -40,12 +40,12 @@ then # Disable RichDocuments (Collabora App) if activated if is_app_installed richdocuments then - occ_command app:remove richdocuments + nextcloud_occ app:remove richdocuments fi # Disable OnlyOffice (Collabora App) if activated if is_app_installed onlyoffice then - occ_command app:remove onlyoffice + nextcloud_occ app:remove onlyoffice fi # Revoke LE SUBDOMAIN=$(input_box_flow "Please enter the subdomain you are using for OnlyOffice, e.g: office.yourdomain.com") @@ -68,9 +68,9 @@ then count=0 while [ "$count" -lt 10 ] do - if [ "$(occ_command_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] + if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] then - occ_command_no_check config:system:delete trusted_domains "$count" + nextcloud_occ_no_check config:system:delete trusted_domains "$count" break else count=$((count+1)) @@ -98,18 +98,18 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ case "$choice" in "Uninstall OnlyOffice") print_text_in_color "$ICyan" "Uninstalling OnlyOffice..." - occ_command app:remove documentserver_community + nextcloud_occ app:remove documentserver_community # Disable Onlyoffice App if activated if is_app_installed onlyoffice then - occ_command app:remove onlyoffice + nextcloud_occ app:remove onlyoffice fi msg_box "OnlyOffice was successfully uninstalled." exit ;; "Reinstall OnlyOffice") print_text_in_color "$ICyan" "Reinstalling OnlyOffice..." - occ_command app:remove documentserver_community + nextcloud_occ app:remove documentserver_community ;; "") exit 1 @@ -153,15 +153,15 @@ then # Disable Collabora App if activated if is_app_installed richdocuments then - occ_command app:remove richdocuments + nextcloud_occ app:remove richdocuments fi # Remove trusted domain count=0 while [ "$count" -lt 10 ] do - if [ "$(occ_command_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] + if [ "$(nextcloud_occ_no_check config:system:get trusted_domains "$count")" == "$SUBDOMAIN" ] then - occ_command_no_check config:system:delete trusted_domains "$count" + nextcloud_occ_no_check config:system:delete trusted_domains "$count" break else count=$((count+1)) @@ -171,7 +171,7 @@ else # Remove Collabora app if is_app_installed richdocuments then - occ_command app:remove richdocuments + nextcloud_occ app:remove richdocuments fi fi @@ -201,7 +201,7 @@ sleep 2 if install_and_enable_app documentserver_community then chown -R www-data:www-data "$NC_APPS_PATH" - occ_command config:app:set onlyoffice DocumentServerUrl --value="$(occ_command_no_check config:system:get overwrite.cli.url)/index.php/apps/documentserver_community/" + nextcloud_occ config:app:set onlyoffice DocumentServerUrl --value="$(nextcloud_occ_no_check config:system:get overwrite.cli.url)/index.php/apps/documentserver_community/" msg_box "OnlyOffice was successfully installed." else msg_box "The documentserver_community app failed to install. Please try again later.\n\nIf the error presist, please report the issue to https://github.com/nextcloud/documentserver_community\n\n'sudo -u www-data php ./occ app:install documentserver_community failed!'" diff --git a/apps/previewgenerator.sh b/apps/previewgenerator.sh index 271efa9c..29608470 100644 --- a/apps/previewgenerator.sh +++ b/apps/previewgenerator.sh @@ -50,13 +50,13 @@ then if is_app_installed previewgenerator then # enable previews - occ_command config:system:set enable_previews --value=true --type=boolean + nextcloud_occ config:system:set enable_previews --value=true --type=boolean # install needed dependency for movies install_if_not ffmpeg # reset the preview formats - occ_command config:system:delete "enabledPreviewProviders" + nextcloud_occ config:system:delete "enabledPreviewProviders" # reset the cronjob print_text_in_color "$ICyan" "Resetting the cronjob for the Preview Generation" @@ -114,37 +114,37 @@ $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ case "$choice" in *"PNG"*) - occ_command config:system:set enabledPreviewProviders 0 --value="OC\\Preview\\PNG" + nextcloud_occ config:system:set enabledPreviewProviders 0 --value="OC\\Preview\\PNG" ;;& *"JPEG"*) - occ_command config:system:set enabledPreviewProviders 1 --value="OC\\Preview\\JPEG" + nextcloud_occ config:system:set enabledPreviewProviders 1 --value="OC\\Preview\\JPEG" ;;& *"GIF"*) - occ_command config:system:set enabledPreviewProviders 2 --value="OC\\Preview\\GIF" + nextcloud_occ config:system:set enabledPreviewProviders 2 --value="OC\\Preview\\GIF" ;;& *"BMP"*) - occ_command config:system:set enabledPreviewProviders 3 --value="OC\\Preview\\BMP" + nextcloud_occ config:system:set enabledPreviewProviders 3 --value="OC\\Preview\\BMP" ;;& *"MarkDown"*) - occ_command config:system:set enabledPreviewProviders 4 --value="OC\\Preview\\MarkDown" + nextcloud_occ config:system:set enabledPreviewProviders 4 --value="OC\\Preview\\MarkDown" ;;& *"MP3"*) - occ_command config:system:set enabledPreviewProviders 5 --value="OC\\Preview\\MP3" + nextcloud_occ config:system:set enabledPreviewProviders 5 --value="OC\\Preview\\MP3" ;;& *"TXT"*) - occ_command config:system:set enabledPreviewProviders 6 --value="OC\\Preview\\TXT" + nextcloud_occ config:system:set enabledPreviewProviders 6 --value="OC\\Preview\\TXT" ;;& *"Movie"*) - occ_command config:system:set enabledPreviewProviders 7 --value="OC\\Preview\\Movie" + nextcloud_occ config:system:set enabledPreviewProviders 7 --value="OC\\Preview\\Movie" ;;& *"Photoshop"*) - occ_command config:system:set enabledPreviewProviders 8 --value="OC\\Preview\\Photoshop" + nextcloud_occ config:system:set enabledPreviewProviders 8 --value="OC\\Preview\\Photoshop" ;;& *"SVG"*) - occ_command config:system:set enabledPreviewProviders 9 --value="OC\\Preview\\SVG" + nextcloud_occ config:system:set enabledPreviewProviders 9 --value="OC\\Preview\\SVG" ;;& *"TIFF"*) - occ_command config:system:set enabledPreviewProviders 10 --value="OC\\Preview\\TIFF" + nextcloud_occ config:system:set enabledPreviewProviders 10 --value="OC\\Preview\\TIFF" ;;& *) ;; @@ -176,28 +176,28 @@ $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ case "$choice" in *"PNG"*) - occ_command config:system:set enabledPreviewProviders 11 --value="OC\\Preview\\PNG" + nextcloud_occ config:system:set enabledPreviewProviders 11 --value="OC\\Preview\\PNG" ;;& *"JPEG"*) - occ_command config:system:set enabledPreviewProviders 12 --value="OC\\Preview\\JPEG" + nextcloud_occ config:system:set enabledPreviewProviders 12 --value="OC\\Preview\\JPEG" ;;& *"GIF"*) - occ_command config:system:set enabledPreviewProviders 13 --value="OC\\Preview\\GIF" + nextcloud_occ config:system:set enabledPreviewProviders 13 --value="OC\\Preview\\GIF" ;;& *"BMP"*) - occ_command config:system:set enabledPreviewProviders 14 --value="OC\\Preview\\BMP" + nextcloud_occ config:system:set enabledPreviewProviders 14 --value="OC\\Preview\\BMP" ;;& *"MarkDown"*) - occ_command config:system:set enabledPreviewProviders 15 --value="OC\\Preview\\MarkDown" + nextcloud_occ config:system:set enabledPreviewProviders 15 --value="OC\\Preview\\MarkDown" ;;& *"MP3"*) - occ_command config:system:set enabledPreviewProviders 16 --value="OC\\Preview\\MP3" + nextcloud_occ config:system:set enabledPreviewProviders 16 --value="OC\\Preview\\MP3" ;;& *"TXT"*) - occ_command config:system:set enabledPreviewProviders 17 --value="OC\\Preview\\TXT" + nextcloud_occ config:system:set enabledPreviewProviders 17 --value="OC\\Preview\\TXT" ;;& *"Movie"*) - occ_command config:system:set enabledPreviewProviders 18 --value="OC\\Preview\\Movie" + nextcloud_occ config:system:set enabledPreviewProviders 18 --value="OC\\Preview\\Movie" ;;& *) ;; @@ -205,13 +205,13 @@ $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ fi # Set aspect ratio -occ_command config:app:set previewgenerator squareSizes --value="32 256" -occ_command config:app:set previewgenerator widthSizes --value="256 384" -occ_command config:app:set previewgenerator heightSizes --value="256" -occ_command config:system:set preview_max_x --value="2048" -occ_command config:system:set preview_max_y --value="2048" -occ_command config:system:set jpeg_quality --value="60" -occ_command config:app:set preview jpeg_quality --value="60" +nextcloud_occ config:app:set previewgenerator squareSizes --value="32 256" +nextcloud_occ config:app:set previewgenerator widthSizes --value="256 384" +nextcloud_occ config:app:set previewgenerator heightSizes --value="256" +nextcloud_occ config:system:set preview_max_x --value="2048" +nextcloud_occ config:system:set preview_max_y --value="2048" +nextcloud_occ config:system:set jpeg_quality --value="60" +nextcloud_occ config:app:set preview jpeg_quality --value="60" msg_box "In the last step you can define a specific Nextcloud user for which will be the user that runs the Preview Generation. @@ -227,12 +227,12 @@ then chown www-data:www-data "$VMLOGS"/previewgenerator.log # Pre generate everything - occ_command preview:generate-all + nextcloud_occ preview:generate-all else while : do PREVIEW_USER=$(input_box "Enter the Nextcloud user for which you want to run the Preview Generation (as a scheluded task)") - if [ -z "$(occ_command user:list | grep "$PREVIEW_USER" | awk '{print $3}')" ] + if [ -z "$(nextcloud_occ user:list | grep "$PREVIEW_USER" | awk '{print $3}')" ] then msg_box "It seems like the user you entered ($PREVIEW_USER) doesn't exist, please try again." else @@ -245,5 +245,5 @@ else chown www-data:www-data "$VMLOGS"/previewgenerator.log # Pre generate everything - occ_command preview:generate-all "$PREVIEW_USER" + nextcloud_occ preview:generate-all "$PREVIEW_USER" fi diff --git a/apps/smbmount.sh b/apps/smbmount.sh index b9d6380e..299efb26 100644 --- a/apps/smbmount.sh +++ b/apps/smbmount.sh @@ -206,7 +206,7 @@ $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ "Please select which Nextcloud groups shall get access to the new external storage $NEWNAME. If you select no group and no user, the external storage will be visible to all users of your instance. $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) - NC_GROUPS=$(occ_command_no_check group:list | grep ".*:$" | sed 's|^ - ||g' | sed 's|:$||g') + NC_GROUPS=$(nextcloud_occ_no_check group:list | grep ".*:$" | sed 's|^ - ||g' | sed 's|:$||g') mapfile -t NC_GROUPS <<< "$NC_GROUPS" for GROUP in "${NC_GROUPS[@]}" do @@ -226,7 +226,7 @@ $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) "Please select which Nextcloud users shall get access to the share. If you select no group and no user, the external storage will be visible to all users of your instance. $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) - NC_USER=$(occ_command_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||') + NC_USER=$(nextcloud_occ_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||') mapfile -t NC_USER <<< "$NC_USER" for USER in "${NC_USER[@]}" do @@ -235,42 +235,42 @@ $CHECKLIST_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) SELECTED_USER=$("${args[@]}" 3>&1 1>&2 2>&3) fi # Create and mount external storage to the admin group - MOUNT_ID=$(occ_command files_external:create "$NEWNAME" local null::null -c datadir="$NEWPATH" ) + MOUNT_ID=$(nextcloud_occ files_external:create "$NEWNAME" local null::null -c datadir="$NEWPATH" ) MOUNT_ID=${MOUNT_ID//[!0-9]/} # Mount to admin group if no group or user chosen if [ -z "$SELECTED_GROUPS" ] && [ -z "$SELECTED_USER" ] then if ! yesno_box_no "Attention! You haven't selected any Nextcloud group or user.\nIs this correct?\nIf you select 'yes', it will be visible to all users of your Nextcloud instance.\nIf you select 'no', it will be only visible to Nextcloud users in the admin group." "$SUBTITLE" then - occ_command files_external:applicable --add-group=admin "$MOUNT_ID" -q + nextcloud_occ files_external:applicable --add-group=admin "$MOUNT_ID" -q fi fi # Mount to chosen Nextcloud groups if [ -n "$SELECTED_GROUPS" ] then - occ_command_no_check group:list | grep ".*:$" | sed 's|^ - ||g' | sed 's|:$||' | while read -r NC_GROUPS + nextcloud_occ_no_check group:list | grep ".*:$" | sed 's|^ - ||g' | sed 's|:$||' | while read -r NC_GROUPS do if [[ "$SELECTED_GROUPS" = *"$NC_GROUPS "* ]] then - occ_command files_external:applicable --add-group="$NC_GROUPS" "$MOUNT_ID" -q + nextcloud_occ files_external:applicable --add-group="$NC_GROUPS" "$MOUNT_ID" -q fi done fi # Mount to chosen Nextcloud users if [ -n "$SELECTED_USER" ] then - occ_command_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||' | while read -r NC_USER + nextcloud_occ_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||' | while read -r NC_USER do if [[ "$SELECTED_USER" = *"$NC_USER "* ]] then - occ_command files_external:applicable --add-user="$NC_USER" "$MOUNT_ID" -q + nextcloud_occ files_external:applicable --add-user="$NC_USER" "$MOUNT_ID" -q fi done fi # Enable all other options - occ_command files_external:option "$MOUNT_ID" filesystem_check_changes 1 - occ_command files_external:option "$MOUNT_ID" readonly "$READONLY" - occ_command files_external:option "$MOUNT_ID" enable_sharing "$SHARING" + nextcloud_occ files_external:option "$MOUNT_ID" filesystem_check_changes 1 + nextcloud_occ files_external:option "$MOUNT_ID" readonly "$READONLY" + nextcloud_occ files_external:option "$MOUNT_ID" enable_sharing "$SHARING" # Inform the user that mounting was successful msg_box "Your mount $NEWNAME was successful, congratulations! @@ -345,12 +345,12 @@ Just press [ENTER] (on the default 'yes') to install the needed files_inotify ap then # This check is needed to check if the app is compatible with the current NC version print_text_in_color "$ICyan" "Installing the files_inotify app..." - if ! occ_command_no_check app:install files_inotify + if ! nextcloud_occ_no_check app:install files_inotify then # Inform the user if the app couldn't get installed msg_box "It seems like the files_inotify app isn't compatible with the current NC version. Cannot proceed." # Remove the app to be able to install it again in another try - occ_command_no_check app:remove files_inotify + nextcloud_occ_no_check app:remove files_inotify break fi fi @@ -358,7 +358,7 @@ Just press [ENTER] (on the default 'yes') to install the needed files_inotify ap # Make sure that the app is enabled, too if ! is_app_enabled files_inotify then - occ_command_no_check app:enable files_inotify + nextcloud_occ_no_check app:enable files_inotify fi # Add crontab for this external storage diff --git a/apps/talk.sh b/apps/talk.sh index 3f38d323..1b3c9f31 100644 --- a/apps/talk.sh +++ b/apps/talk.sh @@ -36,7 +36,7 @@ lowest_compatible_nc 13 # Check if adminer is already installed print_text_in_color "$ICyan" "Checking if Talk is already installed..." -if [ -n "$(occ_command_no_check config:app:get spreed turn_servers | sed 's/\[\]//')" ] || is_this_installed coturn +if [ -n "$(nextcloud_occ_no_check config:app:get spreed turn_servers | sed 's/\[\]//')" ] || is_this_installed coturn then choice=$(whiptail --title "$TITLE" --menu \ "It seems like 'Nextcloud Talk' is already installed.\nChoose what you want to do. @@ -47,9 +47,9 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ case "$choice" in "Uninstall Nextcloud Talk") print_text_in_color "$ICyan" "Uninstalling Nextcloud Talk and resetting all settings..." - occ_command_no_check config:app:delete spreed stun_servers - occ_command_no_check config:app:delete spreed turn_servers - occ_command_no_check app:remove spreed + nextcloud_occ_no_check config:app:delete spreed stun_servers + nextcloud_occ_no_check config:app:delete spreed turn_servers + nextcloud_occ_no_check app:remove spreed rm $TURN_CONF apt-get purge coturn -y msg_box "Nextcloud Talk was successfully uninstalled and all settings were resetted." @@ -57,9 +57,9 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ ;; "Reinstall Nextcloud Talk") print_text_in_color "$ICyan" "Reinstalling Nextcloud Talk..." - occ_command_no_check config:app:delete spreed stun_servers - occ_command_no_check config:app:delete spreed turn_servers - occ_command_no_check app:remove spreed + nextcloud_occ_no_check config:app:delete spreed stun_servers + nextcloud_occ_no_check config:app:delete spreed turn_servers + nextcloud_occ_no_check app:remove spreed rm $TURN_CONF apt-get purge coturn -y ;; @@ -176,8 +176,8 @@ TURN_SERVERS_STRING="[{\"server\":\"$TURN_DOMAIN:$TURN_PORT\",\"secret\":\"$TURN if ! is_app_installed spreed then install_and_enable_app spreed - occ_command config:app:set spreed stun_servers --value="$STUN_SERVERS_STRING" --output json - occ_command config:app:set spreed turn_servers --value="$TURN_SERVERS_STRING" --output json + nextcloud_occ config:app:set spreed stun_servers --value="$STUN_SERVERS_STRING" --output json + nextcloud_occ config:app:set spreed turn_servers --value="$TURN_SERVERS_STRING" --output json chown -R www-data:www-data "$NC_APPS_PATH" fi diff --git a/apps/talk_signaling.sh b/apps/talk_signaling.sh index 9c52c565..e09b6f54 100644 --- a/apps/talk_signaling.sh +++ b/apps/talk_signaling.sh @@ -41,7 +41,7 @@ check_nextcloud_https "Nextclod Talk" # Check if talk/spreed is already installed print_text_in_color "$ICyan" "Checking if Talk is already installed..." -if [ -n "$(occ_command_no_check config:app:get spreed turn_servers | sed 's/\[\]//')" ] || is_this_installed coturn +if [ -n "$(nextcloud_occ_no_check config:app:get spreed turn_servers | sed 's/\[\]//')" ] || is_this_installed coturn then choice=$(whiptail --title "$TITLE" --menu \ "It seems like 'Nextcloud Talk' is already installed.\nChoose what you want to do. @@ -52,10 +52,10 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ case "$choice" in "Uninstall Nextcloud Talk") print_text_in_color "$ICyan" "Uninstalling Nextcloud Talk and resetting all settings..." - occ_command_no_check config:app:delete spreed stun_servers - occ_command_no_check config:app:delete spreed turn_servers - occ_command_no_check config:app:delete spreed signaling_servers - occ_command_no_check app:remove spreed + nextcloud_occ_no_check config:app:delete spreed stun_servers + nextcloud_occ_no_check config:app:delete spreed turn_servers + nextcloud_occ_no_check config:app:delete spreed signaling_servers + nextcloud_occ_no_check app:remove spreed rm -rf \ "$TURN_CONF" \ "$SIGNALING_SERVER_CONF" \ @@ -81,10 +81,10 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ ;; "Reinstall Nextcloud Talk") print_text_in_color "$ICyan" "Reinstalling Nextcloud Talk..." - occ_command_no_check config:app:delete spreed stun_servers - occ_command_no_check config:app:delete spreed turn_servers - occ_command_no_check config:app:delete spreed signaling_servers - occ_command_no_check app:remove spreed + nextcloud_occ_no_check config:app:delete spreed stun_servers + nextcloud_occ_no_check config:app:delete spreed turn_servers + nextcloud_occ_no_check config:app:delete spreed signaling_servers + nextcloud_occ_no_check app:remove spreed rm -rf \ "$TURN_CONF" \ "$SIGNALING_SERVER_CONF" \ @@ -201,8 +201,8 @@ then install_and_enable_app spreed fi -occ_command config:app:set spreed stun_servers --value="$STUN_SERVERS_STRING" --output json -occ_command config:app:set spreed turn_servers --value="$TURN_SERVERS_STRING" --output json +nextcloud_occ config:app:set spreed stun_servers --value="$STUN_SERVERS_STRING" --output json +nextcloud_occ config:app:set spreed turn_servers --value="$TURN_SERVERS_STRING" --output json chown -R www-data:www-data "$NC_APPS_PATH" msg_box "Nextcloud Talk is now installed. For more information about Nextcloud Talk and its mobile apps visit:\nhttps://nextcloud.com/talk/" @@ -443,7 +443,7 @@ fi # Set signaling server strings SIGNALING_SERVERS_STRING="{\"servers\":[{\"server\":\"https://$SUBDOMAIN/\",\"verify\":true}],\"secret\":\"$NC_SECRET\"}" -occ_command config:app:set spreed signaling_servers --value="$SIGNALING_SERVERS_STRING" --output json +nextcloud_occ config:app:set spreed signaling_servers --value="$SIGNALING_SERVERS_STRING" --output json # Check that everything is working if ! curl -L https://"$SUBDOMAIN"/api/v1/welcome diff --git a/disk/prune_zfs_snaphots.sh b/disk/prune_zfs_snaphots.sh index 57c03a47..cd534a2f 100644 --- a/disk/prune_zfs_snaphots.sh +++ b/disk/prune_zfs_snaphots.sh @@ -53,7 +53,7 @@ The script will also delete everything in trashbin for all users to free up some fi touch $VMLOGS/zfs_prune.log ./zfs-prune-snapshots.sh 4w ncdata >> $VMLOGS/zfs_prune.log - occ_command trashbin:cleanup --all-users >> $VMLOGS/zfs_prune.log + nextcloud_occ trashbin:cleanup --all-users >> $VMLOGS/zfs_prune.log fi fi fi @@ -578,7 +578,7 @@ fi # Check if Nextcloud is installed with TLS check_nextcloud_https() { - if ! occ_command_no_check config:system:get overwrite.cli.url | grep -q "https" + if ! nextcloud_occ_no_check config:system:get overwrite.cli.url | grep -q "https" then msg_box "Sorry, but Nextcloud needs to be run on HTTPS which doesn't seem to be the case here. You easily activate TLS (HTTPS) by running the Let's Encrypt script. @@ -835,7 +835,7 @@ if ! "$@"; then print_text_in_color "$ICyan" "Sorry but something went wrong. Please report this issue to $ISSUES and include the output of the error message. Thank you!" print_text_in_color "$IRed" "$* failed" - if occ_command_no_check -V > /dev/null + if nextcloud_occ_no_check -V > /dev/null then notify_admin_gui \ "Sorry but something went wrong. Please report this issue to $ISSUES and include the output of the error message. Thank you!" \ @@ -845,16 +845,25 @@ then fi } -# Example: occ_command 'maintenance:mode --on' -occ_command() { +# Example: nextcloud_occ 'maintenance:mode --on' +nextcloud_occ() { check_command sudo -u www-data php "$NCPATH"/occ "$@"; } -# Example: occ_command_no_check 'maintenance:mode --on' -occ_command_no_check() { +# Example: nextcloud_occ_no_check 'maintenance:mode --on' +nextcloud_occ_no_check() { sudo -u www-data php "$NCPATH"/occ "$@"; } +# Backwards compatibility (2020-10-08) +occ_command() { +nextcloud_occ +} + +occ_command_no_check() { +nextcloud_occ_no_check +} + network_ok() { version(){ local h t v @@ -914,7 +923,7 @@ calc_wt_size() { # example: is_app_enabled documentserver_community is_app_enabled() { -if occ_command app:list | sed '/Disabled/,$d' | awk '{print$2}' | tr -d ':' | sed '/^$/d' | grep -q "^$1$" +if nextcloud_occ app:list | sed '/Disabled/,$d' | awk '{print$2}' | tr -d ':' | sed '/^$/d' | grep -q "^$1$" then return 0 else @@ -937,12 +946,12 @@ install_and_enable_app() { if ! is_app_installed "$1" then print_text_in_color "$ICyan" "Installing $1..." - # occ_command not possible here because it uses check_command and will exit if occ_command fails - installcmd="$(occ_command_no_check app:install "$1")" + # nextcloud_occ not possible here because it uses check_command and will exit if nextcloud_occ fails + installcmd="$(nextcloud_occ_no_check app:install "$1")" if grep 'not compatible' <<< "$installcmd" then msg_box "The $1 app could not be installed. -It's probably not compatible with $(occ_command -V). +It's probably not compatible with $(nextcloud_occ -V). You can try to install the app manually after the script has finished, or when a new version of the app is released with the following command: @@ -953,13 +962,13 @@ or when a new version of the app is released with the following command: # Enable $1 if is_app_installed "$1" then - occ_command app:enable "$1" + nextcloud_occ app:enable "$1" chown -R www-data:www-data "$NC_APPS_PATH" fi fi else print_text_in_color "$ICyan" "It seems like $1 is installed already, trying to enable it..." - occ_command_no_check app:enable "$1" + nextcloud_occ_no_check app:enable "$1" fi } @@ -1127,7 +1136,7 @@ or experience other issues then please report this to $ISSUES" yes | sudo -u www-data php /var/www/nextcloud/updater/updater.phar download_script STATIC setup_secure_permissions_nextcloud -P $SCRIPTS bash $SECURE - occ_command maintenance:mode --off + nextcloud_occ maintenance:mode --off fi # Check new version @@ -1144,7 +1153,7 @@ msg_box "Your current version are still not compatible with the version required To upgrade between major versions, please check this out: https://shop.hanssonit.se/product/upgrade-between-major-owncloud-nextcloud-versions/" - occ_command -V + nextcloud_occ -V exit fi } @@ -1345,7 +1354,7 @@ esac # "Subject" \ # "Message" # -# occ_command_no_check notification:generate -l "$2" "$admin" "$1" +# nextcloud_occ_no_check notification:generate -l "$2" "$admin" "$1" notify_admin_gui() { local NC_USERS local user @@ -1360,11 +1369,11 @@ print_text_in_color "$ICyan" "Posting notification to users that are admins, thi send_mail "$1" "$2" if [ -z "${NC_ADMIN_USER[*]}" ] then - NC_USERS=$(occ_command_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||') + NC_USERS=$(nextcloud_occ_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||') mapfile -t NC_USERS <<< "$NC_USERS" for user in "${NC_USERS[@]}" do - if occ_command_no_check user:info "$user" | cut -d "-" -f2 | grep -x -q " admin" + if nextcloud_occ_no_check user:info "$user" | cut -d "-" -f2 | grep -x -q " admin" then NC_ADMIN_USER+=("$user") fi @@ -1374,7 +1383,7 @@ fi for admin in "${NC_ADMIN_USER[@]}" do print_text_in_color "$IGreen" "Posting '$1' to: $admin" - occ_command_no_check notification:generate -l "$2" "$admin" "$1" + nextcloud_occ_no_check notification:generate -l "$2" "$admin" "$1" done } diff --git a/menu/nextcloud_configuration.sh b/menu/nextcloud_configuration.sh index 7118b777..925bc801 100644 --- a/menu/nextcloud_configuration.sh +++ b/menu/nextcloud_configuration.sh @@ -49,7 +49,7 @@ case "$choice" in msg_box "This option will make all Nextcloud shares from other users appear in a folder named 'Shared' in the Nextcloud GUI.\n\nIf you don't enable this option, all shares will appear directly in the Nextcloud GUI root folder, which is the default behaviour." "$SUBTITLE" if yesno_box_yes "Do you want to enable this option?" "$SUBTITLE" then - occ_command config:system:set share_folder --value="/Shared" + nextcloud_occ config:system:set share_folder --value="/Shared" msg_box "All new Nextcloud shares from other users will appear in the 'Shared' folder from now on." "$SUBTITLE" fi ;;& @@ -66,7 +66,7 @@ case "$choice" in sleep 1 else # Disable workspaces - occ_command config:app:set text workspace_available --value=0 + nextcloud_occ config:app:set text workspace_available --value=0 msg_box "Rich workspaces are now disabled." "$SUBTITLE" fi fi @@ -80,7 +80,7 @@ case "$choice" in msg_box "This option will disable the with Nextcloud 18 introduced user flows. It will disable the user flow settings. Admin flows will continue to work." "$SUBTITLE" if yesno_box_yes "Do you want to disable user flows?" "$SUBTITLE" then - occ_command config:app:set workflowengine user_scope_disabled --value yes + nextcloud_occ config:app:set workflowengine user_scope_disabled --value yes msg_box "User flow settings are now disabled." "$SUBTITLE" fi else @@ -95,7 +95,7 @@ case "$choice" in if yesno_box_yes "Do you want to enable logrotate for Nextcloud logs?" "$SUBTITLE" then # Set logrotate (without size restriction) - occ_command config:system:set log_rotate_size --value=0 + nextcloud_occ config:system:set log_rotate_size --value=0 # Configure logrotate to rotate logs for us (max 10, every day a new one) cat << NEXTCLOUD_CONF > /etc/logrotate.d/nextcloud.log.conf diff --git a/menu/startup_configuration.sh b/menu/startup_configuration.sh index dd84cc61..a2cae5b7 100644 --- a/menu/startup_configuration.sh +++ b/menu/startup_configuration.sh @@ -100,7 +100,7 @@ case "$choice" in sed -i "s|;date.timezone.*|date.timezone = $(cat /etc/timezone)|g" "$PHP_INI" # Change timezone for logging - occ_command config:system:set logtimezone --value="$(cat /etc/timezone)" + nextcloud_occ config:system:set logtimezone --value="$(cat /etc/timezone)" clear msg_box "The timezone was changed successfully." "$SUBTITLE" fi diff --git a/nextcloud-startup-script.sh b/nextcloud-startup-script.sh index 7aca39c4..49c08e03 100644 --- a/nextcloud-startup-script.sh +++ b/nextcloud-startup-script.sh @@ -297,15 +297,15 @@ clear sed -i "s|;date.timezone.*|date.timezone = $(cat /etc/timezone)|g" "$PHP_INI" # Change timezone for logging -occ_command config:system:set logtimezone --value="$(cat /etc/timezone)" +nextcloud_occ config:system:set logtimezone --value="$(cat /etc/timezone)" clear # Pretty URLs print_text_in_color "$ICyan" "Setting RewriteBase to \"/\" in config.php..." chown -R www-data:www-data $NCPATH -occ_command config:system:set overwrite.cli.url --value="http://localhost/" -occ_command config:system:set htaccess.RewriteBase --value="/" -occ_command maintenance:update:htaccess +nextcloud_occ config:system:set overwrite.cli.url --value="http://localhost/" +nextcloud_occ config:system:set htaccess.RewriteBase --value="/" +nextcloud_occ maintenance:update:htaccess bash $SECURE & spinner_loading # Generate new SSH Keys @@ -351,7 +351,7 @@ unset UNIX_PASSWORD clear # NEXTCLOUD USER -NCADMIN=$(occ_command user:list | awk '{print $3}') +NCADMIN=$(nextcloud_occ user:list | awk '{print $3}') msg_box "We will now change the username and password for the Web Admin in Nextcloud." while : do @@ -393,7 +393,7 @@ done if [[ "$NCADMIN" ]] then print_text_in_color "$ICyan" "Deleting $NCADMIN..." - occ_command user:delete "$NCADMIN" + nextcloud_occ user:delete "$NCADMIN" sleep 2 fi clear @@ -462,7 +462,7 @@ bash "$SCRIPTS"/temporary-fix.sh rm "$SCRIPTS"/temporary-fix.sh # Cleanup 1 -occ_command maintenance:repair +nextcloud_occ maintenance:repair rm -f "$SCRIPTS/ip.sh" rm -f "$SCRIPTS/change_db_pass.sh" rm -f "$SCRIPTS/instruction.sh" diff --git a/nextcloud_install_production.sh b/nextcloud_install_production.sh index d7fd9380..8e0dcf81 100644 --- a/nextcloud_install_production.sh +++ b/nextcloud_install_production.sh @@ -419,7 +419,7 @@ bash $SECURE & spinner_loading # Install Nextcloud print_text_in_color "$ICyan" "Installing Nextcloud..." cd "$NCPATH" -occ_command maintenance:install \ +nextcloud_occ maintenance:install \ --data-dir="$NCDATA" \ --database=pgsql \ --database-name=nextcloud_db \ @@ -429,7 +429,7 @@ occ_command maintenance:install \ --admin-pass="$NCPASS" echo print_text_in_color "$ICyan" "Nextcloud version:" -occ_command status +nextcloud_occ status sleep 3 echo @@ -437,8 +437,8 @@ echo crontab -u www-data -l | { cat; echo "*/5 * * * * php -f $NCPATH/cron.php > /dev/null 2>&1"; } | crontab -u www-data - # Run the updatenotification on a schelude -occ_command config:system:set upgrade.disable-web --value="true" -occ_command config:app:set updatenotification notify_groups --value="[]" +nextcloud_occ config:system:set upgrade.disable-web --value="true" +nextcloud_occ config:app:set updatenotification notify_groups --value="[]" print_text_in_color "$ICyan" "Configuring update notifications specific for this server..." download_script STATIC updatenotification check_command chmod +x "$SCRIPTS"/updatenotification.sh @@ -457,31 +457,31 @@ sed -i "s|post_max_size =.*|post_max_size = 1100M|g" "$PHP_INI" sed -i "s|upload_max_filesize =.*|upload_max_filesize = 1000M|g" "$PHP_INI" # Set loggging -occ_command config:system:set log_type --value=file -occ_command config:system:set logfile --value="$VMLOGS/nextcloud.log" +nextcloud_occ config:system:set log_type --value=file +nextcloud_occ config:system:set logfile --value="$VMLOGS/nextcloud.log" rm -f "$NCDATA/nextcloud.log" -occ_command config:system:set loglevel --value=2 +nextcloud_occ config:system:set loglevel --value=2 install_and_enable_app admin_audit -occ_command config:app:set admin_audit logfile --value="$VMLOGS/audit.log" -occ_command config:system:set log.condition apps 0 --value admin_audit +nextcloud_occ config:app:set admin_audit logfile --value="$VMLOGS/audit.log" +nextcloud_occ config:system:set log.condition apps 0 --value admin_audit # Set SMTP mail -occ_command config:system:set mail_smtpmode --value="smtp" +nextcloud_occ config:system:set mail_smtpmode --value="smtp" # Forget login/session after 30 minutes -occ_command config:system:set remember_login_cookie_lifetime --value="1800" +nextcloud_occ config:system:set remember_login_cookie_lifetime --value="1800" # Set logrotate (max 10 MB) -occ_command config:system:set log_rotate_size --value="10485760" +nextcloud_occ config:system:set log_rotate_size --value="10485760" # Set trashbin retention obligation (save it in trahbin for 6 months or delete when space is needed) -occ_command config:system:set trashbin_retention_obligation --value="auto, 180" +nextcloud_occ config:system:set trashbin_retention_obligation --value="auto, 180" # Set versions retention obligation (save versions for 12 months or delete when space is needed) -occ_command config:system:set versions_retention_obligation --value="auto, 365" +nextcloud_occ config:system:set versions_retention_obligation --value="auto, 365" # Remove simple signup -occ_command config:system:set simpleSignUpLink.shown --type=bool --value=false +nextcloud_occ config:system:set simpleSignUpLink.shown --type=bool --value=false # Enable OPCache for PHP # https://docs.nextcloud.com/server/14/admin_manual/configuration_server/server_tuning.html#enable-php-opcache @@ -587,15 +587,15 @@ fi # Fix https://github.com/nextcloud/vm/issues/714 print_text_in_color "$ICyan" "Optimizing Nextcloud..." -yes | occ_command db:convert-filecache-bigint -occ_command db:add-missing-indices +yes | nextcloud_occ db:convert-filecache-bigint +nextcloud_occ db:add-missing-indices while [ -z "$CURRENTVERSION" ] do CURRENTVERSION=$(sudo -u www-data php $NCPATH/occ status | grep "versionstring" | awk '{print $3}') done if [ "${CURRENTVERSION%%.*}" -ge "19" ] then - occ_command db:add-missing-columns + nextcloud_occ db:add-missing-columns fi # Install Figlet diff --git a/nextcloud_update.sh b/nextcloud_update.sh index 023b0bac..e1ab5c0f 100644 --- a/nextcloud_update.sh +++ b/nextcloud_update.sh @@ -301,10 +301,10 @@ fi # Update all Nextcloud apps if [ "${CURRENTVERSION%%.*}" -ge "15" ] then - occ_command maintenance:mode --off + nextcloud_occ maintenance:mode --off # Check for upgrades print_text_in_color "$ICyan" "Trying to automatically update all Nextcloud apps..." - UPDATED_APPS="$(occ_command_no_check app:update --all)" + UPDATED_APPS="$(nextcloud_occ_no_check app:update --all)" fi # Check which apps got updated @@ -440,7 +440,7 @@ countdown "Backing up files and upgrading to Nextcloud $NCVERSION in 10 seconds. # Backup app status # Fixing https://github.com/nextcloud/server/issues/4538 print_text_in_color "$ICyan" "Getting and backing up the status of apps for later, this might take a while..." -NC_APPS="$(occ_command app:list | awk '{print$2}' | tr -d ':' | sed '/^$/d')" +NC_APPS="$(nextcloud_occ app:list | awk '{print$2}' | tr -d ':' | sed '/^$/d')" if [ -z "$NC_APPS" ] then print_text_in_color "$IRed" "No apps detected, aborting export of app status... Please report this issue to $ISSUES" @@ -449,7 +449,7 @@ else declare -Ag APPSTORAGE for app in $NC_APPS do - APPSTORAGE[$app]=$(occ_command_no_check config:app:get "$app" enabled) + APPSTORAGE[$app]=$(nextcloud_occ_no_check config:app:get "$app" enabled) done fi @@ -544,7 +544,7 @@ then print_text_in_color "$ICyan" "$BACKUP/apps/ exists" echo print_text_in_color "$IGreen" "All files are backed up." - occ_command maintenance:mode --on + nextcloud_occ maintenance:mode --on countdown "Removing old Nextcloud instance in 5 seconds..." "5" rm -rf $NCPATH print_text_in_color "$IGreen" "Extracting new package...." @@ -553,17 +553,17 @@ then print_text_in_color "$IGreen" "Restoring config to Nextcloud..." rsync -Aaxz $BACKUP/config "$NCPATH"/ bash $SECURE & spinner_loading - occ_command maintenance:mode --off - occ_command upgrade + nextcloud_occ maintenance:mode --off + nextcloud_occ upgrade # Optimize print_text_in_color "$ICyan" "Optimizing Nextcloud..." - yes | occ_command db:convert-filecache-bigint - occ_command db:add-missing-indices + yes | nextcloud_occ db:convert-filecache-bigint + nextcloud_occ db:add-missing-indices CURRENTVERSION=$(sudo -u www-data php $NCPATH/occ status | grep "versionstring" | awk '{print $3}') if [ "${CURRENTVERSION%%.*}" -ge "19" ] then check_php - occ_command db:add-missing-columns + nextcloud_occ db:add-missing-columns install_if_not php"$PHPVER"-bcmath fi else @@ -636,7 +636,7 @@ then then if is_app_enabled "$app" then - occ_command_no_check config:app:set "$app" enabled --value="${APPSTORAGE[$app]}" + nextcloud_occ_no_check config:app:set "$app" enabled --value="${APPSTORAGE[$app]}" fi fi fi @@ -659,12 +659,12 @@ chown -R root:root "$BACKUP" # Pretty URLs print_text_in_color "$ICyan" "Setting RewriteBase to \"/\" in config.php..." chown -R www-data:www-data "$NCPATH" -occ_command config:system:set htaccess.RewriteBase --value="/" -occ_command maintenance:update:htaccess +nextcloud_occ config:system:set htaccess.RewriteBase --value="/" +nextcloud_occ maintenance:update:htaccess bash "$SECURE" # Repair -occ_command maintenance:repair +nextcloud_occ maintenance:repair # Create $VMLOGS dir if [ ! -d "$VMLOGS" ] @@ -672,7 +672,7 @@ then mkdir -p "$VMLOGS" fi -CURRENTVERSION_after=$(occ_command status | grep "versionstring" | awk '{print $3}') +CURRENTVERSION_after=$(nextcloud_occ status | grep "versionstring" | awk '{print $3}') if [[ "$NCVERSION" == "$CURRENTVERSION_after" ]] || [ -n "$PRERELEASE_VERSION" ] then msg_box "Latest version is: $NCVERSION. Current version is: $CURRENTVERSION_after. @@ -683,8 +683,8 @@ If you notice that some apps are disabled it's due to that they are not compatib To recover your old apps, please check $BACKUP/apps and copy them to $NCPATH/apps manually. Thank you for using T&M Hansson IT's updater!" - occ_command status - occ_command maintenance:mode --off + nextcloud_occ status + nextcloud_occ maintenance:mode --off print_text_in_color "$ICyan" "Sending notification about the successful update to all admins..." notify_admin_gui \ "Nextcloud is now updated!" \ @@ -703,6 +703,6 @@ Maintenance mode is kept on." notify_admin_gui \ "Nextcloud update failed!" \ "Your Nextcloud update failed, please check the logs at $VMLOGS/update.log" - occ_command status + nextcloud_occ status exit 1 fi diff --git a/not-supported/smbserver.sh b/not-supported/smbserver.sh index 581f27ad..d9d5fa86 100644 --- a/not-supported/smbserver.sh +++ b/not-supported/smbserver.sh @@ -249,7 +249,7 @@ add_user() { # Check if the user already exists NEWNAME_TRANSLATED=$(echo "$NEWNAME" | tr "[:upper:]" "[:lower:]") - NEXTCLOUD_USERS=$(occ_command_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||' | tr "[:upper:]" "[:lower:]") + NEXTCLOUD_USERS=$(nextcloud_occ_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||' | tr "[:upper:]" "[:lower:]") if echo "$NEXTCLOUD_USERS" | grep -q "^$NEWNAME_TRANSLATED$" then msg_box "This Nextcloud user already exists. No chance to add it as a user to Nextcloud." "$SUBTITLE" @@ -394,7 +394,7 @@ do fi # Check if a NC account with the same name exists - NEXTCLOUD_USERS=$(occ_command_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||') + NEXTCLOUD_USERS=$(nextcloud_occ_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||') if ! echo "$NEXTCLOUD_USERS" | grep -q "^$user$" then msg_box "There doesn't exist any user with this name $user in Nextcloud. No chance to change the password of the Nextcloud account." "$SUBTITLE" @@ -806,7 +806,7 @@ $CHECKLIST_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ "Please select which Nextcloud groups shall get access to the new external storage $NEWNAME. If you select no group and no user, the external storage will be visible to all users of your instance. $CHECKLIST_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) - NC_GROUPS=$(occ_command_no_check group:list | grep ".*:$" | sed 's|^ - ||g' | sed 's|:$||g') + NC_GROUPS=$(nextcloud_occ_no_check group:list | grep ".*:$" | sed 's|^ - ||g' | sed 's|:$||g') mapfile -t NC_GROUPS <<< "$NC_GROUPS" for GROUP in "${NC_GROUPS[@]}" do @@ -827,7 +827,7 @@ $CHECKLIST_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) "Please select which Nextcloud users shall get access to the new external storage $NEWNAME. If you select no group and no user, the external storage will be visible to all users of your instance. $CHECKLIST_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) - NC_USER=$(occ_command_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||') + NC_USER=$(nextcloud_occ_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||') mapfile -t NC_USER <<< "$NC_USER" for USER in "${NC_USER[@]}" do @@ -837,7 +837,7 @@ $CHECKLIST_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) fi # Create and mount external storage - MOUNT_ID=$(occ_command files_external:create "$NEWNAME" local null::null -c datadir="$NEWPATH" ) + MOUNT_ID=$(nextcloud_occ files_external:create "$NEWNAME" local null::null -c datadir="$NEWPATH" ) MOUNT_ID=${MOUNT_ID//[!0-9]/} # Mount it to the admin group if no group or user chosen @@ -845,18 +845,18 @@ $CHECKLIST_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) then if ! yesno_box_no "Attention! You haven't selected any Nextcloud group or user.\nIs this correct?\nIf you select 'yes', it will be visible to all users of your Nextcloud instance.\nIf you select 'no', it will be only visible to Nextcloud users in the admin group." "$SUBTITLE" then - occ_command files_external:applicable --add-group=admin "$MOUNT_ID" -q + nextcloud_occ files_external:applicable --add-group=admin "$MOUNT_ID" -q fi fi # Mount it to selected groups if [ -n "$SELECTED_GROUPS" ] then - occ_command_no_check group:list | grep ".*:$" | sed 's|^ - ||g' | sed 's|:$||' | while read -r NC_GROUPS + nextcloud_occ_no_check group:list | grep ".*:$" | sed 's|^ - ||g' | sed 's|:$||' | while read -r NC_GROUPS do if [[ "$SELECTED_GROUPS" = *"$NC_GROUPS "* ]] then - occ_command files_external:applicable --add-group="$NC_GROUPS" "$MOUNT_ID" -q + nextcloud_occ files_external:applicable --add-group="$NC_GROUPS" "$MOUNT_ID" -q fi done fi @@ -864,19 +864,19 @@ $CHECKLIST_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4) # Mount it to selected users if [ -n "$SELECTED_USER" ] then - occ_command_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||' | while read -r NC_USER + nextcloud_occ_no_check user:list | sed 's|^ - ||g' | sed 's|:.*||' | while read -r NC_USER do if [[ "$SELECTED_USER" = *"$NC_USER "* ]] then - occ_command files_external:applicable --add-user="$NC_USER" "$MOUNT_ID" -q + nextcloud_occ files_external:applicable --add-user="$NC_USER" "$MOUNT_ID" -q fi done fi # Set up all other settings - occ_command files_external:option "$MOUNT_ID" filesystem_check_changes 1 - occ_command files_external:option "$MOUNT_ID" readonly "$READONLY" - occ_command files_external:option "$MOUNT_ID" enable_sharing "$SHARING" + nextcloud_occ files_external:option "$MOUNT_ID" filesystem_check_changes 1 + nextcloud_occ files_external:option "$MOUNT_ID" readonly "$READONLY" + nextcloud_occ files_external:option "$MOUNT_ID" enable_sharing "$SHARING" # Inform the user that mounting was successful msg_box "Your mount $NEWNAME was successful, congratulations! @@ -951,12 +951,12 @@ Just press [ENTER] (on the default 'yes') to install the needed files_inotify ap then # This check is needed to check if the app is compatible with the current NC version print_text_in_color "$ICyan" "Installing the files_inotify app..." - if ! occ_command_no_check app:install files_inotify + if ! nextcloud_occ_no_check app:install files_inotify then # Inform the user if the app couldn't get installed msg_box "It seems like the files_inotify app isn't compatible with the current NC version. Cannot proceed." # Remove the app to be able to install it again in another try - occ_command_no_check app:remove files_inotify + nextcloud_occ_no_check app:remove files_inotify return fi fi @@ -964,7 +964,7 @@ Just press [ENTER] (on the default 'yes') to install the needed files_inotify ap # Make sure that the app is enabled, too if ! is_app_enabled files_inotify then - occ_command_no_check app:enable files_inotify + nextcloud_occ_no_check app:enable files_inotify fi # Add crontab for this external storage diff --git a/old/spreedme.sh b/old/spreedme.sh index 757fd9e6..d091e89d 100644 --- a/old/spreedme.sh +++ b/old/spreedme.sh @@ -51,15 +51,15 @@ fi if [ -d "$NC_APPS_PATH/spreedme" ] then # Remove - occ_command app:disable spreedme + nextcloud_occ app:disable spreedme print_text_in_color "$ICyan" "Spreed.ME app already seems to be installed and will now be re-installed..." rm -R "$NC_APPS_PATH/spreedme" # Reinstall - occ_command app:install spreedme + nextcloud_occ app:install spreedme else - occ_command app:install spreedme + nextcloud_occ app:install spreedme fi -occ_command app:enable spreedme +nextcloud_occ app:enable spreedme chown -R www-data:www-data "$NC_APPS_PATH" # Generate secret keys diff --git a/static/cookielifetime.sh b/static/cookielifetime.sh index f7528968..10e3beb1 100644 --- a/static/cookielifetime.sh +++ b/static/cookielifetime.sh @@ -33,22 +33,22 @@ $MENU_GUIDE\n\n$RUN_LATER_GUIDE" "$WT_HEIGHT" "$WT_WIDTH" 4 \ case "$choice" in "1800s") - occ_command config:system:set remember_login_cookie_lifetime --value="1800" + nextcloud_occ config:system:set remember_login_cookie_lifetime --value="1800" ;; "7200s") - occ_command config:system:set remember_login_cookie_lifetime --value="7200" + nextcloud_occ config:system:set remember_login_cookie_lifetime --value="7200" ;; "43200s") - occ_command config:system:set remember_login_cookie_lifetime --value="43200" + nextcloud_occ config:system:set remember_login_cookie_lifetime --value="43200" ;; "172800s") - occ_command config:system:set remember_login_cookie_lifetime --value="172800" + nextcloud_occ config:system:set remember_login_cookie_lifetime --value="172800" ;; "604800s") - occ_command config:system:set remember_login_cookie_lifetime --value="604800" + nextcloud_occ config:system:set remember_login_cookie_lifetime --value="604800" ;; "2419200s") - occ_command config:system:set remember_login_cookie_lifetime --value="2419200" + nextcloud_occ config:system:set remember_login_cookie_lifetime --value="2419200" ;; "Custom") while : @@ -64,7 +64,7 @@ case "$choice" in then msg_box "It seems like you weren't satisfied with your setting of ($COOKIE_LIFETIME) seconds. Please try again." else - if occ_command config:system:set remember_login_cookie_lifetime --value="$COOKIE_LIFETIME" + if nextcloud_occ config:system:set remember_login_cookie_lifetime --value="$COOKIE_LIFETIME" then msg_box "Cookie Lifetime is now successfully set to $COOKIE_LIFETIME seconds." fi |