diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2021-02-05 12:25:22 +0100 |
---|---|---|
committer | Maximilian Bosch <maximilian@mbosch.me> | 2021-02-05 12:34:08 +0100 |
commit | f4817027c175dabe3f605231d4d9f1613c252377 (patch) | |
tree | 5a27873edf3c06dfba5ecc28b6cf36bed8d3c304 /nixos/modules | |
parent | 39d6d4e5c86c54272b2d888f6941459e7b5265a4 (diff) |
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.
Diffstat (limited to 'nixos/modules')
-rw-r--r-- | nixos/modules/services/web-apps/nextcloud.nix | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/nixos/modules/services/web-apps/nextcloud.nix b/nixos/modules/services/web-apps/nextcloud.nix index 1b643bd3260a2..8b21b009abc0b 100644 --- a/nixos/modules/services/web-apps/nextcloud.nix +++ b/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. |