Add kickstart profile selection to configure.sh

After server checks pass, present all ks_base_profiles/*.cfg files
with their first-paragraph description and require the user to pick
one. The selected profile is copied to ks.cfg in the repo root.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-29 19:38:52 +02:00
parent 340cef962f
commit 0721550e9c
+28
View File
@@ -103,6 +103,34 @@ while true; do
continue continue
fi fi
echo ""
echo "=== Select Kickstart Profile ==="
KS_DIR="${SCRIPTDIR}/../ks_base_profiles"
KS_DEST="${SCRIPTDIR}/../ks.cfg"
mapfile -t KS_FILES < <(find "$KS_DIR" -maxdepth 1 -name "*.cfg" | sort)
if [[ ${#KS_FILES[@]} -eq 0 ]]; then
echo "No kickstart profiles found in ${KS_DIR}."
exit 1
fi
echo ""
for i in "${!KS_FILES[@]}"; do
desc=$(awk '/^$/{exit} {print}' "${KS_FILES[$i]}" \
| sed 's/^#[[:space:]]*//' | tr '\n' ' ' | xargs)
printf " %d) %-36s %s\n" "$((i+1))" "$(basename "${KS_FILES[$i]}")" "$desc"
done
echo ""
while true; do
read -rp "Select profile [1-${#KS_FILES[@]}]: " sel
[[ "$sel" =~ ^[0-9]+$ ]] && (( sel >= 1 && sel <= ${#KS_FILES[@]} )) && break
echo " Invalid selection, please enter a number between 1 and ${#KS_FILES[@]}."
done
cp "${KS_FILES[$((sel-1))]}" "$KS_DEST"
echo "Copied '$(basename "${KS_FILES[$((sel-1))]}")' to ${KS_DEST}."
echo "" echo ""
echo "=== Configuration complete ===" echo "=== Configuration complete ==="
echo "All values have been configured and verified successfully." echo "All values have been configured and verified successfully."