diff --git a/shell.nix b/shell.nix index ad1a267..1259d7b 100644 --- a/shell.nix +++ b/shell.nix @@ -20,5 +20,6 @@ pkgs.mkShell { shellHook = '' export NIX_ENFORCE_PURITY=0 cmake -B build + export PATH="$PWD/build:$PATH" ''; } diff --git a/test.py b/test.py index f41e74e..ce4ca2d 100755 --- a/test.py +++ b/test.py @@ -382,12 +382,19 @@ def check_ssh_localhost(): "localhost", "which", "fastsync-server"], capture_output=True, timeout=10) if r.returncode != 0: - install = subprocess.run(["ssh", "-o", "BatchMode=yes", "localhost", - f"mkdir -p ~/.local/bin && ln -sf {server_path} ~/.local/bin/fastsync-server"], - capture_output=True, timeout=10) - if install.returncode == 0: - r = subprocess.run(["ssh", "-o", "BatchMode=yes", "localhost", - "which", "fastsync-server"], capture_output=True, timeout=10) + path_r = subprocess.run( + ["ssh", "-o", "BatchMode=yes", "localhost", + "echo $PATH | tr ':' '\\n' | while read d; do [ -w \"$d\" ] && echo \"$d\" && break; done"], + capture_output=True, timeout=10, text=True) + remote_bin_dir = path_r.stdout.strip() + if remote_bin_dir: + install = subprocess.run( + ["ssh", "-o", "BatchMode=yes", "localhost", + f"ln -sf {server_path} {remote_bin_dir}/fastsync-server"], + capture_output=True, timeout=10) + if install.returncode == 0: + r = subprocess.run(["ssh", "-o", "BatchMode=yes", "localhost", + "which", "fastsync-server"], capture_output=True, timeout=10) SSH_AVAILABLE = r.returncode == 0