From eb68146cc4848cfc0c0339c72a44a96fdeb4a1de Mon Sep 17 00:00:00 2001 From: lassulus Date: Fri, 30 Nov 2018 09:02:46 +0100 Subject: populate pass: check if already up to date --- pkgs/populate/default.nix | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pkgs/populate/default.nix b/pkgs/populate/default.nix index b5b8a7b..939ffb3 100644 --- a/pkgs/populate/default.nix +++ b/pkgs/populate/default.nix @@ -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"} ''; -- cgit v1.2.3