Files
PSProxmoxVE/tests/infrastructure/scripts/prepare-auto-iso.sh
T
Clint Branham e8689f071c fix(ci): use RUNNER_TEMP for all temp files instead of /tmp
/tmp on the self-hosted runner has sticky bit — files created by
previous runs (or different users) can't be overwritten. RUNNER_TEMP
is per-run and owned by the runner user.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-18 16:33:05 -05:00

41 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Prepare a PVE auto-install ISO with the answer file and first-boot script baked in.
# Uses --fetch-from iso mode so only a single CD-ROM is needed, no HTTP server required.
#
# Usage: prepare-auto-iso.sh <base-iso> <answer-file> [first-boot-script] [output-iso]
set -euo pipefail
BASE_ISO="$1"
ANSWER_FILE="$2"
FIRST_BOOT="${3:-}"
OUTPUT_ISO="${4:-${BASE_ISO%.iso}-auto.iso}"
for f in "$BASE_ISO" "$ANSWER_FILE"; do
if [ ! -f "$f" ]; then
echo "ERROR: File not found: $f" >&2
exit 1
fi
done
FIRST_BOOT_ARGS=()
if [ -n "$FIRST_BOOT" ] && [ -f "$FIRST_BOOT" ]; then
FIRST_BOOT_ARGS=(--on-first-boot "$FIRST_BOOT")
fi
echo "Preparing auto-install ISO..."
echo " Base ISO: $BASE_ISO"
echo " Answer file: $ANSWER_FILE"
echo " First boot: ${FIRST_BOOT:-none}"
echo " Output: $OUTPUT_ISO"
# Use the output directory for staging to avoid permission issues with the source ISO directory
proxmox-auto-install-assistant prepare-iso \
--fetch-from iso \
--answer-file "$ANSWER_FILE" \
"${FIRST_BOOT_ARGS[@]}" \
--tmp "$(dirname "$OUTPUT_ISO")" \
--output "$OUTPUT_ISO" \
"$BASE_ISO"
echo "Created: $OUTPUT_ISO"