fix: sudo wrapper strips --install-missing-components and reruns command as root
This commit is contained in:
@@ -24,10 +24,11 @@ RUN curl -fsSL https://apps.purevpn-tools.com/cross-platform/linux-cli/productio
|
||||
|
||||
# ── Fake sudo wrapper ─────────────────────────────────────────────────────────
|
||||
# purevpn-cli calls `sudo purevpn-cli --connect X --install-missing-components`
|
||||
# which crashes in its own pkg/Node.js bootstrap (bug in the CLI).
|
||||
# Since we are root and pre-installed all VPN packages, we intercept that flag
|
||||
# and exit 0 so the parent process continues to the actual connect step.
|
||||
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' \
|
||||
# which crashes in its own pkg/Node.js bootstrap when that flag combination is
|
||||
# run through pkg's argument parser (bug in the CLI).
|
||||
# Fix: strip --install-missing-components and run the real command as-is.
|
||||
# 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
|
||||
|
||||
# ── PATH: installer puts binary in /opt/purevpn-cli/bin/ ─────────────────────
|
||||
|
||||
Reference in New Issue
Block a user