diff --git a/lets-encrypt/test-new-config.sh b/lets-encrypt/test-new-config.sh index 75a0903ec3..ea55fc07c0 100644 --- a/lets-encrypt/test-new-config.sh +++ b/lets-encrypt/test-new-config.sh @@ -35,7 +35,11 @@ then fi # Set trusted domains -run_script NETWORK trusted +nextcloud_occ config:system:set trusted_domains 0 --value="localhost" +nextcloud_occ config:system:set trusted_domains 1 --value="$ADDRESS" +nextcloud_occ config:system:set trusted_domains 2 --value="$(hostname -f)" +nextcloud_occ config:system:set overwrite.cli.url --value="https://$(hostname --fqdn)" +nextcloud_occ maintenance:update:htaccess # Add crontab cat << CRONTAB > "$SCRIPTS/letsencryptrenew.sh" diff --git a/network/trusted.sh b/network/trusted.sh index 6b0e6504dd..7fbc3eec04 100644 --- a/network/trusted.sh +++ b/network/trusted.sh @@ -1,28 +1,14 @@ #!/bin/bash - -# T&M Hansson IT AB © - 2023, https://www.hanssonit.se/ - true -SCRIPT_NAME="Trusted" +SCRIPT_NAME="Set trusted domain" # shellcheck source=lib.sh -source /var/scripts/fetch_lib.sh - -# Check for errors + debug code and abort if something isn't right -# 1 = ON -# 0 = OFF -DEBUG=0 -debug_mode - -download_script NETWORK update-config -if [ -f $SCRIPTS/update-config.php ] -then - # Change config.php - php $SCRIPTS/update-config.php $NCPATH/config/config.php 'trusted_domains[]' localhost "${ADDRESS[@]}" "$(hostname)" "$(hostname --fqdn)" >/dev/null 2>&1 - php $SCRIPTS/update-config.php $NCPATH/config/config.php overwrite.cli.url https://"$(hostname --fqdn)"/ >/dev/null 2>&1 +source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh) - # Change .htaccess accordingly - sed -i "s|RewriteBase /nextcloud|RewriteBase /|g" $NCPATH/.htaccess +# Removed in NC 26.0.0. - # Cleanup - rm -f $SCRIPTS/update-config.php -fi +# Set trusted domains +nextcloud_occ config:system:set trusted_domains 0 --value="localhost" +nextcloud_occ config:system:set trusted_domains 1 --value="$ADDRESS" +nextcloud_occ config:system:set trusted_domains 2 --value="$(hostname -f)" +nextcloud_occ config:system:set overwrite.cli.url --value="https://$(hostname --fqdn)" +nextcloud_occ maintenance:update:htaccess diff --git a/network/update-config.php b/network/update-config.php deleted file mode 100644 index cf88651ff1..0000000000 --- a/network/update-config.php +++ /dev/null @@ -1,53 +0,0 @@ -#!/usr/bin/php - -# Credit to: https://github.com/jnweiger - - 3) - { - # append [] to the key name, if you need to pass an array object. - if (substr($argv[2], -2) === '[]') - { - $CONFIG[substr($argv[2],0,-2)] = array_slice($argv,3); - } - else - { - $CONFIG[$argv[2]] = $argv[3]; - } - } -else - { - # exactly two parameter given -- means delete. - unset($CONFIG[$argv[2]]); - } - -$text = var_export($CONFIG, true); -## A warning is printed, if argv[1] is not writable. -## PHP does not issue proper errno or strerror() does it? -file_put_contents($argv[1], " diff --git a/nextcloud-startup-script.sh b/nextcloud-startup-script.sh index d497129a1d..36fabf2f93 100644 --- a/nextcloud-startup-script.sh +++ b/nextcloud-startup-script.sh @@ -553,8 +553,12 @@ mesg n ROOTNEWPROFILE -# Set trusted domain in config.php -run_script NETWORK trusted +# Set trusted domains +nextcloud_occ config:system:set trusted_domains 0 --value="localhost" +nextcloud_occ config:system:set trusted_domains 1 --value="$ADDRESS" +nextcloud_occ config:system:set trusted_domains 2 --value="$(hostname -f)" +nextcloud_occ config:system:set overwrite.cli.url --value="https://$(hostname --fqdn)" +nextcloud_occ maintenance:update:htaccess # Upgrade system print_text_in_color "$ICyan" "System will now upgrade..." diff --git a/static/trusted.sh b/static/trusted.sh deleted file mode 100644 index be17dd981a..0000000000 --- a/static/trusted.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -true -SCRIPT_NAME="Set trusted domain" -# shellcheck source=lib.sh -source <(curl -sL https://raw.githubusercontent.com/nextcloud/vm/master/lib.sh) - -# This is needed since we removed this from the startup script, or changed name so it can't be downloaded anymore -msg_box "You are running an outdated release. - -You see this message only to make it possible to run the first startup script, but as time goes, more and more will we incompatible. - -We urge you to download the latest version as soon as possible: https://github.com/nextcloud/vm/releases"