From 3945b2fb9f29764f09880f5759b35b32a9c02d8f Mon Sep 17 00:00:00 2001 From: Dmitriy Petrov Date: Tue, 19 May 2026 13:26:51 +0300 Subject: [PATCH] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D1=8C=20?= =?UTF-8?q?=D0=B8=D1=81=D1=82=D0=BE=D1=87=D0=BD=D0=B8=D0=BA=20=D1=84=D0=B0?= =?UTF-8?q?=D0=B9=D0=BB=D0=BE=D0=B2=20=D0=BF=D1=80=D0=B8=20curl-=D1=83?= =?UTF-8?q?=D1=81=D1=82=D0=B0=D0=BD=D0=BE=D0=B2=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- install.sh | 8 ++++---- tests/smoke.sh | 15 +++++++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/install.sh b/install.sh index a95c4e8..8a114e0 100755 --- a/install.sh +++ b/install.sh @@ -329,21 +329,21 @@ choose_modules() { script_dir() { case "$0" in */*) cd "$(dirname "$0")" 2>/dev/null && pwd ;; - *) pwd ;; + *) return 1 ;; esac } download_file() { src="$1" dst="$2" - local_dir="$(script_dir)" + local_dir="$(script_dir 2>/dev/null || true)" - if [ -f "$local_dir/$src" ]; then + if [ -n "$local_dir" ] && [ -f "$local_dir/$src" ]; then run cp "$local_dir/$src" "$dst" return 0 fi - if [ -f "$PWD/$src" ]; then + if [ "${LEMANA_VPN_USE_LOCAL_FILES:-0}" = "1" ] && [ -f "$PWD/$src" ]; then run cp "$PWD/$src" "$dst" return 0 fi diff --git a/tests/smoke.sh b/tests/smoke.sh index cceffce..5c5fbb8 100755 --- a/tests/smoke.sh +++ b/tests/smoke.sh @@ -29,4 +29,19 @@ status_text="$(bash "$ROOT/bin/vpn-lemanapro.sh" --status)" printf '%s\n' "$status_text" | grep -q 'app=' printf '%s\n' "$status_text" | grep -q 'autostart=' +fake_pwd="$TMP_DIR/fake-pwd" +mkdir -p "$fake_pwd/bin" +printf 'stale local cli\n' > "$fake_pwd/bin/vpn-lemanapro.sh" + +piped_output="$( + cd "$fake_pwd" && + LEMANA_VPN_RAW_BASE_URL="file://$ROOT" sh -s -- --dry-run --non-interactive --minimal --without-app < "$ROOT/install.sh" +)" + +printf '%s\n' "$piped_output" | grep -q "curl -fsSL file://$ROOT/bin/vpn-lemanapro.sh" +if printf '%s\n' "$piped_output" | grep -q "$fake_pwd/bin/vpn-lemanapro.sh"; then + echo "piped install used stale PWD/bin/vpn-lemanapro.sh" >&2 + exit 1 +fi + printf 'smoke ok\n'