diff options
| author | Shulhan <ms@kilabit.info> | 2022-07-03 02:59:01 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-07-25 19:29:22 +0700 |
| commit | ff5f303619eade1089cb22a3acbd6584facad414 (patch) | |
| tree | 0bcf099c5868ab5d5a48496d0aab427a8e8e7597 /build-arch-gce | |
| parent | 9f8819d2a7682da47da16e0f13860e6026e273bd (diff) | |
| download | compute-archlinux-image-builder-ff5f303619eade1089cb22a3acbd6584facad414.tar.xz | |
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.
Diffstat (limited to 'build-arch-gce')
| -rwxr-xr-x | build-arch-gce | 15 |
1 files changed, 5 insertions, 10 deletions
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 |
