populate pass: check if already up to date

This commit is contained in:
lassulus 2018-11-30 09:02:46 +01:00
parent 4017c60485
commit eb68146cc4
1 changed files with 15 additions and 0 deletions

View File

@ -60,6 +60,17 @@ let
in /* sh */ ''
umask 0077
if test -e ${quote source.dir}/.git; then
local_pass_info=${quote source.name}\ $(${git}/bin/git -C ${quote source.dir} rev-parse HEAD)
remote_pass_info=$(${shell' target /* sh */ ''
cat ${quote target.path}/.pass_info || :
''})
if test "$local_pass_info" = "$remote_pass_info"; then
exit 0
fi
fi
tmp_dir=$(${coreutils}/bin/mktemp -dt populate-pass.XXXXXXXX)
trap cleanup EXIT
cleanup() {
@ -83,6 +94,10 @@ let
${coreutils}/bin/touch -d "$pass_date" "$tmp_path"
done
if test -n "''${local_pass_info-}"; then
echo "$local_pass_info" > "$tmp_dir"/.pass_info
fi
${rsync' target {} /* sh */ "$tmp_dir"}
'';