fix: add build dir to PATH in nix-shell; robust SSH PATH detection in check_ssh_localhost
This commit is contained in:
@@ -20,5 +20,6 @@ pkgs.mkShell {
|
|||||||
shellHook = ''
|
shellHook = ''
|
||||||
export NIX_ENFORCE_PURITY=0
|
export NIX_ENFORCE_PURITY=0
|
||||||
cmake -B build
|
cmake -B build
|
||||||
|
export PATH="$PWD/build:$PATH"
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -382,8 +382,15 @@ def check_ssh_localhost():
|
|||||||
"localhost", "which", "fastsync-server"],
|
"localhost", "which", "fastsync-server"],
|
||||||
capture_output=True, timeout=10)
|
capture_output=True, timeout=10)
|
||||||
if r.returncode != 0:
|
if r.returncode != 0:
|
||||||
install = subprocess.run(["ssh", "-o", "BatchMode=yes", "localhost",
|
path_r = subprocess.run(
|
||||||
f"mkdir -p ~/.local/bin && ln -sf {server_path} ~/.local/bin/fastsync-server"],
|
["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)
|
capture_output=True, timeout=10)
|
||||||
if install.returncode == 0:
|
if install.returncode == 0:
|
||||||
r = subprocess.run(["ssh", "-o", "BatchMode=yes", "localhost",
|
r = subprocess.run(["ssh", "-o", "BatchMode=yes", "localhost",
|
||||||
|
|||||||
Reference in New Issue
Block a user