l bindfs: add clearTarget option
This commit is contained in:
parent
e95b720d97
commit
859a6d1e73
|
@ -28,6 +28,13 @@ in {
|
||||||
type = types.listOf types.str;
|
type = types.listOf types.str;
|
||||||
default = [];
|
default = [];
|
||||||
};
|
};
|
||||||
|
clearTarget = mkOption {
|
||||||
|
description = ''
|
||||||
|
whether to clear the target folder before mounting
|
||||||
|
'';
|
||||||
|
type = types.bool;
|
||||||
|
default = false;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
}));
|
}));
|
||||||
default = {};
|
default = {};
|
||||||
|
@ -41,6 +48,9 @@ in {
|
||||||
path = [ pkgs.coreutils ];
|
path = [ pkgs.coreutils ];
|
||||||
serviceConfig = {
|
serviceConfig = {
|
||||||
ExecStartPre = pkgs.writeDash "bindfs-init-${name}" ''
|
ExecStartPre = pkgs.writeDash "bindfs-init-${name}" ''
|
||||||
|
${optionalString mount.clearTarget ''
|
||||||
|
rm -rf '${mount.target}'
|
||||||
|
''}
|
||||||
mkdir -p '${mount.source}'
|
mkdir -p '${mount.source}'
|
||||||
mkdir -p '${mount.target}'
|
mkdir -p '${mount.target}'
|
||||||
'';
|
'';
|
||||||
|
|
Loading…
Reference in New Issue
Block a user