From 9a0e4acd16ba62de4037195f7da95e9250df3656 Mon Sep 17 00:00:00 2001 From: "Gerd v. Egidy" Date: Sun, 24 Jul 2022 23:11:11 +0200 Subject: [PATCH] deliver SystemRescue with an already initialized pacman key database Initializing the pacman key database during boot can take considerable time and there is no locking during this time against concurrent file access. This can lead to problems when installing packages soon after reboot. This also speeds up the boot process. Additional disk space requirement is about 1 MByte. Fixes #290 --- .../etc/systemd/system/etc-pacman.d-gnupg.mount | 8 -------- airootfs/etc/systemd/system/pacman-init.service | 13 ------------- airootfs/root/customize_airootfs.sh | 8 +++++++- build.sh | 3 +++ 4 files changed, 10 insertions(+), 22 deletions(-) delete mode 100644 airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount delete mode 100644 airootfs/etc/systemd/system/pacman-init.service diff --git a/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount b/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount deleted file mode 100644 index 4eab551..0000000 --- a/airootfs/etc/systemd/system/etc-pacman.d-gnupg.mount +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Temporary /etc/pacman.d/gnupg directory - -[Mount] -What=tmpfs -Where=/etc/pacman.d/gnupg -Type=tmpfs -Options=mode=0755 diff --git a/airootfs/etc/systemd/system/pacman-init.service b/airootfs/etc/systemd/system/pacman-init.service deleted file mode 100644 index b18f7f8..0000000 --- a/airootfs/etc/systemd/system/pacman-init.service +++ /dev/null @@ -1,13 +0,0 @@ -[Unit] -Description=Initializes Pacman keyring -Requires=etc-pacman.d-gnupg.mount -After=etc-pacman.d-gnupg.mount - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/usr/bin/pacman-key --init -ExecStart=/usr/bin/pacman-key --populate - -[Install] -WantedBy=multi-user.target diff --git a/airootfs/root/customize_airootfs.sh b/airootfs/root/customize_airootfs.sh index 0aa203e..35d039f 100755 --- a/airootfs/root/customize_airootfs.sh +++ b/airootfs/root/customize_airootfs.sh @@ -2,6 +2,8 @@ set -e -u +echo "customize_airootfs.sh started..." + sed -i 's/#\(en_US\.UTF-8\)/\1/' /etc/locale.gen locale-gen @@ -35,7 +37,6 @@ ln -sf /run/archiso/config/sysrescue-effective-config.json /etc/sysrescue/sysres systemctl enable NetworkManager.service systemctl enable iptables.service systemctl enable ip6tables.service -systemctl enable pacman-init.service systemctl enable choose-mirror.service systemctl enable sshd.service systemctl enable sysrescue-initialize.service @@ -53,6 +54,11 @@ systemctl mask updatedb.timer # ldconfig ("Rebuild Dynamic Linker Cache") unnecessarily slows down boot some time after the release systemctl mask ldconfig.service +# setup pacman signing key storage +/usr/bin/pacman-key --init +/usr/bin/pacman-key --populate +rm -f /etc/pacman.d/gnupg/*~ + # Provide additional commands (using busybox instead of binutils to save space) ln -sf /usr/bin/busybox /usr/local/bin/ar ln -sf /usr/bin/busybox /usr/local/bin/strings diff --git a/build.sh b/build.sh index cadaa03..5b3ab73 100755 --- a/build.sh +++ b/build.sh @@ -225,6 +225,9 @@ make_customize_airootfs() { setarch ${arch} mkarchiso ${verbose} -w "${work_dir}/${arch}" -C "${work_dir}/pacman.conf" -D "${install_dir}" -r '/root/customize_airootfs.sh' run + # unmount chroot /dev again as it could have been busy before due to gpg-agent + umount ${work_dir}/${arch}/airootfs/dev + rm -f ${work_dir}/${arch}/airootfs/root/customize_airootfs.sh # change pacman config in airootfs to use snapshot repo by default