mirror of
https://cgit.krebsco.de/krops
synced 2024-11-23 03:29:48 +01:00
populate: add rsyncDefaultConfig
This commit is contained in:
parent
d80cb74c74
commit
0fc8f1b2a6
1 changed files with 14 additions and 7 deletions
|
@ -45,8 +45,8 @@ let
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pop.file = target: source: let
|
pop.file = target: source: let
|
||||||
configAttrs = ["useChecksum" "exclude" "filters" "deleteExcluded"];
|
config = rsyncDefaultConfig // sourceConfig;
|
||||||
config = filterAttrs (name: _: elem name configAttrs) source;
|
sourceConfig = getAttrs (attrNames rsyncDefaultConfig) source;
|
||||||
in
|
in
|
||||||
rsync' target config (quote source.path);
|
rsync' target config (quote source.path);
|
||||||
|
|
||||||
|
@ -144,7 +144,7 @@ let
|
||||||
echo "$local_pass_info" > "$tmp_dir"/.pass_info
|
echo "$local_pass_info" > "$tmp_dir"/.pass_info
|
||||||
fi
|
fi
|
||||||
|
|
||||||
${rsync' target {} /* sh */ "$tmp_dir"}
|
${rsync' target rsyncDefaultConfig /* sh */ "$tmp_dir"}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
pop.pipe = target: source: /* sh */ ''
|
pop.pipe = target: source: /* sh */ ''
|
||||||
|
@ -172,17 +172,17 @@ let
|
||||||
source_path=$source_path/
|
source_path=$source_path/
|
||||||
fi
|
fi
|
||||||
${rsync}/bin/rsync \
|
${rsync}/bin/rsync \
|
||||||
${optionalString (config.useChecksum or false) /* sh */ "--checksum"} \
|
${optionalString config.useChecksum /* sh */ "--checksum"} \
|
||||||
${optionalString target.sudo /* sh */ "--rsync-path=\"sudo rsync\""} \
|
${optionalString target.sudo /* sh */ "--rsync-path=\"sudo rsync\""} \
|
||||||
${concatMapStringsSep " "
|
${concatMapStringsSep " "
|
||||||
(pattern: /* sh */ "--exclude ${quote pattern}")
|
(pattern: /* sh */ "--exclude ${quote pattern}")
|
||||||
(config.exclude or [])} \
|
config.exclude} \
|
||||||
${concatMapStringsSep " "
|
${concatMapStringsSep " "
|
||||||
(filter: /* sh */ "--${filter.type} ${quote filter.pattern}")
|
(filter: /* sh */ "--${filter.type} ${quote filter.pattern}")
|
||||||
(config.filters or [])} \
|
config.filters} \
|
||||||
-e ${quote (ssh' target)} \
|
-e ${quote (ssh' target)} \
|
||||||
-vFrlptD \
|
-vFrlptD \
|
||||||
${optionalString (config.deleteExcluded or true) /* sh */ "--delete-excluded"} \
|
${optionalString config.deleteExcluded /* sh */ "--delete-excluded"} \
|
||||||
"$source_path" \
|
"$source_path" \
|
||||||
${quote (
|
${quote (
|
||||||
optionalString (!isLocalTarget target) (
|
optionalString (!isLocalTarget target) (
|
||||||
|
@ -194,6 +194,13 @@ let
|
||||||
>&2
|
>&2
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
rsyncDefaultConfig = {
|
||||||
|
useChecksum = false;
|
||||||
|
exclude = [];
|
||||||
|
filters = [];
|
||||||
|
deleteExcluded = true
|
||||||
|
};
|
||||||
|
|
||||||
runShell = target: command:
|
runShell = target: command:
|
||||||
if isLocalTarget target
|
if isLocalTarget target
|
||||||
then command
|
then command
|
||||||
|
|
Loading…
Reference in a new issue