fix(archiso): move user input before partitioning, fall back to bash on exit

Keymap selection was unreachable because user input ran after pacman/partition
steps that could fail under set -e. Move the entire user input block (kernel,
hostname, username, encryption, keymap) to before lsblk and drive selection.
Also remove the redundant live-env keymap section (launch.sh handles that).

Drop exec from .zlogin so quitting the installer returns to a bash shell
instead of ending the session.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
The_miro 2026-05-20 07:20:14 +02:00
parent f08aa29c7a
commit da0a9e7a32
2 changed files with 49 additions and 72 deletions

View File

@ -63,82 +63,11 @@ fi
# Begin
############################################
############################################
# Keyboard layout (live environment)
# 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"
lsblk
if $AF_MODE && [[ -n "$(af_get '.drive')" ]]; then
DRIVE=$(af_get '.drive')
echo "Drive (from answerfile): $DRIVE"
echo "WARNING: All data on $DRIVE will be erased. Proceeding in 5 seconds..."
sleep 5
else
DRIVE=$(ask "Enter install drive (e.g., /dev/sda)")
confirm "$DRIVE" || exit 1
fi
# Required packages
pacman -Syd --noconfirm parted cryptsetup libfido2 pam-u2f systemd-ukify jq
############################################
# Partitioning
############################################
RAM_GB=$(free --giga | awk '/Mem/ {print $2}')
DISK_GB=$(lsblk -dn -o SIZE -b "$DRIVE" | awk '{print int($1/1024/1024/1024)}')
EFI_SIZE=5
SWAP_SIZE=$RAM_GB
ROOT_SIZE=$((DISK_GB - SWAP_SIZE - EFI_SIZE - 1))
if (( ROOT_SIZE < 8 )); then
echo "ERROR: Disk too small for layout."
exit 1
fi
echo "EFI=${EFI_SIZE}G, Root=${ROOT_SIZE}G, Swap=${SWAP_SIZE}G"
parted -s "$DRIVE" mklabel gpt \
mkpart EFI fat32 1MiB "${EFI_SIZE}GiB" \
set 1 esp on \
mkpart ROOT "${EFI_SIZE}GiB" "$((EFI_SIZE + ROOT_SIZE))GiB" \
mkpart SWAP "$((EFI_SIZE + ROOT_SIZE))GiB" 100%
EFI_PART="${DRIVE}1"
ROOT_PART="${DRIVE}2"
SWAP_PART="${DRIVE}3"
mkfs.fat -F32 "$EFI_PART"
mkswap "$SWAP_PART"
swapon "$SWAP_PART"
############################################
# User input
############################################
@ -189,6 +118,53 @@ fi
read -rsp "Password for $USERNAME: " USERPASS; echo
[[ -z "$USERPASS" ]] && { echo "Error: password cannot be empty."; exit 1; }
lsblk
if $AF_MODE && [[ -n "$(af_get '.drive')" ]]; then
DRIVE=$(af_get '.drive')
echo "Drive (from answerfile): $DRIVE"
echo "WARNING: All data on $DRIVE will be erased. Proceeding in 5 seconds..."
sleep 5
else
DRIVE=$(ask "Enter install drive (e.g., /dev/sda)")
confirm "$DRIVE" || exit 1
fi
# Required packages
pacman -Syd --noconfirm parted cryptsetup libfido2 pam-u2f systemd-ukify jq
############################################
# Partitioning
############################################
RAM_GB=$(free --giga | awk '/Mem/ {print $2}')
DISK_GB=$(lsblk -dn -o SIZE -b "$DRIVE" | awk '{print int($1/1024/1024/1024)}')
EFI_SIZE=5
SWAP_SIZE=$RAM_GB
ROOT_SIZE=$((DISK_GB - SWAP_SIZE - EFI_SIZE - 1))
if (( ROOT_SIZE < 8 )); then
echo "ERROR: Disk too small for layout."
exit 1
fi
echo "EFI=${EFI_SIZE}G, Root=${ROOT_SIZE}G, Swap=${SWAP_SIZE}G"
parted -s "$DRIVE" mklabel gpt \
mkpart EFI fat32 1MiB "${EFI_SIZE}GiB" \
set 1 esp on \
mkpart ROOT "${EFI_SIZE}GiB" "$((EFI_SIZE + ROOT_SIZE))GiB" \
mkpart SWAP "$((EFI_SIZE + ROOT_SIZE))GiB" 100%
EFI_PART="${DRIVE}1"
ROOT_PART="${DRIVE}2"
SWAP_PART="${DRIVE}3"
mkfs.fat -F32 "$EFI_PART"
mkswap "$SWAP_PART"
swapon "$SWAP_PART"
############################################
# Encryption (optional)
############################################

View File

@ -1 +1,2 @@
exec /root/.automated_script.sh
/root/.automated_script.sh || true
exec bash