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
This commit is contained in:
Gerd v. Egidy 2022-07-24 23:11:11 +02:00
parent d094639e5c
commit 9a0e4acd16
4 changed files with 10 additions and 22 deletions

View file

@ -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

View file

@ -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

View file

@ -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

View file

@ -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