fix: place commands in if blocks
This commit is contained in:
@@ -30,6 +30,7 @@ if ! id nextcloud >/dev/null 2>&1; then
|
|||||||
useradd --base-dir %{_sharedstatedir} --create-home --shell $SHELL --system nextcloud
|
useradd --base-dir %{_sharedstatedir} --create-home --shell $SHELL --system nextcloud
|
||||||
runuser --user=nextcloud -- mkdir --parents %{_sharedstatedir}/nextcloud/data
|
runuser --user=nextcloud -- mkdir --parents %{_sharedstatedir}/nextcloud/data
|
||||||
runuser --user=nextcloud -- printf 'alias occ="php /var/www/nextcloud/occ"\n' > %{_sharedstatedir}/nextcloud/.bash_profile
|
runuser --user=nextcloud -- printf 'alias occ="php /var/www/nextcloud/occ"\n' > %{_sharedstatedir}/nextcloud/.bash_profile
|
||||||
|
usermod --groups postgres,valkey --append nextcloud
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create config file
|
# Create config file
|
||||||
@@ -43,9 +44,6 @@ if ! -f %{_sysconfdir}/nextcloud/config.php; then
|
|||||||
chmod 640 %{_sysconfdir}/nextcloud/config.php
|
chmod 640 %{_sysconfdir}/nextcloud/config.php
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Add nextcloud to postgres and valkey groups
|
|
||||||
usermod --groups postgres,valkey --append nextcloud
|
|
||||||
|
|
||||||
# Create postgres user and db
|
# Create postgres user and db
|
||||||
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet nextcloud; then
|
if ! runuser --user=postgres -- psql --quiet --tuples-only --command='\du' | grep --quiet nextcloud; then
|
||||||
runuser --user=postgres -- createuser nextcloud
|
runuser --user=postgres -- createuser nextcloud
|
||||||
@@ -62,15 +60,11 @@ if ! -d /var/www/nextcloud; then
|
|||||||
gpg --import %{_tmppath}/nextcloud.asc
|
gpg --import %{_tmppath}/nextcloud.asc
|
||||||
gpg --verify %{_tmppath}/nextcloud-latest.tar.bz2.asc %{_tmppath}/nextcloud-latest.tar.bz2
|
gpg --verify %{_tmppath}/nextcloud-latest.tar.bz2.asc %{_tmppath}/nextcloud-latest.tar.bz2
|
||||||
tar --extract --file=%{_tmppath}/nextcloud-latest.tar.bz2 --directory=/var/www
|
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
|
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
|
# Restart services
|
||||||
systemctl daemon-reload
|
systemctl daemon-reload
|
||||||
systemctl reenable nginx.service php-fpm.service
|
systemctl reenable nginx.service php-fpm.service
|
||||||
|
|||||||
Reference in New Issue
Block a user