diff options
| author | tv <tv@krebsco.de> | 2026-11-20 05:19:21 +0000 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-11-20 05:19:21 +0000 |
| commit | e81592e76f48c850a0ef35b8048260c21306a4b2 (patch) | |
| tree | 91ed172c077c7532ee39757578ec8630f6833600 /pkgs/populate/src/rsync.rs | |
| parent | 2aa54d9cb0399371a72a768cb5657a2bfebfde9e (diff) | |
populate: get what the target lacks from its <nixpkgs>krops-2
populate runs findutils, flock, rsync, patch, and Git on the target, as
the sources need them. check looks for those first, and if any isn't
there, it warns, and gets their packages from the target's <nixpkgs> with
one nix-build, whose bin directories commands on the target, and rsync's
remote end, find commands in before those in their PATH, for the rest of
the run. If the target is the machine populate runs on, that goes for
populate as well.
Diffstat (limited to 'pkgs/populate/src/rsync.rs')
| -rw-r--r-- | pkgs/populate/src/rsync.rs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/populate/src/rsync.rs b/pkgs/populate/src/rsync.rs index 05eb126..f943d0e 100644 --- a/pkgs/populate/src/rsync.rs +++ b/pkgs/populate/src/rsync.rs @@ -106,9 +106,15 @@ pub fn transfer( if config.use_checksum { command.arg("--checksum"); } - if context.target.sudo { - command.arg("--rsync-path=sudo rsync"); - } + // The remote shell runs it as a command. + let sudo = if context.target.sudo { "sudo " } else { "" }; + match context.path() { + Some(path) => command.arg(format!( + "--rsync-path={sudo}env PATH={path}:\"$PATH\" rsync" + )), + None if context.target.sudo => command.arg("--rsync-path=sudo rsync"), + None => &mut command, + }; command.arg("-e").arg(&context.ssh).arg("--protect-args"); if insecure_links { command.arg("--insecure-links"); |
