update nextcloud

This commit is contained in:
Emmanuel Garette 2022-10-17 18:33:01 +02:00
parent 67ff08b47d
commit a716f0cc47
3 changed files with 13 additions and 6 deletions

View file

@ -1,7 +1,7 @@
format: '0.1'
description: Nextcloud
depends:
- base-fedora-35
- base-fedora-36
- postgresql-client
- ldap-client-fedora
- redis-client

View file

@ -52,8 +52,8 @@ $CONFIG = array (
'maintenance' => false,
'appstoreenabled' => false,
'appcodechecker' => false,
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
# 'memcache.distributed' => '\\OC\\Memcache\\Redis',
# 'memcache.locking' => '\\OC\\Memcache\\Redis',
'trusted_proxies' => '%%revprox_client_server_ip',
'overwritehost' => '%%revprox_client_external_domainnames[0]',
'filelocking.enabled' => true,
@ -69,7 +69,7 @@ $CONFIG = array (
'local_cert' => '/etc/pki/tls/certs/redis.crt',
'local_pk' => '/etc/pki/tls/private/redis.key',
'cafile' => '/etc/pki/ca-trust/source/anchors/ca_Redis.crt',
)
),
),
'default_phone_region' => 'FR',
# OIDC login

View file

@ -1,11 +1,15 @@
%echo "#!/bin/bash -ex"
if [ ! -f /srv/nextcloud/keys/secret.txt ]; then
sed -i "s/'config_is_read_only' => true,/'config_is_read_only' => false,/g" /etc/nextcloud/config.php
/usr/bin/php /usr/share/nextcloud/occ maintenance:install --no-interaction --data-dir /srv/nextcloud/data/ --database "pgsql" --database-host "%%pg_client_server_domainname" --database-name "%%pg_client_database" --database-user "%%pg_client_username" --database-pass "%%pg_client_password" --admin-user "admin" --admin-pass "%%nextcloud_admin_password"
sed -i "s/'config_is_read_only' => false,/'config_is_read_only' => true,/g" /etc/nextcloud/config.php
umask 027
/usr/bin/php /usr/share/nextcloud/occ --no-warnings config:system:get passwordsalt > /srv/nextcloud/keys/passwordsalt.txt
/usr/bin/php /usr/share/nextcloud/occ --no-warnings config:system:get secret > /srv/nextcloud/keys/secret.txt
/usr/bin/php /usr/share/nextcloud/occ --no-warnings config:system:get version > /srv/nextcloud/keys/version.txt
VERSION=$(/usr/bin/php /usr/share/nextcloud/occ --no-warnings config:system:get version)
if ! echo "$VERSION"|grep -E '^[0-9][0-9.]*$'; then echo "unknown version: $VERSION"; exit 1; fi
echo $VERSION > /srv/nextcloud/keys/version.txt
/usr/bin/php /usr/share/nextcloud/occ app:enable user_ldap -q
/usr/bin/php /usr/share/nextcloud/occ ldap:create-empty-config -q
@ -15,11 +19,14 @@ else
sed -i "s'{{VERSION}}'$(cat /srv/nextcloud/keys/version.txt)'g" /etc/nextcloud/config.php
sed -i "s/'installed' => false,/'installed' => true,/g" /etc/nextcloud/config.php
# Upgrade
cp -f /etc/nextcloud/config.php /srv/nextcloud/keys/config.ORI.php
sha256sum /etc/nextcloud/config.php > /tmp/sha
sed -i "s/'config_is_read_only' => true,/'config_is_read_only' => false,/g" /etc/nextcloud/config.php
/usr/bin/php /usr/share/nextcloud/occ upgrade || true
sed -i "s/'config_is_read_only' => false,/'config_is_read_only' => true,/g" /etc/nextcloud/config.php
/usr/bin/php /usr/share/nextcloud/occ --no-warnings config:system:get version > /srv/nextcloud/keys/version.txt
VERSION=$(/usr/bin/php /usr/share/nextcloud/occ --no-warnings config:system:get version)
if ! echo "$VERSION"|grep -E '^[0-9][0-9.]*$'; then echo "unknown version: $VERSION"; exit 1; fi
echo $VERSION > /srv/nextcloud/keys/version.txt
## if file is modified, copy upgraded version
sha256sum -c /tmp/sha || cp -a /etc/nextcloud/config.php /srv/nextcloud/keys/config.UPGRADED.php
# Configure LDAP