From ff5f303619eade1089cb22a3acbd6584facad414 Mon Sep 17 00:00:00 2001 From: Shulhan Date: Sun, 3 Jul 2022 02:59:01 +0700 Subject: all: use predefined files to configure mkinitcpio Using this method simplify maintenance on the build script and give flexibility to custom image builder. While at it, we add "udev autodetect block filesystems keyboard" into the HOOKS to allow testing the image using qemu and "fsck" to allow system run disk check on boot. --- build-arch-gce | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) (limited to 'build-arch-gce') diff --git a/build-arch-gce b/build-arch-gce index 1432439..ececc62 100755 --- a/build-arch-gce +++ b/build-arch-gce @@ -117,6 +117,10 @@ cp ./sys/etc/ssh/sshd_config $mount_dir/etc/ssh/ echo '-- Creating pacman-init service.' cp ./sys/etc/systemd/system/pacman-init.service $mount_dir/etc/systemd/system/ +echo '-- Configuring initcpio.' +cp ./sys/etc/mkinitcpio.conf $mount_dir/etc/ +cp ./sys/etc/mkinitcpio.d/linux.preset $mount_dir/etc/mkinitcpio.d/ + arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS' set -eEuo pipefail trap 'echo "Error: \`$BASH_COMMAND\` exited with status $?"' ERR @@ -156,16 +160,7 @@ arch-chroot -- "$mount_dir" /bin/bash -s <<-'EOS' echo '-- Enabling other services.' systemctl --quiet enable dhclient@eth0.service - echo '-- Configuring initcpio.' - gawk -i assert -i inplace ' - /^MODULES=/ { $0 = "MODULES=(virtio_pci virtio_scsi sd_mod ext4)"; ++f1 } - /^BINARIES=/ { $0 = "BINARIES=(fsck fsck.ext4)"; ++f2 } - /^HOOKS=/ { $0 = "HOOKS=(systemd modconf)"; ++f3 } - { print } END { assert(f1 * f2 * f3 == 1, "f == 1") }' /etc/mkinitcpio.conf - gawk -i assert -i inplace ' - /^PRESETS=/ { $0 = "PRESETS=(default)"; ++f } - /#?fallback_/ { next } - { print } END { assert(f == 1, "f == 1") }' /etc/mkinitcpio.d/linux.preset + echo '-- Running mkinitcpio.' rm /boot/initramfs-linux-fallback.img mkinitcpio --nocolor --preset linux -- cgit v1.3