fix Easy-RSA download when HOME is unset

This commit is contained in:
Stanislas Lange
2026-04-30 15:49:22 +02:00
committed by Stanislas
parent a6ed5e781c
commit 9ff040e6e9
2 changed files with 10 additions and 6 deletions

View File

@@ -128,11 +128,12 @@ fi
echo "Running OpenVPN install script..."
echo "Command: ${INSTALL_CMD[*]}"
echo "Running install with HOME unset to match cloud-init user-data environments"
# Run in subshell because the script calls 'exit 0' after generating client config
# Capture output to validate logging format, while still displaying it
# Use || true to prevent set -e from exiting on failure, then check exit code
INSTALL_OUTPUT="/tmp/install-output.log"
("${INSTALL_CMD[@]}") 2>&1 | tee "$INSTALL_OUTPUT"
(env -u HOME "${INSTALL_CMD[@]}") 2>&1 | tee "$INSTALL_OUTPUT"
INSTALL_EXIT_CODE=${PIPESTATUS[0]}
echo "=== Installation complete (exit code: $INSTALL_EXIT_CODE) ==="