fix the datadir permission problems during install

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-03-30 10:54:56 +02:00
parent 9c0ea8a23c
commit 386533b02f
5 changed files with 10 additions and 22 deletions

View file

@ -216,6 +216,12 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then
fi
# We do our own permission check so the permission check is not needed
cat << DATADIR_PERMISSION_CONF > /var/www/html/config/datadir.permission.config.php
<?php
\$CONFIG = array (
'check_data_directory_permissions' => false
);
DATADIR_PERMISSION_CONF
php /var/www/html/occ config:system:set check_data_directory_permissions --value=false --type=bool
# Try to force generation of appdata dir:
@ -238,6 +244,9 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then
fi
fi
# This autoconfig is not needed anymore and should be able to be overwritten by the user
rm /var/www/html/config/datadir.permission.config.php
# unset admin password
unset ADMIN_PASSWORD
@ -299,11 +308,6 @@ if ! [ -f "$NEXTCLOUD_DATA_DIR/skip.update" ]; then
done
fi
# Set the permission check to its default value again if not set
if [ "$SKIP_DATA_DIRECTORY_PERMISSION_CHECK" != yes ]; then
php /var/www/html/occ config:system:set check_data_directory_permissions --value=true --type=bool
fi
#upgrade
else
touch "$NEXTCLOUD_DATA_DIR/update.failed"

View file

@ -71,7 +71,6 @@ sed -i 's|APACHE_MAX_SIZE=|APACHE_MAX_SIZE=10737418240 # This needs to
sed -i 's|NEXTCLOUD_MAX_TIME=|NEXTCLOUD_MAX_TIME=3600 # This allows to change the upload time limit of the Nextcloud container|' sample.conf
sed -i 's|NEXTCLOUD_TRUSTED_CACERTS_DIR=|NEXTCLOUD_TRUSTED_CACERTS_DIR=/usr/local/share/ca-certificates/my-custom-ca # Nextcloud container will trust all the Certification Authorities, whose certificates are included in the given directory.|' sample.conf
sed -i 's|UPDATE_NEXTCLOUD_APPS=|UPDATE_NEXTCLOUD_APPS="no" # When setting to "yes" (with quotes), it will automatically update all installed Nextcloud apps upon container startup on saturdays.|' sample.conf
sed -i 's|SKIP_DATA_DIRECTORY_PERMISSION_CHECK=|SKIP_DATA_DIRECTORY_PERMISSION_CHECK="no" # When setting to "yes" (with quotes), it will skip the datadir permission check upon the initial Nextcloud installation.|' sample.conf
sed -i 's|APACHE_PORT=|APACHE_PORT=443 # Changing this to a different value than 443 will allow you to run it behind a web server or reverse proxy (like Apache, Nginx and else).|' sample.conf
sed -i 's|APACHE_IP_BINDING=|APACHE_IP_BINDING=0.0.0.0 # This can be changed to e.g. 127.0.0.1 if you want to run AIO behind a web server or reverse proxy (like Apache, Nginx and else) and if that is running on the same host and using localhost to connect|' sample.conf
sed -i 's|TALK_PORT=|TALK_PORT=3478 # This allows to adjust the port that the talk container is using.|' sample.conf

View file

@ -160,8 +160,7 @@
"TRUSTED_CACERTS_DIR=%NEXTCLOUD_TRUSTED_CACERTS_DIR%",
"STARTUP_APPS=%NEXTCLOUD_STARTUP_APPS%",
"ADDITIONAL_APKS=%NEXTCLOUD_ADDITIONAL_APKS%",
"ADDITIONAL_PHP_EXTENSIONS=%NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS%",
"SKIP_DATA_DIRECTORY_PERMISSION_CHECK=%SKIP_DATA_DIRECTORY_PERMISSION_CHECK%"
"ADDITIONAL_PHP_EXTENSIONS=%NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS%"
],
"restart": "unless-stopped",
"devices": [

View file

@ -739,14 +739,6 @@ class ConfigurationManager
return false;
}
public function shouldDataDirectoryPermissionCheckGetSkipped() : bool {
$datadir = $this->GetNextcloudDatadirMount();
if ($datadir === 'nextcloud_aio_nextcloud_datadir' || str_starts_with($datadir, '/run/desktop/mnt/host/')) {
return true;
}
return false;
}
public function GetNextcloudStartupApps() : string {
$apps = getenv('NEXTCLOUD_STARTUP_APPS');
if (is_string($apps)) {

View file

@ -348,12 +348,6 @@ class DockerActionManager
$replacements[1] = $this->configurationManager->GetNextcloudAdditionalApks();
} elseif ($out[1] === 'NEXTCLOUD_ADDITIONAL_PHP_EXTENSIONS') {
$replacements[1] = $this->configurationManager->GetNextcloudAdditionalPhpExtensions();
} elseif ($out[1] === 'SKIP_DATA_DIRECTORY_PERMISSION_CHECK') {
if ($this->configurationManager->shouldDataDirectoryPermissionCheckGetSkipped()) {
$replacements[1] = 'yes';
} else {
$replacements[1] = '';
}
} else {
$secret = $this->configurationManager->GetSecret($out[1]);
if ($secret === "") {