diff --git a/Containers/nextcloud/entrypoint.sh b/Containers/nextcloud/entrypoint.sh index 796f3cd0..1b9f8d90 100644 --- a/Containers/nextcloud/entrypoint.sh +++ b/Containers/nextcloud/entrypoint.sh @@ -250,6 +250,21 @@ DATADIR_PERMISSION_CONF # unset admin password unset ADMIN_PASSWORD + if [ "$INSTALL_LATEST_MAJOR" = yes ]; then + php /var/www/html/occ config:system:set updater.release.channel --value=beta + php /var/www/html/updater/updater.phar --no-interaction + php /var/www/html/occ app:enable nextcloud-aio --force + if ! php /var/www/html/occ -V || php /var/www/html/occ status | grep maintenance | grep -q 'true'; then + echo "Installation of Nextcloud failed!" + touch "$NEXTCLOUD_DATA_DIR/install.failed" + fi + php /var/www/html/occ config:system:set updater.release.channel --value=stable + php /var/www/html/occ db:add-missing-indices + php /var/www/html/occ db:add-missing-columns + php /var/www/html/occ db:add-missing-primary-keys + yes | php /var/www/html/occ db:convert-filecache-bigint + fi + # Apply log settings echo "Applying default settings..." mkdir -p /var/www/html/data diff --git a/manual-install/update-yaml.sh b/manual-install/update-yaml.sh index 7d2446a1..fad25bc3 100644 --- a/manual-install/update-yaml.sh +++ b/manual-install/update-yaml.sh @@ -83,6 +83,7 @@ sed -i 's|COLLABORA_SECCOMP_POLICY=|COLLABORA_SECCOMP_POLICY=--o:security.seccom sed -i 's|NEXTCLOUD_STARTUP_APPS=|NEXTCLOUD_STARTUP_APPS="deck twofactor_totp tasks calendar contacts" # Allows to modify the Nextcloud apps that are installed on starting AIO the first time|' sample.conf sed -i 's|NEXTCLOUD_ADDITIONAL_APKS=|NEXTCLOUD_ADDITIONAL_APKS=imagemagick # This allows to add additional packages to the Nextcloud container permanently. Default is imagemagick but can be overwritten by modifying this value.|' sample.conf sed -i 's|NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=|NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS=imagick # This allows to add additional php extensions to the Nextcloud container permanently. Default is imagick but can be overwritten by modifying this value.|' sample.conf +sed -i 's|INSTALL_LATEST_MAJOR=|INSTALL_LATEST_MAJOR=no # Setting this to yes will install the latest Major Nextcloud version upon the first installation|' sample.conf sed -i 's|=$|= # TODO! This needs to be a unique and good password!|' sample.conf cat sample.conf diff --git a/php/containers.json b/php/containers.json index 6096733b..c5b606b6 100644 --- a/php/containers.json +++ b/php/containers.json @@ -161,7 +161,8 @@ "TRUSTED_CACERTS_DIR=%NEXTCLOUD_TRUSTED_CACERTS_DIR%", "STARTUP_APPS=%NEXTCLOUD_STARTUP_APPS%", "ADDITIONAL_APKS=%NEXTCLOUD_ADDITIONAL_APKS%", - "ADDITIONAL_PHP_EXTENSIONS=%NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS%" + "ADDITIONAL_PHP_EXTENSIONS=%NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS%", + "INSTALL_LATEST_MAJOR=%INSTALL_LATEST_MAJOR%" ], "restart": "unless-stopped", "devices": [ diff --git a/php/src/Controller/DockerController.php b/php/src/Controller/DockerController.php index dd417b27..5f4acfe3 100644 --- a/php/src/Controller/DockerController.php +++ b/php/src/Controller/DockerController.php @@ -154,11 +154,19 @@ class DockerController $port = 443; } + if (isset($request->getParsedBody()['install_latest_major'])) { + $installLatestMajor = 26; + } else { + $installLatestMajor = ""; + } + $config = $this->configurationManager->GetConfig(); // set AIO_URL $config['AIO_URL'] = $host . ':' . $port; // set wasStartButtonClicked $config['wasStartButtonClicked'] = 1; + // set install_latest_major + $config['install_latest_major'] = $installLatestMajor; $this->configurationManager->WriteConfig($config); // Start container diff --git a/php/src/Data/ConfigurationManager.php b/php/src/Data/ConfigurationManager.php index f734e1d1..07eb7078 100644 --- a/php/src/Data/ConfigurationManager.php +++ b/php/src/Data/ConfigurationManager.php @@ -677,6 +677,14 @@ class ConfigurationManager } } + public function shouldLatestMajorGetInstalled() : bool { + $config = $this->GetConfig(); + if(!isset($config['install_latest_major'])) { + $config['install_latest_major'] = ''; + } + return $config['install_latest_major'] !== ''; + } + public function GetAdditionalBackupDirectoriesString() : string { if (!file_exists(DataConst::GetAdditionalBackupDirectoriesFile())) { return ''; diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 1dc0358b..98789ae3 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -348,6 +348,12 @@ class DockerActionManager $replacements[1] = $this->configurationManager->GetNextcloudAdditionalApks(); } elseif ($out[1] === 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS') { $replacements[1] = $this->configurationManager->GetNextcloudAdditionalPhpExtensions(); + } elseif ($out[1] === 'INSTALL_LATEST_MAJOR') { + if ($this->configurationManager->shouldLatestMajorGetInstalled()) { + $replacements[1] = 'yes'; + } else { + $replacements[1] = ''; + } } else { $secret = $this->configurationManager->GetSecret($out[1]); if ($secret === "") { diff --git a/php/templates/containers.twig b/php/templates/containers.twig index 1e3d4242..7ec1ede3 100644 --- a/php/templates/containers.twig +++ b/php/templates/containers.twig @@ -26,6 +26,8 @@ {% set isWatchtowerRunning = false %} {% set isBackupOrRestoreRunning = false %} {% set isApacheStarting = false %} + {# Setting newMajorVersion to '' will hide corresponding options/elements #} + {% set newMajorVersion = 26 %} {% if is_backup_container_running == true %} {% if borg_backup_mode == 'backup' or borg_backup_mode == 'restore' %} @@ -250,10 +252,10 @@ {% else %} {% if is_mastercontainer_update_available == false %} Your containers are up-to-date.

- {% if isAnyRunning == true %} + {% if newMajorVersion != '' && isAnyRunning == true %}
- Note about Nextcloud 26
- If you want to upgrade to Nextcloud 26 now, you can do so by following this documentation
+ Note about Nextcloud {{ newMajorVersion }}
+ If you haven't upgraded to Nextcloud {{ newMajorVersion }} yet and want to do that now, feel free to follow this documentation

{% endif %} {% endif %} @@ -293,7 +295,16 @@ {% else %} - {% if was_start_button_clicked == false or has_update_available == false %} + {% if was_start_button_clicked == false %} +
+ + + {% if newMajorVersion != '' %} +
+ {% endif %} + +
+ {% elseif has_update_available == false %}