acl: run mkdir, skip /
This commit is contained in:
parent
d9fe5d4629
commit
3c2e24df1c
@ -1,7 +1,7 @@
|
|||||||
{ config, lib, pkgs, ... }: let
|
{ config, lib, pkgs, ... }: let
|
||||||
parents = dir:
|
parents = dir:
|
||||||
if dir == "/" then
|
if dir == "/" then
|
||||||
[ dir ]
|
[]
|
||||||
else
|
else
|
||||||
[ dir ] ++ parents (builtins.dirOf dir)
|
[ dir ] ++ parents (builtins.dirOf dir)
|
||||||
;
|
;
|
||||||
@ -40,13 +40,16 @@ in {
|
|||||||
pkgs.coreutils
|
pkgs.coreutils
|
||||||
];
|
];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStart = pkgs.writers.writeDash "acl" (lib.concatStrings (
|
ExecStart = pkgs.writers.writeDash "acl" ''
|
||||||
lib.mapAttrsToList (_: rule: ''
|
mkdir -p "${path}"
|
||||||
setfacl -${lib.optionalString rule.recursive "R"}m ${rule.rule} ${path}
|
${lib.concatStrings (
|
||||||
${lib.optionalString rule.default "setfacl -${lib.optionalString rule.recursive "R"}dm ${rule.rule} ${path}"}
|
lib.mapAttrsToList (_: rule: ''
|
||||||
${lib.optionalString rule.parents (lib.concatMapStringsSep "\n" (folder: "setfacl -m ${rule.rule} ${folder}") (parents path))}
|
setfacl -${lib.optionalString rule.recursive "R"}m ${rule.rule} ${path}
|
||||||
'') rules
|
${lib.optionalString rule.default "setfacl -${lib.optionalString rule.recursive "R"}dm ${rule.rule} ${path}"}
|
||||||
));
|
${lib.optionalString rule.parents (lib.concatMapStringsSep "\n" (folder: "setfacl -m ${rule.rule} ${folder}") (parents (builtins.dirOf path)))}
|
||||||
|
'') rules
|
||||||
|
)}
|
||||||
|
'';
|
||||||
RemainAfterExit = true;
|
RemainAfterExit = true;
|
||||||
Type = "simple";
|
Type = "simple";
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user