Add trap, fix systemd-firstboot

This commit is contained in:
2026-07-01 18:48:12 +02:00
parent 50d6096e99
commit 52a5b63ad4
+17 -3
View File
@@ -6,6 +6,14 @@ set -euo pipefail
exec >> >(tee -i /tmp/install.log) exec >> >(tee -i /tmp/install.log)
exec 2>&1 exec 2>&1
function cleanup() {
umount /mnt/boot
umount /mnt/home
umount /mnt
cryptsetup close /dev/mapper/main
}
trap cleanup EXIT
clear clear
# Friendly introduction # Friendly introduction
@@ -333,12 +341,18 @@ arch-chroot "/mnt" hwclock --systohc # Set the Hardware Clock to the current Sy
# Set keymap, locale, timezone and hostname # Set keymap, locale, timezone and hostname
# https://wiki.archlinux.org/title/Systemd-firstboot # https://wiki.archlinux.org/title/Systemd-firstboot
rm /etc/{machine-id,localtime,hostname,shadow,locale.conf} service_dir="/mnt/etc/systemd/system/systemd-firstboot.service.d"
mkdir "${service_dir}"
cat << EOF > /etc/systemd/system/systemd-firstboot.service.d/install.conf rootdir="/mnt"
keymap="de-latin1-nodeadkeys"
locale="en_US.UTF-8"
timezone="Europe/Berlin"
cat << EOF > "${service_dir}/install.conf"
[Service] [Service]
ExecStart= ExecStart=
ExecStart=/usr/bin/systemd-firstboot --root=/mnt --keymap=de-latin1-nodeadkeys --locale=en_US.UTF-8 --timezone=Europe/Berlin --hostname="${host}" ExecStart=/usr/bin/systemd-firstboot --root="${rootdir}" --keymap="${keymap}" --locale="${locale}" --timezone="${timezone}" --hostname="${host}"
[Install] [Install]
WantedBy=sysinit.target WantedBy=sysinit.target