fix(setup): port KEYMAPS+vconsole support to auto-installer and answerfile generator
arch-autoinstall.sh was missing the keymap handling added to the guided installer in the previous two commits, so booting the ISO in auto mode (answerfile embedded) never called loadkeys and left the installed system with no /etc/vconsole.conf. - Add the same KEYMAPS array + selection logic to arch-autoinstall.sh (AF mode reads .keymap, interactive mode prompts) - Call loadkeys and export KEYMAP into the chroot - Write /etc/vconsole.conf inside the chroot - Add keymap dialog to generate-answerfile.sh so the field is populated - Document .keymap in the arch-autoinstall.sh answerfile field list Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>main
parent
77c3e1def8
commit
6ccc91303f
|
|
@ -4,7 +4,7 @@
|
||||||
# If /answerfile.json exists (e.g. embedded in the ISO via build.sh --preconf),
|
# If /answerfile.json exists (e.g. embedded in the ISO via build.sh --preconf),
|
||||||
# all prompts are answered from it. Missing fields fall back to interactive prompts.
|
# all prompts are answered from it. Missing fields fall back to interactive prompts.
|
||||||
#
|
#
|
||||||
# Answerfile fields: drive, kernel, hostname, username, encrypt, fido2_root,
|
# Answerfile fields: drive, kernel, keymap, hostname, username, encrypt, fido2_root,
|
||||||
# fido2_user, run_tui (password always prompted interactively)
|
# fido2_user, run_tui (password always prompted interactively)
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
@ -55,6 +55,35 @@ if $AF_MODE; then
|
||||||
command -v jq &>/dev/null || pacman -Sy --noconfirm jq
|
command -v jq &>/dev/null || pacman -Sy --noconfirm jq
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
############################################
|
||||||
|
# KEYMAP
|
||||||
|
# To add more layouts: append "code|Display Name" to KEYMAPS
|
||||||
|
############################################
|
||||||
|
KEYMAPS=(
|
||||||
|
"us|English US"
|
||||||
|
"de|German"
|
||||||
|
)
|
||||||
|
|
||||||
|
if $AF_MODE; then
|
||||||
|
LIVE_KEYMAP=$(af_get '.keymap' 'us')
|
||||||
|
else
|
||||||
|
echo "Select keyboard layout:"
|
||||||
|
for i in "${!KEYMAPS[@]}"; do
|
||||||
|
_km_code="${KEYMAPS[$i]%%|*}"
|
||||||
|
_km_name="${KEYMAPS[$i]##*|}"
|
||||||
|
printf " %d) %-14s (%s)\n" $((i+1)) "$_km_name" "$_km_code"
|
||||||
|
done
|
||||||
|
read -rp "Choice [1]: " _KM_IDX
|
||||||
|
_KM_IDX=$(( ${_KM_IDX:-1} - 1 ))
|
||||||
|
if (( _KM_IDX >= 0 && _KM_IDX < ${#KEYMAPS[@]} )); then
|
||||||
|
LIVE_KEYMAP="${KEYMAPS[$_KM_IDX]%%|*}"
|
||||||
|
else
|
||||||
|
LIVE_KEYMAP="${KEYMAPS[0]%%|*}"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
loadkeys "$LIVE_KEYMAP"
|
||||||
|
KEYMAP="$LIVE_KEYMAP"
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# SAFETY WARNING
|
# SAFETY WARNING
|
||||||
############################################
|
############################################
|
||||||
|
|
@ -263,7 +292,7 @@ fi
|
||||||
############################################
|
############################################
|
||||||
# PASS VARIABLES INTO CHROOT
|
# PASS VARIABLES INTO CHROOT
|
||||||
############################################
|
############################################
|
||||||
export HOSTNAME USERNAME USERPASS ROOT_PART KERNEL FIDO_ROOT FIDO_USER ENCRYPT_DISK
|
export HOSTNAME USERNAME USERPASS ROOT_PART KERNEL FIDO_ROOT FIDO_USER ENCRYPT_DISK KEYMAP
|
||||||
|
|
||||||
############################################
|
############################################
|
||||||
# CHROOT CONFIGURATION
|
# CHROOT CONFIGURATION
|
||||||
|
|
@ -275,6 +304,7 @@ set -euo pipefail
|
||||||
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
||||||
locale-gen
|
locale-gen
|
||||||
echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
echo "LANG=en_US.UTF-8" > /etc/locale.conf
|
||||||
|
echo "KEYMAP=${KEYMAP}" > /etc/vconsole.conf
|
||||||
|
|
||||||
# Time / hostname
|
# Time / hostname
|
||||||
ln -sf /usr/share/zoneinfo/Europe/Vienna /etc/localtime
|
ln -sf /usr/share/zoneinfo/Europe/Vienna /etc/localtime
|
||||||
|
|
|
||||||
|
|
@ -118,6 +118,14 @@ AF_KERNEL=$(dialog --backtitle "$BACKTITLE" \
|
||||||
"linux-zen" "Zen performance kernel" \
|
"linux-zen" "Zen performance kernel" \
|
||||||
3>&1 1>&2 2>&3) || AF_KERNEL="linux"
|
3>&1 1>&2 2>&3) || AF_KERNEL="linux"
|
||||||
|
|
||||||
|
# ── Keymap ────────────────────────────────────────────────────────────────────
|
||||||
|
AF_KEYMAP=$(dialog --backtitle "$BACKTITLE" \
|
||||||
|
--title " Keyboard Layout " \
|
||||||
|
--menu "Select keyboard layout (live environment + installed system):" 10 60 2 \
|
||||||
|
"us" "English US" \
|
||||||
|
"de" "German" \
|
||||||
|
3>&1 1>&2 2>&3) || AF_KEYMAP="us"
|
||||||
|
|
||||||
# ── Hostname ──────────────────────────────────────────────────────────────────
|
# ── Hostname ──────────────────────────────────────────────────────────────────
|
||||||
AF_HOSTNAME=$(dialog --backtitle "$BACKTITLE" \
|
AF_HOSTNAME=$(dialog --backtitle "$BACKTITLE" \
|
||||||
--title " Hostname " \
|
--title " Hostname " \
|
||||||
|
|
@ -315,6 +323,7 @@ fi
|
||||||
SUMMARY=""
|
SUMMARY=""
|
||||||
[[ -n "$AF_DRIVE" ]] && SUMMARY+=" Drive: $AF_DRIVE\n"
|
[[ -n "$AF_DRIVE" ]] && SUMMARY+=" Drive: $AF_DRIVE\n"
|
||||||
[[ -n "$AF_KERNEL" ]] && SUMMARY+=" Kernel: $AF_KERNEL\n"
|
[[ -n "$AF_KERNEL" ]] && SUMMARY+=" Kernel: $AF_KERNEL\n"
|
||||||
|
[[ -n "$AF_KEYMAP" ]] && SUMMARY+=" Keymap: $AF_KEYMAP\n"
|
||||||
[[ -n "$AF_HOSTNAME" ]] && SUMMARY+=" Hostname: $AF_HOSTNAME (+ MAC suffix at deploy)\n"
|
[[ -n "$AF_HOSTNAME" ]] && SUMMARY+=" Hostname: $AF_HOSTNAME (+ MAC suffix at deploy)\n"
|
||||||
[[ -n "$AF_USERNAME" ]] && SUMMARY+=" Username: $AF_USERNAME\n"
|
[[ -n "$AF_USERNAME" ]] && SUMMARY+=" Username: $AF_USERNAME\n"
|
||||||
SUMMARY+=" Encrypt: $AF_ENCRYPT\n"
|
SUMMARY+=" Encrypt: $AF_ENCRYPT\n"
|
||||||
|
|
@ -349,6 +358,7 @@ mkdir -p "$(dirname "$OUTPUT")"
|
||||||
printf ' "_generated": "%s",\n' "$(date -Iseconds)"
|
printf ' "_generated": "%s",\n' "$(date -Iseconds)"
|
||||||
printf ' "drive": %s,\n' "$(json_str "$AF_DRIVE")"
|
printf ' "drive": %s,\n' "$(json_str "$AF_DRIVE")"
|
||||||
printf ' "kernel": %s,\n' "$(json_str "$AF_KERNEL")"
|
printf ' "kernel": %s,\n' "$(json_str "$AF_KERNEL")"
|
||||||
|
printf ' "keymap": %s,\n' "$(json_str "$AF_KEYMAP")"
|
||||||
printf ' "hostname": %s,\n' "$(json_str "$AF_HOSTNAME")"
|
printf ' "hostname": %s,\n' "$(json_str "$AF_HOSTNAME")"
|
||||||
printf ' "username": %s,\n' "$(json_str "$AF_USERNAME")"
|
printf ' "username": %s,\n' "$(json_str "$AF_USERNAME")"
|
||||||
printf ' "encrypt": %s,\n' "$AF_ENCRYPT"
|
printf ' "encrypt": %s,\n' "$AF_ENCRYPT"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue