diff options
| author | Alejandro Soto <alejandro@34project.org> | 2026-02-06 16:17:36 -0600 |
|---|---|---|
| committer | Alejandro Soto <alejandro@34project.org> | 2026-02-06 16:40:27 -0600 |
| commit | 0fb95d328dd1e178775d4e91e7c5a5c29de9400c (patch) | |
| tree | 719477cc745aa7e1517dac43b537841504731378 | |
| parent | 57e33b923de6a9122e43613778de0d268a5b4eb8 (diff) | |
home/environ/vtmp: exclude only the current local boot id from local->remote->local vtmp syncs
| -rw-r--r-- | home/environ/vtmp.nix | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/home/environ/vtmp.nix b/home/environ/vtmp.nix index fcde421..e15778d 100644 --- a/home/environ/vtmp.nix +++ b/home/environ/vtmp.nix @@ -8,31 +8,32 @@ with lib; let cfg = config.local.environ; vtmp-sync = pkgs.writeShellScript "vtmp-sync" '' - if [ $# -ne 2 ]; then - echo "usage: $0 <remote hostname> <local hostname>" >&2 + if [ $# -ne 3 ]; then + echo "usage: $0 <remote hostname> <local hostname> <boot id>" >&2 exit 1 fi local="$2" remote="$1" + boot_id="$(echo "$3" | ${pkgs.coreutils}/bin/head -c8)" rsync="${lib.getExe pkgs.rsync}" + cd "$HOME/vtmp" + mkdir -p "$remote" + declare -a rsync_opts rsync_opts+=("-glprtxz") rsync_opts+=("--open-noatime") - rsync_opts+=("--progress") rsync_opts+=("--preallocate") rsync_opts+=("--max-size=1G") rsync_opts+=("--rsh=${lib.getExe pkgs.openssh} -o BatchMode=yes") rsync_opts+=("--log-file=$remote/.rsync.log") - rsync_opts+=("--filter=- /$local/") + rsync_opts+=("--filter=- /$local.$boot_id/") rsync_opts+=("--filter=- /$remote/") - cd "$HOME/vtmp" - # Push to $remote from $local - "$rsync" "''${rsync_opts[@]}" -- ./ "$remote:vtmp/$local/" + "$rsync" "''${rsync_opts[@]}" -- ./ "$remote:vtmp/$local.$boot_id/" # Pull from $remote to $local "$rsync" "''${rsync_opts[@]}" -- "$remote:vtmp/" "./$remote/" @@ -82,7 +83,7 @@ in { }; Service = { - ExecStart = "${vtmp-sync} ${cfg.vtmpSyncHost} %l"; + ExecStart = "${vtmp-sync} ${cfg.vtmpSyncHost} %l %b"; }; }; |
