diff options
author | Maximilian Bosch <maximilian@mbosch.me> | 2021-02-06 21:56:03 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-06 21:56:03 +0100 |
commit | 31b1137c1dc642f94b5990d0aadc9cef6c533b9f (patch) | |
tree | 643bbfbdac9a219b69a3283e75e9e2d6837bee27 /nixos/modules | |
parent | f8452636438c84f74d5173c36b3a81a4966d8816 (diff) | |
parent | f4817027c175dabe3f605231d4d9f1613c252377 (diff) |
Merge pull request #112013 from Ma27/nextcloud-file-check
nixos/nextcloud: fail early if {admin,db}passFile is not readable
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 d50939e701ed9..c5c14050b5c2f 100644 --- a/nixos/modules/services/web-apps/nextcloud.nix +++ b/nixos/modules/services/web-apps/nextcloud.nix @@ -483,6 +483,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. |