mirror of https://cgit.krebsco.de/krops/
populate file: add useChecksum
This commit is contained in:
parent
d92cc88a3c
commit
6f49342b2d
|
@ -16,6 +16,7 @@ let {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
sanitize = x: lib.getAttr (lib.typeOf x) {
|
sanitize = x: lib.getAttr (lib.typeOf x) {
|
||||||
|
bool = x;
|
||||||
list = map sanitize x;
|
list = map sanitize x;
|
||||||
set = lib.mapAttrs
|
set = lib.mapAttrs
|
||||||
(lib.const sanitize)
|
(lib.const sanitize)
|
||||||
|
|
|
@ -52,6 +52,10 @@
|
||||||
path = lib.mkOption {
|
path = lib.mkOption {
|
||||||
type = lib.types.absolute-pathname;
|
type = lib.types.absolute-pathname;
|
||||||
};
|
};
|
||||||
|
useChecksum = lib.mkOption {
|
||||||
|
default = false;
|
||||||
|
type = lib.types.bool;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
git = lib.types.submodule {
|
git = lib.types.submodule {
|
||||||
|
|
|
@ -20,7 +20,11 @@ let
|
||||||
fi
|
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 */ ''
|
pop.git = target: source: shell' target /* sh */ ''
|
||||||
if ! test -e ${quote target.path}; then
|
if ! test -e ${quote target.path}; then
|
||||||
|
@ -78,7 +82,7 @@ let
|
||||||
${coreutils}/bin/touch -d "$pass_date" "$tmp_path"
|
${coreutils}/bin/touch -d "$pass_date" "$tmp_path"
|
||||||
done
|
done
|
||||||
|
|
||||||
${rsync' target /* sh */ "$tmp_dir"}
|
${rsync' target {} /* sh */ "$tmp_dir"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pop.pipe = target: source: /* sh */ ''
|
pop.pipe = target: source: /* sh */ ''
|
||||||
|
@ -100,12 +104,13 @@ let
|
||||||
${pop.${source.type} target' source'}
|
${pop.${source.type} target' source'}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
rsync' = target: sourcePath: /* sh */ ''
|
rsync' = target: config: sourcePath: /* sh */ ''
|
||||||
source_path=${sourcePath}
|
source_path=${sourcePath}
|
||||||
if test -d "$source_path"; then
|
if test -d "$source_path"; then
|
||||||
source_path=$source_path/
|
source_path=$source_path/
|
||||||
fi
|
fi
|
||||||
${rsync}/bin/rsync \
|
${rsync}/bin/rsync \
|
||||||
|
${optionalString (config.useChecksum or false) /* sh */ "--checksum"} \
|
||||||
-e ${quote (ssh' target)} \
|
-e ${quote (ssh' target)} \
|
||||||
-vFrlptD \
|
-vFrlptD \
|
||||||
--delete-excluded \
|
--delete-excluded \
|
||||||
|
|
Loading…
Reference in New Issue