Исправь источник файлов при curl-установке

This commit is contained in:
2026-05-19 13:26:51 +03:00
parent 44ff3a2df9
commit 3945b2fb9f
2 changed files with 19 additions and 4 deletions

View File

@@ -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

View File

@@ -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'