fix(installer): add logging to guided installer and fix NVMe partition naming

- Add full session logging (tee to logfile) to archbaseos-guided-install.sh,
  matching the pattern already in arch-autoinstall.sh; copy log to /mnt/boot/
  at the end so it survives into the new system
- Add part() helper to both installers so NVMe/eMMC drives use the correct
  'p' separator (e.g. /dev/nvme0n1p1 instead of the broken /dev/nvme0n11)
- Add disk size guard to arch-autoinstall.sh: fail early with a clear message
  if ROOT_GIB would be < 8GiB instead of passing a nonsense value to parted

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
Amir Alexander Abdelbaki 2026-05-21 18:54:57 +02:00
parent 95617dd673
commit 319af7bde7
2 changed files with 32 additions and 7 deletions

View File

@ -49,6 +49,8 @@ get_mac_suffix() {
printf '%s' "${mac//:/}"
}
part() { [[ "$1" == *nvme* || "$1" == *mmcblk* ]] && echo "${1}p${2}" || echo "${1}${2}"; }
if $AF_MODE; then
echo "Answerfile detected: $ANSWERFILE"
# Ensure jq is available
@ -165,6 +167,10 @@ SWAP_SIZE="${RAM_GB}GiB"
DISK_SIZE=$(lsblk -b -dn -o SIZE "$DRIVE")
DISK_GIB=$((DISK_SIZE / 1024 / 1024 / 1024))
ROOT_GIB=$((DISK_GIB - RAM_GB - 15))
if (( ROOT_GIB < 8 )); then
echo "ERROR: Not enough disk space. Root would be only ${ROOT_GIB}GiB (need ≥8GiB)."
exit 1
fi
echo "Partition plan:"
echo " Boot: ${BOOT_SIZE}"
@ -180,9 +186,9 @@ parted "$DRIVE" --script mklabel gpt \
mkpart ROOT 15GiB "$((15 + ROOT_GIB))"GiB \
mkpart SWAP "$((15 + ROOT_GIB))"GiB 100%
BOOT_PART="${DRIVE}1"
ROOT_PART="${DRIVE}2"
SWAP_PART="${DRIVE}3"
BOOT_PART=$(part "$DRIVE" 1)
ROOT_PART=$(part "$DRIVE" 2)
SWAP_PART=$(part "$DRIVE" 3)
############################################
# FORMAT BOOT + SWAP

View File

@ -6,6 +6,19 @@
set -euo pipefail
############################################
# LOGGING
############################################
LOGFILE="$HOME/archbaseos-guided-install.log"
{
echo
echo "############################################"
echo " Arch Guided Install Log - Started $(date)"
echo "############################################"
echo
} >> "$LOGFILE"
exec > >(tee -a "$LOGFILE") 2>&1
############################################
# Helper Functions
############################################
@ -27,6 +40,10 @@ pause() {
read -rp "Press ENTER to continue..."
}
# Returns the correct partition device for a given drive and partition number.
# NVMe and eMMC use a 'p' separator (e.g. /dev/nvme0n1p1), others don't.
part() { [[ "$1" == *nvme* || "$1" == *mmcblk* ]] && echo "${1}p${2}" || echo "${1}${2}"; }
############################################
# ANSWERFILE
############################################
@ -157,9 +174,9 @@ parted -s "$DRIVE" mklabel gpt \
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"
EFI_PART=$(part "$DRIVE" 1)
ROOT_PART=$(part "$DRIVE" 2)
SWAP_PART=$(part "$DRIVE" 3)
mkfs.fat -F32 "$EFI_PART"
mkswap "$SWAP_PART"
@ -359,7 +376,9 @@ if $AF_MODE && [[ -f /mnt/answerfile.json ]]; then
rm -f /mnt/answerfile.json
fi
echo "Installation complete!"
cp "$LOGFILE" /mnt/boot/ 2>/dev/null || true
echo "Installation complete! Log saved to /mnt/boot/$(basename "$LOGFILE")"
echo " umount -R /mnt && reboot"
if [[ "${_DO_TUI^^}" != "YES" ]]; then
echo