nixos/nextcloud: fail early if {admin,db}passFile is not readable

Otherwise `nextcloud-setup.service` fails during the installation and
thus leaves a corrupted state.
wip/yesman
Maximilian Bosch 3 years ago
parent 39d6d4e5c8
commit f4817027c1
No known key found for this signature in database
GPG Key ID: 091DBF4D1FC46B8E
  1. 22
      nixos/modules/services/web-apps/nextcloud.nix

@ -482,6 +482,28 @@ in {
path = [ occ ];
script = ''
chmod og+x ${cfg.home}
${optionalString (c.dbpassFile != null) ''
if [ ! -r "${c.dbpassFile}" ]; then
echo "dbpassFile ${c.dbpassFile} is not readable by nextcloud:nextcloud! Aborting..."
exit 1
fi
if [ -z "$(<${c.dbpassFile})" ]; then
echo "dbpassFile ${c.dbpassFile} is empty!"
exit 1
fi
''}
${optionalString (c.adminpassFile != null) ''
if [ ! -r "${c.adminpassFile}" ]; then
echo "adminpassFile ${c.adminpassFile} is not readable by nextcloud:nextcloud! Aborting..."
exit 1
fi
if [ -z "$(<${c.adminpassFile})" ]; then
echo "adminpassFile ${c.adminpassFile} is empty!"
exit 1
fi
''}
ln -sf ${cfg.package}/apps ${cfg.home}/
# create nextcloud directories.

Loading…
Cancel
Save