1
0
Fork 0
mirror of https://cgit.krebsco.de/krops synced 2024-11-26 21:19:47 +01:00

populate file: add useChecksum

This commit is contained in:
tv 2018-11-28 08:34:19 +01:00
parent d92cc88a3c
commit 6f49342b2d
3 changed files with 13 additions and 3 deletions

View file

@ -16,6 +16,7 @@ let {
};
};
sanitize = x: lib.getAttr (lib.typeOf x) {
bool = x;
list = map sanitize x;
set = lib.mapAttrs
(lib.const sanitize)

View file

@ -52,6 +52,10 @@
path = lib.mkOption {
type = lib.types.absolute-pathname;
};
useChecksum = lib.mkOption {
default = false;
type = lib.types.bool;
};
};
};
git = lib.types.submodule {

View file

@ -20,7 +20,11 @@ let
fi
'';
pop.file = target: source: rsync' target (quote source.path);
pop.file = target: source: let
configAttrs = ["useChecksum"];
config = filterAttrs (name: _: elem name configAttrs) source;
in
rsync' target config (quote source.path);
pop.git = target: source: shell' target /* sh */ ''
if ! test -e ${quote target.path}; then
@ -78,7 +82,7 @@ let
${coreutils}/bin/touch -d "$pass_date" "$tmp_path"
done
${rsync' target /* sh */ "$tmp_dir"}
${rsync' target {} /* sh */ "$tmp_dir"}
'';
pop.pipe = target: source: /* sh */ ''
@ -100,12 +104,13 @@ let
${pop.${source.type} target' source'}
'';
rsync' = target: sourcePath: /* sh */ ''
rsync' = target: config: sourcePath: /* sh */ ''
source_path=${sourcePath}
if test -d "$source_path"; then
source_path=$source_path/
fi
${rsync}/bin/rsync \
${optionalString (config.useChecksum or false) /* sh */ "--checksum"} \
-e ${quote (ssh' target)} \
-vFrlptD \
--delete-excluded \