fix: place commands in if blocks
All checks were successful
Continuous Integration / lint_n_build (push) Successful in 29s
Continuous Delivery / build_n_upload (push) Successful in 29s

This commit is contained in:
2026-06-25 19:13:36 +02:00
parent 55122123c2
commit 0f850bc326

View File

@@ -30,6 +30,7 @@ if ! id nextcloud >/dev/null 2>&1; then
useradd --base-dir %{_sharedstatedir} --create-home --shell $SHELL --system nextcloud
runuser --user=nextcloud -- mkdir --parents %{_sharedstatedir}/nextcloud/data
runuser --user=nextcloud -- printf 'alias occ="php /var/www/nextcloud/occ"\n' > %{_sharedstatedir}/nextcloud/.bash_profile
usermod --groups postgres,valkey --append nextcloud
fi
# Create config file
@@ -43,9 +44,6 @@ if ! -f %{_sysconfdir}/nextcloud/config.php; then
chmod 640 %{_sysconfdir}/nextcloud/config.php
fi
# Add nextcloud to postgres and valkey groups
usermod --groups postgres,valkey --append nextcloud
# Create postgres user and db
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet nextcloud; then
runuser --user=postgres -- createuser nextcloud
@@ -62,15 +60,11 @@ if ! -d /var/www/nextcloud; then
gpg --import %{_tmppath}/nextcloud.asc
gpg --verify %{_tmppath}/nextcloud-latest.tar.bz2.asc %{_tmppath}/nextcloud-latest.tar.bz2
tar --extract --file=%{_tmppath}/nextcloud-latest.tar.bz2 --directory=/var/www
chown --recursive nextcloud:nextcloud /var/www/nextcloud
chmod 755 /var/www/nextcloud
runuser --user=nextcloud -- ln --symbolic --force %{_sysconfdir}/nextcloud/config.php /var/www/nextcloud/config/config.php
fi
# Change rights and owner
chown --recursive nextcloud:nextcloud /var/www/nextcloud
chmod 755 /var/www/nextcloud
# Create symbolic link to config
runuser --user=nextcloud -- ln --symbolic --force %{_sysconfdir}/nextcloud/config.php /var/www/nextcloud/config/config.php
# Restart services
systemctl daemon-reload
systemctl reenable nginx.service php-fpm.service