fix: sudo wrapper strips --install-missing-components and reruns command as root

This commit is contained in:
2026-03-11 10:44:03 +01:00
parent 7a739d97b3
commit 48498c1f43

View File

@@ -24,10 +24,11 @@ RUN curl -fsSL https://apps.purevpn-tools.com/cross-platform/linux-cli/productio
# ── Fake sudo wrapper ───────────────────────────────────────────────────────── # ── Fake sudo wrapper ─────────────────────────────────────────────────────────
# purevpn-cli calls `sudo purevpn-cli --connect X --install-missing-components` # purevpn-cli calls `sudo purevpn-cli --connect X --install-missing-components`
# which crashes in its own pkg/Node.js bootstrap (bug in the CLI). # which crashes in its own pkg/Node.js bootstrap when that flag combination is
# Since we are root and pre-installed all VPN packages, we intercept that flag # run through pkg's argument parser (bug in the CLI).
# and exit 0 so the parent process continues to the actual connect step. # Fix: strip --install-missing-components and run the real command as-is.
RUN printf '#!/bin/sh\nfor a in "$@"; do\n case "$a" in\n --install-missing-components)\n echo "[sudo] skipping --install-missing-components (pre-installed)"\n exit 0 ;;\n esac\ndone\nexec "$@"\n' \ # We are already root in Docker so the re-run won't trigger sudo again.
RUN printf '#!/bin/bash\nnew=(); for a in "$@"; do [[ "$a" == "--install-missing-components" ]] && continue; new+=("$a"); done\nexec "${new[@]}"\n' \
> /usr/local/bin/sudo && chmod +x /usr/local/bin/sudo > /usr/local/bin/sudo && chmod +x /usr/local/bin/sudo
# ── PATH: installer puts binary in /opt/purevpn-cli/bin/ ───────────────────── # ── PATH: installer puts binary in /opt/purevpn-cli/bin/ ─────────────────────