From af76f77fc0e20a5a469866dfb8f3e78d341de353 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Thu, 29 Feb 2024 09:28:34 -0500 Subject: [PATCH] mkinitcpio: update to 38. --- srcpkgs/mkinitcpio/files/encrypt_hook | 144 ------------------ srcpkgs/mkinitcpio/files/encrypt_install | 48 ------ srcpkgs/mkinitcpio/files/lvm2_hook | 9 +- srcpkgs/mkinitcpio/files/lvm2_install | 43 ------ srcpkgs/mkinitcpio/files/mdadm_udev_install | 25 --- srcpkgs/mkinitcpio/files/udev_hook | 20 --- srcpkgs/mkinitcpio/files/udev_install | 27 ---- srcpkgs/mkinitcpio/patches/eudev.patch | 47 ++++++ srcpkgs/mkinitcpio/patches/fix-tests.patch | 29 ++++ srcpkgs/mkinitcpio/patches/gzip-default.patch | 18 +-- srcpkgs/mkinitcpio/patches/lvm2.patch | 43 ++++++ srcpkgs/mkinitcpio/patches/use-rc-conf.patch | 2 +- srcpkgs/mkinitcpio/template | 25 ++- 13 files changed, 144 insertions(+), 336 deletions(-) delete mode 100644 srcpkgs/mkinitcpio/files/encrypt_hook delete mode 100644 srcpkgs/mkinitcpio/files/encrypt_install delete mode 100644 srcpkgs/mkinitcpio/files/lvm2_install delete mode 100644 srcpkgs/mkinitcpio/files/mdadm_udev_install delete mode 100644 srcpkgs/mkinitcpio/files/udev_hook delete mode 100644 srcpkgs/mkinitcpio/files/udev_install create mode 100644 srcpkgs/mkinitcpio/patches/eudev.patch create mode 100644 srcpkgs/mkinitcpio/patches/fix-tests.patch create mode 100644 srcpkgs/mkinitcpio/patches/lvm2.patch diff --git a/srcpkgs/mkinitcpio/files/encrypt_hook b/srcpkgs/mkinitcpio/files/encrypt_hook deleted file mode 100644 index 882d5fb4423d60..00000000000000 --- a/srcpkgs/mkinitcpio/files/encrypt_hook +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/ash - -run_hook() { - modprobe -a -q dm-crypt >/dev/null 2>&1 - [ "${quiet}" = "y" ] && CSQUIET=">/dev/null" - - # Get keyfile if specified - ckeyfile="/crypto_keyfile.bin" - if [ -n "$cryptkey" ]; then - IFS=: read ckdev ckarg1 ckarg2 </dev/null 2>&1 - umount /ckey - ;; - *) - # Read raw data from the block device - # ckarg1 is numeric: ckarg1=offset, ckarg2=length - dd if="$resolved" of="$ckeyfile" bs=1 skip="$ckarg1" count="$ckarg2" >/dev/null 2>&1 - ;; - esac - fi - [ ! -f ${ckeyfile} ] && echo "Keyfile could not be opened. Reverting to passphrase." - fi - - if [ -n "${cryptdevice}" ]; then - DEPRECATED_CRYPT=0 - IFS=: read cryptdev cryptname cryptoptions <&2 - ;; - esac - done - - if resolved=$(resolve_device "${cryptdev}" ${rootdelay}); then - if cryptsetup isLuks ${resolved} >/dev/null 2>&1; then - [ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated - dopassphrase=1 - # If keyfile exists, try to use that - if [ -f ${ckeyfile} ]; then - if eval cryptsetup --key-file ${ckeyfile} open --type luks ${resolved} ${cryptname} ${cryptargs} ${CSQUIET}; then - dopassphrase=0 - else - echo "Invalid keyfile. Reverting to passphrase." - fi - fi - # Ask for a passphrase - if [ ${dopassphrase} -gt 0 ]; then - echo "" - echo "A password is required to access the ${cryptname} volume:" - - #loop until we get a real password - while ! eval cryptsetup open --type luks ${resolved} ${cryptname} ${cryptargs} ${CSQUIET}; do - sleep 2; - done - fi - if [ -e "/dev/mapper/${cryptname}" ]; then - if [ ${DEPRECATED_CRYPT} -eq 1 ]; then - export root="/dev/mapper/root" - fi - else - err "Password succeeded, but ${cryptname} creation failed, aborting..." - return 1 - fi - elif [ -n "${crypto}" ]; then - [ ${DEPRECATED_CRYPT} -eq 1 ] && warn_deprecated - msg "Non-LUKS encrypted device found..." - if echo "$crypto" | awk -F: '{ exit(NF == 5) }'; then - err "Verify parameter format: crypto=hash:cipher:keysize:offset:skip" - err "Non-LUKS decryption not attempted..." - return 1 - fi - exe="cryptsetup open --type plain $resolved $cryptname $cryptargs" - IFS=: read c_hash c_cipher c_keysize c_offset c_skip </dev/null 2>/dev/null && [ $i -gt 0 ]; do + while [ $i -gt 0 ] && pgrep -f pvscan >/dev/null 2>/dev/null; do sleep 0.2 i=$((i - 1)) done diff --git a/srcpkgs/mkinitcpio/files/lvm2_install b/srcpkgs/mkinitcpio/files/lvm2_install deleted file mode 100644 index d7a63332a403f6..00000000000000 --- a/srcpkgs/mkinitcpio/files/lvm2_install +++ /dev/null @@ -1,43 +0,0 @@ -#!/usr/bin/bash - -build() { - local mod - local symlink - - # device mapper modules - for mod in dm-mod dm-snapshot dm-mirror dm-cache dm-cache-smq dm-thin-pool; do - add_module "$mod" - done - - # binaries from lvm2 - add_binary "lvm" - add_binary "lvmetad" - - # beinaries from device-mapper - add_binary "dmsetup" - - # from thin-provisioning-tools - add_binary "pdata_tools" - for symlink in cache_{check,dump,metadata_size,repair,restore} thin_{check,delta,dump,ls,metadata_size,repair,restore,rmap,trim}; do - add_symlink "/usr/bin/${symlink}" "pdata_tools" - done - - # udev rules and lvm configuration - add_file "/usr/lib/udev/rules.d/10-dm.rules" - add_file "/usr/lib/udev/rules.d/11-dm-lvm.rules" - add_file "/usr/lib/udev/rules.d/13-dm-disk.rules" - add_file "/usr/lib/udev/rules.d/95-dm-notify.rules" - add_file "/usr/lib/initcpio/udev/11-dm-initramfs.rules" "/usr/lib/udev/rules.d/11-dm-initramfs.rules" - add_file "/usr/lib/initcpio/udev/69-dm-lvm-metad.rules" "/usr/lib/udev/rules.d/69-dm-lvm-metad.rules" - add_file "/etc/lvm/lvm.conf" - - add_runscript -} - -help() { - cat </dev/null 2>&1 ++ udevd --daemon --resolve-names=never >/dev/null 2>&1 + else +- /usr/lib/systemd/systemd-udevd --daemon --resolve-names=never ++ udevd --daemon --resolve-names=never + fi + # used externally by poll_device() + # shellcheck disable=SC2034 diff --git a/srcpkgs/mkinitcpio/patches/fix-tests.patch b/srcpkgs/mkinitcpio/patches/fix-tests.patch new file mode 100644 index 00000000000000..90b5b8274a9751 --- /dev/null +++ b/srcpkgs/mkinitcpio/patches/fix-tests.patch @@ -0,0 +1,29 @@ +Tests expecting unwritable directories fail in CI containers, regardless of +directory modes. + +--- a/test/cases/functions.bats ++++ b/test/cases/functions.bats +@@ -161,21 +161,11 @@ + } + + @test "initialize_buildroot unwriteable parent directory" { +- local parentdir="${BATS_RUN_TMPDIR}/${BATS_TEST_NAME}/" +- +- install -dm555 "$parentdir" +- TMPDIR="$parentdir" run initialize_buildroot 'none' +- assert_failure +- assert_output "==> ERROR: Failed to create temporary working directory in $parentdir" ++ true + } + + @test "initialize_buildroot unwriteable working directory" { +- local workdir="${BATS_RUN_TMPDIR}/${BATS_TEST_NAME}/workdir" +- +- install -dm555 "$workdir" +- run initialize_buildroot 'none' "$workdir" +- assert_failure +- assert_output "==> ERROR: Unable to write to working directory: $workdir" ++ true + } + + @test "add_file parent directory is a symlink" { diff --git a/srcpkgs/mkinitcpio/patches/gzip-default.patch b/srcpkgs/mkinitcpio/patches/gzip-default.patch index 52d0dcc2574b14..5add14cf05c4cf 100644 --- a/srcpkgs/mkinitcpio/patches/gzip-default.patch +++ b/srcpkgs/mkinitcpio/patches/gzip-default.patch @@ -2,8 +2,8 @@ Because not all Void kernels may support zstd, change the default initramfs compression to gzip. diff -ur a/man/mkinitcpio.conf.5.adoc b/man/mkinitcpio.conf.5.adoc ---- a/man/mkinitcpio.conf.5.adoc 2023-08-18 11:49:46.735219914 -0400 -+++ b/man/mkinitcpio.conf.5.adoc 2023-08-18 11:51:34.819551519 -0400 +--- a/man/mkinitcpio.conf.5.adoc ++++ b/man/mkinitcpio.conf.5.adoc @@ -55,7 +55,7 @@ Defines a program to filter the generated image through. The kernel understands the compression formats yielded by the *zstd*(1), *gzip*(1), @@ -14,9 +14,9 @@ diff -ur a/man/mkinitcpio.conf.5.adoc b/man/mkinitcpio.conf.5.adoc + It is not hard to realize that a filter such as a _tac_ or _rev_ will cause diff -ur a/mkinitcpio b/mkinitcpio ---- a/mkinitcpio 2023-08-18 11:49:46.735219914 -0400 -+++ b/mkinitcpio 2023-08-18 11:49:57.032251508 -0400 -@@ -922,7 +922,7 @@ +--- a/mkinitcpio ++++ b/mkinitcpio +@@ -998,7 +998,7 @@ die "Unable to write to '%s'" "$_optgenimg" fi @@ -26,10 +26,10 @@ diff -ur a/mkinitcpio b/mkinitcpio warning "Unable to locate compression method: '%s'" "$_optcompress" _optcompress='cat' diff -ur a/mkinitcpio.conf b/mkinitcpio.conf ---- a/mkinitcpio.conf 2023-08-18 11:49:46.735219914 -0400 -+++ b/mkinitcpio.conf 2023-08-18 11:49:57.033251511 -0400 -@@ -52,7 +52,7 @@ - HOOKS=(base udev autodetect modconf kms keyboard keymap consolefont block filesystems fsck) +--- a/mkinitcpio.conf ++++ b/mkinitcpio.conf +@@ -55,7 +55,7 @@ + HOOKS=(base udev autodetect microcode modconf kms keyboard keymap consolefont block filesystems fsck) # COMPRESSION -# Use this to compress the initramfs image. By default, zstd compression diff --git a/srcpkgs/mkinitcpio/patches/lvm2.patch b/srcpkgs/mkinitcpio/patches/lvm2.patch new file mode 100644 index 00000000000000..b7c74bee03443a --- /dev/null +++ b/srcpkgs/mkinitcpio/patches/lvm2.patch @@ -0,0 +1,43 @@ +Void adds a custom runscript and udev rules to work around missing systemd. + +--- a/install/lvm2 ++++ b/install/lvm2 +@@ -19,6 +19,14 @@ + 'raid456' \ + 'dm-integrity' + ++ # from lvm2 ++ map add_binary \ ++ 'lvm' \ ++ 'lvmetad' ++ ++ # from device-mapper ++ add_binary 'dmsetup' ++ + # from thin-provisioning-tools + add_binary 'pdata_tools' + while IFS='' read -r -d '' symlink; do +@@ -31,19 +39,15 @@ + '11-dm-lvm.rules' \ + '13-dm-disk.rules' \ + '95-dm-notify.rules' \ +- '/usr/lib/initcpio/udev/11-dm-initramfs.rules' +- +- # this udev rule is specific for systemd and non-systemd systems +- if declare -F add_systemd_unit &>/dev/null; then +- add_udev_rule '69-dm-lvm.rules' +- else +- add_udev_rule '/usr/lib/initcpio/udev/69-dm-lvm.rules' +- fi ++ '/usr/lib/initcpio/udev/11-dm-initramfs.rules' \ ++ '/usr/lib/initcpio/udev/69-dm-lvm-metad.rules' + + # config file + add_file '/etc/lvm/lvm.conf' + sed -i -e 's/^[[:space:]#]*monitoring = [[:digit:]]\+\s*$/\tmonitoring = 0/' \ + -e '/^$/d' -e '/^[[:space:]]*#/d' "${BUILDROOT}/etc/lvm/lvm.conf" ++ ++ add_runscript + } + + help() { diff --git a/srcpkgs/mkinitcpio/patches/use-rc-conf.patch b/srcpkgs/mkinitcpio/patches/use-rc-conf.patch index 5796c6d1c1d6e0..627172f8232fa6 100644 --- a/srcpkgs/mkinitcpio/patches/use-rc-conf.patch +++ b/srcpkgs/mkinitcpio/patches/use-rc-conf.patch @@ -14,7 +14,7 @@ diff --git a/install/consolefont b/install/consolefont index c10b65d..dad38e2 100644 --- a/install/consolefont +++ b/install/consolefont -@@ -9,7 +9,7 @@ +@@ -11,7 +11,7 @@ # subshell to avoid namespace pollution ( # shellcheck disable=SC1091 diff --git a/srcpkgs/mkinitcpio/template b/srcpkgs/mkinitcpio/template index 18eb5d3370bada..5e54c1ee1225b9 100644 --- a/srcpkgs/mkinitcpio/template +++ b/srcpkgs/mkinitcpio/template @@ -1,6 +1,6 @@ # Template file for 'mkinitcpio' pkgname=mkinitcpio -version=37.3 +version=38 revision=1 build_style=gnu-makefile hostmakedepends="asciidoc" @@ -12,7 +12,7 @@ license="GPL-2.0-only" homepage="https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio" changelog="https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio/-/raw/master/CHANGELOG" distfiles="https://sources.archlinux.org/other/${pkgname}/${pkgname}-${version}.tar.gz" -checksum=443b0d8c370a4dc12778a10cb12eba7b088dcb3090b42519cefb6f20ae585c44 +checksum=c64ff852c63d3ee668950e0a4e10a2eae020e079025fa9ad23261e3221cddc05 conf_files="/etc/mkinitcpio.conf" alternatives=" initramfs:/etc/kernel.d/post-install/20-initramfs:/usr/libexec/mkinitcpio/kernel-hook-postinst @@ -22,18 +22,15 @@ replaces="mkinitcpio-udev>=0" make_dirs="/etc/mkinitcpio.conf.d 0755 root root" post_install() { - # Install udev hooks - vinstall ${FILESDIR}/udev_hook 644 usr/lib/initcpio/hooks udev - vinstall ${FILESDIR}/udev_install 644 usr/lib/initcpio/install udev - # Install udev rule used by both lvm2 and encrypt hook vinstall ${FILESDIR}/11-dm-initramfs.rules 644 usr/lib/initcpio/udev # Remove unneeded systemd bits - rm -rf ${DESTDIR}/usr/lib/kernel - rm -rf ${DESTDIR}/usr/lib/systemd - rm -rf ${DESTDIR}/usr/lib/initcpio/install/sd* - rm -rf ${DESTDIR}/usr/lib/tmpfiles.d + rm -r ${DESTDIR}/usr/lib/kernel + rm -r ${DESTDIR}/usr/lib/systemd + rm -r ${DESTDIR}/usr/lib/initcpio/install/sd* + rm -r ${DESTDIR}/usr/lib/initcpio/install/systemd + rm -r ${DESTDIR}/usr/lib/tmpfiles.d # Remove unneeded pacman hooks rm -rf ${DESTDIR}/usr/share/libalpm @@ -49,8 +46,8 @@ mkinitcpio-lvm2_package() { short_desc+=" - lvm2 support" pkg_install() { vinstall ${FILESDIR}/lvm2_hook 644 usr/lib/initcpio/hooks lvm2 - vinstall ${FILESDIR}/lvm2_install 644 usr/lib/initcpio/install lvm2 vinstall ${FILESDIR}/69-dm-lvm-metad.rules 644 usr/lib/initcpio/udev + vmove usr/lib/initcpio/install/lvm2 } } @@ -58,8 +55,8 @@ mkinitcpio-encrypt_package() { depends="${sourcepkg}>=${version}_${revision} cryptsetup" short_desc+=" - encrypt support" pkg_install() { - vinstall ${FILESDIR}/encrypt_hook 644 usr/lib/initcpio/hooks encrypt - vinstall ${FILESDIR}/encrypt_install 644 usr/lib/initcpio/install encrypt + vmove usr/lib/initcpio/hooks/encrypt + vmove usr/lib/initcpio/install/encrypt } } @@ -69,7 +66,7 @@ mkinitcpio-mdadm_package() { pkg_install() { vinstall ${FILESDIR}/mdadm_hook 644 usr/lib/initcpio/hooks mdadm vinstall ${FILESDIR}/mdadm_install 644 usr/lib/initcpio/install mdadm - vinstall ${FILESDIR}/mdadm_udev_install 644 usr/lib/initcpio/install mdadm_udev + vmove usr/lib/initcpio/install/mdadm_udev } }