nextcloud-server externalStorage.userLocalMount config existing check
use `--output=json` and jq to check for existence of mount
This commit is contained in:
parent
16fcec4d40
commit
91f33f33a3
1 changed files with 10 additions and 10 deletions
|
|
@ -963,18 +963,18 @@ in
|
||||||
'' + lib.optionalString (cfg.apps.externalStorage.userLocalMount != null) (
|
'' + lib.optionalString (cfg.apps.externalStorage.userLocalMount != null) (
|
||||||
let
|
let
|
||||||
cfg' = cfg.apps.externalStorage.userLocalMount;
|
cfg' = cfg.apps.externalStorage.userLocalMount;
|
||||||
|
jq = "${pkgs.jq}/bin/jq";
|
||||||
escape = x: builtins.replaceStrings ["/"] [''\\\/''] x;
|
|
||||||
in
|
in
|
||||||
|
# sh
|
||||||
''
|
''
|
||||||
${occ} files_external:list \
|
exists=$(${occ} files_external:list --output=json | ${jq} 'any(.[]; .mount_point == "${cfg'.mountName}" and .configuration.datadir == "${cfg'.directory}")')
|
||||||
| grep '${escape cfg'.mountName}' \
|
if [[ "$exists" == "false" ]]; then
|
||||||
| grep '${escape cfg'.directory}' \
|
${occ} files_external:create \
|
||||||
|| ${occ} files_external:create \
|
'${cfg'.mountName}' \
|
||||||
'${cfg'.mountName}' \
|
local \
|
||||||
local \
|
null::null \
|
||||||
null::null \
|
--config datadir='${cfg'.directory}'
|
||||||
--config datadir='${cfg'.directory}'
|
fi
|
||||||
'');
|
'');
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue