setup: add archiso profile and run tui-install inside chroot

- Add setup/archiso/ with build.sh, releng overlay, motd, and
  install-arch launcher command for the live ISO
- Fix cryptroot mapper name in arch-autoinstall.sh (was 'root',
  breaking all subsequent mounts)
- Add base-devel to pacstrap in both installers (required for yay/makepkg)
- Clone dotfiles inside chroot so tui-install.sh is available immediately
- After base install, offer to run tui-install.sh as the regular user
  inside the chroot via runuser, with a temporary NOPASSWD sudoers rule;
  skip option available for base-only installs

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
main
The_miro 2026-05-12 13:46:49 +02:00
parent b4e93af5fb
commit a56d27888c
8 changed files with 172 additions and 4 deletions

View File

@ -82,7 +82,7 @@ read -rp "Enable FIDO2 unlocking for root partition? (YES/NO): " FIDO_ROOT
############################################ ############################################
echo "Encrypting root partition..." echo "Encrypting root partition..."
cryptsetup -v luksFormat "$ROOT_PART" cryptsetup -v luksFormat "$ROOT_PART"
cryptsetup open "$ROOT_PART" root cryptsetup open "$ROOT_PART" cryptroot
############################################ ############################################
# OPTIONAL FIDO2 ENROLLMENT # OPTIONAL FIDO2 ENROLLMENT
@ -135,7 +135,7 @@ read -rp "Enable FIDO2 authentication for user login? (YES/NO): " FIDO_USER
############################################ ############################################
# BASE INSTALL # BASE INSTALL
############################################ ############################################
pacstrap -K /mnt base "$KERNEL" linux-firmware vim bash zsh git less btop fastfetch \ pacstrap -K /mnt base base-devel "$KERNEL" linux-firmware vim bash zsh git less btop fastfetch \
networkmanager grub cryptsetup libfido2 pam-u2f efibootmgr sudo btrfs-progs lvm2 $GPU_PKGS networkmanager grub cryptsetup libfido2 pam-u2f efibootmgr sudo btrfs-progs lvm2 $GPU_PKGS
############################################ ############################################
@ -211,8 +211,36 @@ if [[ "$FIDO_USER" == "YES" ]]; then
echo "auth required pam_u2f.so" >> /etc/pam.d/system-local-login echo "auth required pam_u2f.so" >> /etc/pam.d/system-local-login
fi fi
###################################################
# CLONE DOTFILES FOR POST-INSTALL SETUP
###################################################
echo "Cloning dotfiles..."
git clone https://git.abdelbaki.eu/The_miro/Dotfiles.git /home/$USERNAME/Dotfiles \
&& chown -R $USERNAME:$USERNAME /home/$USERNAME/Dotfiles \
|| echo "Warning: dotfiles clone failed — clone manually after first boot."
EOF EOF
############################################
# DOTFILES SETUP (in-chroot, optional)
############################################
echo
read -rp "Run dotfiles TUI setup inside chroot now? [YES/no]: " _RUN_TUI
_RUN_TUI="${_RUN_TUI:-YES}"
if [[ "${_RUN_TUI^^}" == "YES" ]]; then
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" \
| arch-chroot /mnt tee /etc/sudoers.d/99-setup-nopasswd > /dev/null
echo "Running tui-install.sh as ${USERNAME} inside chroot..."
arch-chroot /mnt runuser -u "${USERNAME}" -- \
bash "/home/${USERNAME}/Dotfiles/setup/tui-install.sh" \
|| echo "Warning: tui-install exited with errors — check ~/dotfiles-install.log in the new system."
arch-chroot /mnt rm -f /etc/sudoers.d/99-setup-nopasswd
fi
############################################ ############################################
# SUMMARY OUTPUT (NEW) # SUMMARY OUTPUT (NEW)
############################################ ############################################
@ -247,4 +275,9 @@ cp $LOGFILE /mnt/boot/
# DONE # DONE
############################################ ############################################
echo "Installation complete! You can now unmount and reboot." echo "Installation complete! You can now unmount and reboot."
echo
if [[ "${_RUN_TUI^^}" != "YES" ]]; then
echo "After first boot, login as $USERNAME and run:"
echo " ~/Dotfiles/setup/tui-install.sh"
fi

View File

@ -130,7 +130,7 @@ read -rsp "Password for $USERNAME: " USERPASS; echo
read -rp "Enable FIDO2 for user login? (YES/NO): " ENABLE_FIDO_USER read -rp "Enable FIDO2 for user login? (YES/NO): " ENABLE_FIDO_USER
pacstrap /mnt \ pacstrap /mnt \
base "$KERNEL" linux-firmware vim zsh git networkmanager grub efibootmgr \ base base-devel "$KERNEL" linux-firmware vim zsh git networkmanager grub efibootmgr \
btrfs-progs cryptsetup libfido2 pam-u2f sudo "$GPU_PKGS" btrfs-progs cryptsetup libfido2 pam-u2f sudo "$GPU_PKGS"
genfstab -U /mnt >> /mnt/etc/fstab genfstab -U /mnt >> /mnt/etc/fstab
@ -196,7 +196,37 @@ if [[ "$ENABLE_FIDO_USER" == "YES" ]]; then
sudo -u "$USERNAME" bash -c "pamu2fcfg >> /home/$USERNAME/.config/Yubico/u2f_keys" sudo -u "$USERNAME" bash -c "pamu2fcfg >> /home/$USERNAME/.config/Yubico/u2f_keys"
echo "auth required pam_u2f.so" >> /etc/pam.d/system-auth echo "auth required pam_u2f.so" >> /etc/pam.d/system-auth
fi fi
echo "Cloning dotfiles..."
git clone https://git.abdelbaki.eu/The_miro/Dotfiles.git /home/$USERNAME/Dotfiles \
&& chown -R $USERNAME:$USERNAME /home/$USERNAME/Dotfiles \
|| echo "Warning: dotfiles clone failed — clone manually after first boot."
EOF EOF
############################################
# DOTFILES SETUP (in-chroot, optional)
############################################
echo
read -rp "Run dotfiles TUI setup inside chroot now? [YES/no]: " _RUN_TUI
_RUN_TUI="${_RUN_TUI:-YES}"
if [[ "${_RUN_TUI^^}" == "YES" ]]; then
echo "${USERNAME} ALL=(ALL) NOPASSWD: ALL" \
| arch-chroot /mnt tee /etc/sudoers.d/99-setup-nopasswd > /dev/null
echo "Running tui-install.sh as ${USERNAME} inside chroot..."
arch-chroot /mnt runuser -u "${USERNAME}" -- \
bash "/home/${USERNAME}/Dotfiles/setup/tui-install.sh" \
|| echo "Warning: tui-install exited with errors — check ~/dotfiles-install.log in the new system."
arch-chroot /mnt rm -f /etc/sudoers.d/99-setup-nopasswd
fi
echo "Installation complete!" echo "Installation complete!"
echo "Run: umount -R /mnt && reboot" echo " umount -R /mnt && reboot"
if [[ "${_RUN_TUI^^}" != "YES" ]]; then
echo
echo "After first boot, login as ${USERNAME} and run:"
echo " ~/Dotfiles/setup/tui-install.sh"
fi

51
setup/archiso/build.sh Normal file
View File

@ -0,0 +1,51 @@
#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
DOTFILES_DIR="$(cd "$SCRIPT_DIR/../.." && pwd)"
WORK_DIR="/tmp/m-archy-build"
OUT_DIR="${1:-/tmp/m-archy-out}"
PROFILE="$WORK_DIR/profile"
RELENG="/usr/share/archiso/configs/releng"
if ! command -v mkarchiso &>/dev/null; then
echo "Installing archiso..."
sudo pacman -S --noconfirm archiso
fi
[[ -d "$RELENG" ]] || { echo "ERROR: $RELENG not found — is archiso installed?"; exit 1; }
rm -rf "$WORK_DIR"
mkdir -p "$WORK_DIR" "$OUT_DIR"
echo "Copying releng base profile..."
cp -r "$RELENG" "$PROFILE"
echo "Applying M-Archy overlay..."
cp -r "$SCRIPT_DIR/overlay/airootfs/." "$PROFILE/airootfs/"
echo "Replacing profiledef..."
cp "$SCRIPT_DIR/overlay/profiledef.sh" "$PROFILE/profiledef.sh"
echo "Adding extra packages..."
while IFS= read -r pkg || [[ -n "$pkg" ]]; do
[[ -z "$pkg" || "$pkg" == \#* ]] && continue
grep -qxF "$pkg" "$PROFILE/packages.x86_64" || echo "$pkg" >> "$PROFILE/packages.x86_64"
done < "$SCRIPT_DIR/overlay/packages.extra"
echo "Embedding installer scripts..."
mkdir -p "$PROFILE/airootfs/root/installer"
cp "$DOTFILES_DIR/setup/archbaseos-guided-install.sh" "$PROFILE/airootfs/root/installer/"
cp "$DOTFILES_DIR/setup/arch-autoinstall.sh" "$PROFILE/airootfs/root/installer/"
chmod 755 \
"$PROFILE/airootfs/root/launch.sh" \
"$PROFILE/airootfs/usr/local/bin/install-arch" \
"$PROFILE/airootfs/root/installer/"*.sh
echo "Building ISO (this may take a while)..."
sudo mkarchiso -v -w "$WORK_DIR/mkarchiso" -o "$OUT_DIR" "$PROFILE"
echo
echo "Done."
ls -lh "$OUT_DIR/"*.iso 2>/dev/null || true

View File

@ -0,0 +1,14 @@
+-----------------------------------------------------+
| M-Archy -- Arch Linux Installer ISO |
| by The_miro |
+-----------------------------------------------------+
Commands:
install-arch guided installer (recommended)
install-arch auto automated installer (no prompts)
Scripts are also at: ~/installer/
Dotfiles: https://git.abdelbaki.eu/The_miro/Dotfiles

View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail
INSTALLER_DIR="$HOME/installer"
case "${1:-guided}" in
auto) exec bash "$INSTALLER_DIR/arch-autoinstall.sh" ;;
guided) exec bash "$INSTALLER_DIR/archbaseos-guided-install.sh" ;;
*) exec bash "$INSTALLER_DIR/archbaseos-guided-install.sh" ;;
esac

View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
exec /root/launch.sh "$@"

View File

@ -0,0 +1,6 @@
# Extra packages on top of releng for M-Archy installer
git
jq
pam-u2f
btop
fastfetch

View File

@ -0,0 +1,24 @@
#!/usr/bin/env bash
# M-Archy archiso profile — based on releng
iso_name="m-archy"
iso_label="M_ARCHY_$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y%m)"
iso_publisher="The_miro <https://git.abdelbaki.eu/The_miro/Dotfiles>"
iso_application="M-Archy Arch Linux Installer"
iso_version="$(date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" +%Y.%m.%d)"
install_dir="arch"
buildmodes=('iso')
bootmodes=('bios.syslinux.mbr' 'bios.syslinux.eltorito' 'uefi-ia32.grub.esp' 'uefi-x64.systemd-boot.esp' 'uefi-x64.systemd-boot.eltorito')
arch="x86_64"
pacman_conf="pacman.conf"
airootfs_image_type="squashfs"
airootfs_image_tool_options=('-comp' 'zstd' '-Xcompression-level' '15')
bootstrap_tarball_compression=('zstd' '-c' '-T0' '--auto-threads=logical' '--long' '-19')
file_permissions=(
["/etc/shadow"]="0:0:400"
["/root"]="0:0:750"
["/root/.automated_script.sh"]="0:0:755"
["/root/launch.sh"]="0:0:755"
["/root/installer/archbaseos-guided-install.sh"]="0:0:755"
["/root/installer/arch-autoinstall.sh"]="0:0:755"
["/usr/local/bin/install-arch"]="0:0:755"
)