From e4164a9f365ec3b21b707ce80f3ef80fc2c827a8 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 5 Aug 2020 12:13:08 -0400 Subject: [PATCH 1/7] base-files: improve consistency of relative paths in kernel hooks --- srcpkgs/base-files/files/vkpurge | 4 +++- srcpkgs/base-files/template | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/srcpkgs/base-files/files/vkpurge b/srcpkgs/base-files/files/vkpurge index 92098ec736e..5519147b905 100644 --- a/srcpkgs/base-files/files/vkpurge +++ b/srcpkgs/base-files/files/vkpurge @@ -39,10 +39,12 @@ list_kernels() { run_hooks() { dir="$1" kver="$2" + for d in /etc/kernel.d/"${dir}"/*; do [ -x "$d" ] || continue printf "Running %s kernel hook: %s...\n" "$dir" "${d##*/}" - "$d" kernel "$kver" + # Hooks assume they run from the root + (cd / && ROOTDIR=. "$d" kernel "$kver") done } diff --git a/srcpkgs/base-files/template b/srcpkgs/base-files/template index d608bc81f57..6b503690606 100644 --- a/srcpkgs/base-files/template +++ b/srcpkgs/base-files/template @@ -1,7 +1,7 @@ # Template file for 'base-files' pkgname=base-files version=0.141 -revision=1 +revision=2 bootstrap=yes depends="xbps-triggers" short_desc="Void Linux base system files" From 0b70e31d1b4c11572b61e5c2f030bf3678ec1af1 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 5 Aug 2020 12:13:08 -0400 Subject: [PATCH 2/7] dkms: improve consistency of relative paths in kernel hooks --- srcpkgs/dkms/files/kernel.d/dkms.postinst | 34 ++++++++++++----------- srcpkgs/dkms/files/kernel.d/dkms.prerm | 6 ++-- srcpkgs/dkms/template | 2 +- 3 files changed, 22 insertions(+), 20 deletions(-) diff --git a/srcpkgs/dkms/files/kernel.d/dkms.postinst b/srcpkgs/dkms/files/kernel.d/dkms.postinst index 5cfc630de1c..ef2a10bac28 100644 --- a/srcpkgs/dkms/files/kernel.d/dkms.postinst +++ b/srcpkgs/dkms/files/kernel.d/dkms.postinst @@ -8,7 +8,7 @@ PKGNAME="$1" VERSION="$2" ARCH=$(uname -m) -if [ ! -x /usr/sbin/dkms ]; then +if [ ! -x /usr/bin/dkms ]; then exit 0 fi @@ -59,16 +59,16 @@ while [ $# -gt 1 ]; do # If adding a module, depmod is necessary unless dkms runs it do_depmod="yes" - status=$(dkms status -m ${module} -v ${modulever} -k ${VERSION}) + status=$(/usr/bin/dkms status -m ${module} -v ${modulever} -k ${VERSION}) if [ $(echo "$status"|grep -c ": built") -eq 0 ]; then # Check if the module is still there. - if [ ! -f usr/src/${module}-${modulever}/dkms.conf ]; then + if [ ! -f /usr/src/${module}-${modulever}/dkms.conf ]; then echo "Skipping nonexistent DKMS module: ${module}-${modulever}." continue fi # Build the module echo -n "Building DKMS module: ${module}-${modulever}... " - dkms build -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH} + /usr/bin/dkms build -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH} rval=$? # If the module was skipped or failed, go to the next module. if [ $rval -eq 0 ]; then @@ -80,14 +80,14 @@ while [ $# -gt 1 ]; do echo "FAILED!" continue fi - status=$(dkms status -m ${module} -v ${modulever} -k ${VERSION}) + status=$(/usr/bin/dkms status -m ${module} -v ${modulever} -k ${VERSION}) fi # If the module is built (either pre-built or just now), install it if [ $(echo "$status"|grep -c ": built") -eq 1 ] && [ $(echo "$status"|grep -c ": installed") -eq 0 ]; then echo -n "Installing DKMS module: ${module}-${modulever}... " - dkms install -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH} + /usr/bin/dkms install -q -m ${module} -v ${modulever} -k ${VERSION} -a ${ARCH} rval=$? # If the module failed installation, go to the next module. if [ $rval -eq 0 ]; then @@ -101,16 +101,18 @@ while [ $# -gt 1 ]; do fi done -if [ -n "$do_depmod" ]; then - echo -n "Generating kernel module dependency lists... " - depmod -a ${VERSION} - rval=$? - if [ $rval -eq 0 ]; then - echo "done." - else - echo "FAILED!" - exit $rval - fi +if [ -z "$do_depmod" ] || [ ! -x /usr/bin/depmod ]; then + exit 0 +fi + +echo -n "Generating kernel module dependency lists... " +/usr/bin/depmod -a ${VERSION} +rval=$? +if [ $rval -eq 0 ]; then + echo "done." +else + echo "FAILED!" + exit $rval fi exit 0 diff --git a/srcpkgs/dkms/files/kernel.d/dkms.prerm b/srcpkgs/dkms/files/kernel.d/dkms.prerm index 0307e895311..155e9734aee 100644 --- a/srcpkgs/dkms/files/kernel.d/dkms.prerm +++ b/srcpkgs/dkms/files/kernel.d/dkms.prerm @@ -4,14 +4,14 @@ PKGNAME="$1" VERSION="$2" -if [ -x /usr/sbin/dkms ]; then +if [ -x /usr/bin/dkms ]; then while read line; do name=`echo "$line" | awk '{print $1}' | sed 's/,$//'` vers=`echo "$line" | awk '{print $2}' | sed 's/,$//'` arch=`echo "$line" | awk '{print $4}' | sed 's/:$//'` echo "dkms: removing: $name $vers (${PKGNAME}-${VERSION}) ($arch)" >&2 - dkms remove -q -m $name -v $vers -k ${VERSION} -a $arch -done < <(dkms status -k ${VERSION} 2>/dev/null | grep ": installed") + /usr/bin/dkms remove -q -m $name -v $vers -k ${VERSION} -a $arch +done < <(/usr/bin/dkms status -k ${VERSION} 2>/dev/null | grep ": installed") fi rmdir \ diff --git a/srcpkgs/dkms/template b/srcpkgs/dkms/template index 4365bc5a7d7..f6b5035e8a0 100644 --- a/srcpkgs/dkms/template +++ b/srcpkgs/dkms/template @@ -1,7 +1,7 @@ # Template file for 'dkms' pkgname=dkms version=2.8.3 -revision=1 +revision=2 conf_files="/etc/dkms/framework.conf" depends="bash kmod gcc make coreutils linux-headers" short_desc="Dynamic Kernel Modules System" From 321c3e33d6a955e1a086c04fecce760c8a5a418f Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 5 Aug 2020 12:13:08 -0400 Subject: [PATCH 3/7] dracut: improve consistency of relative paths in kernel hooks --- srcpkgs/dracut/files/kernel-hook-postinst | 4 ++-- srcpkgs/dracut/files/kernel-hook-postrm | 4 +--- srcpkgs/dracut/files/kernel-uefi-hook-postinst | 5 +++-- srcpkgs/dracut/files/kernel-uefi-hook-postrm | 4 +--- srcpkgs/dracut/template | 2 +- 5 files changed, 8 insertions(+), 11 deletions(-) diff --git a/srcpkgs/dracut/files/kernel-hook-postinst b/srcpkgs/dracut/files/kernel-hook-postinst index a9d265b6ed6..537af549796 100644 --- a/srcpkgs/dracut/files/kernel-hook-postinst +++ b/srcpkgs/dracut/files/kernel-hook-postinst @@ -7,9 +7,9 @@ PKGNAME="$1" VERSION="$2" -if [ ! -x bin/dracut ]; then +if [ ! -x usr/bin/dracut ]; then exit 0 fi -dracut -q --force boot/initramfs-${VERSION}.img ${VERSION} +usr/bin/dracut -q --force --sysroot . boot/initramfs-${VERSION}.img ${VERSION} exit $? diff --git a/srcpkgs/dracut/files/kernel-hook-postrm b/srcpkgs/dracut/files/kernel-hook-postrm index f99458a4bfa..c338cf617a7 100644 --- a/srcpkgs/dracut/files/kernel-hook-postrm +++ b/srcpkgs/dracut/files/kernel-hook-postrm @@ -7,7 +7,5 @@ PKGNAME="$1" VERSION="$2" -if [ -f boot/initramfs-${VERSION}.img ]; then - rm -f boot/initramfs-${VERSION}.img -fi +rm -f boot/initramfs-${VERSION}.img exit $? diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postinst b/srcpkgs/dracut/files/kernel-uefi-hook-postinst index d623c3f86df..f1098a48a81 100644 --- a/srcpkgs/dracut/files/kernel-uefi-hook-postinst +++ b/srcpkgs/dracut/files/kernel-uefi-hook-postinst @@ -12,12 +12,13 @@ if [ -z "${CREATE_UEFI_BUNDLES}" ]; then exit 0 fi -if [ ! -x bin/dracut ]; then +if [ ! -x usr/bin/dracut ]; then exit 0 fi mkdir -p ${UEFI_BUNDLE_DIR:=boot/efi/EFI/void} -dracut -q --force ${KERNEL_CMDLINE:+--kernel-cmdline="${KERNEL_CMDLINE}"} ${DRACUT_OPTIONS} \ +usr/bin/dracut -q --force --sysroot . ${DRACUT_OPTIONS} \ + ${KERNEL_CMDLINE:+--kernel-cmdline="${KERNEL_CMDLINE}"} \ --uefi ${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi ${VERSION} exit $? diff --git a/srcpkgs/dracut/files/kernel-uefi-hook-postrm b/srcpkgs/dracut/files/kernel-uefi-hook-postrm index 8183bb26f08..63b25498789 100644 --- a/srcpkgs/dracut/files/kernel-uefi-hook-postrm +++ b/srcpkgs/dracut/files/kernel-uefi-hook-postrm @@ -11,7 +11,5 @@ VERSION="$2" : "${UEFI_BUNDLE_DIR:=boot/efi/EFI/void}" -if [ -f "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" ]; then - rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" -fi +rm -fv "${UEFI_BUNDLE_DIR}/linux-${VERSION}.efi" exit $? diff --git a/srcpkgs/dracut/template b/srcpkgs/dracut/template index 8fb41d17a72..232f70a0d4a 100644 --- a/srcpkgs/dracut/template +++ b/srcpkgs/dracut/template @@ -1,7 +1,7 @@ # Template file for 'dracut' pkgname=dracut version=050 -revision=5 +revision=6 build_style=configure configure_args="--prefix=/usr --sysconfdir=/etc" conf_files="/etc/dracut.conf" From 386aa5db5b5dbd25f2b4694e5c3ae8cd9f712036 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 5 Aug 2020 12:13:08 -0400 Subject: [PATCH 4/7] gummiboot: improve consistency of relative paths in kernel hooks --- .../files/kernel.d/gummiboot.post-install | 28 +++++++++---------- .../files/kernel.d/gummiboot.post-remove | 16 +++++------ srcpkgs/gummiboot/template | 2 +- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/srcpkgs/gummiboot/files/kernel.d/gummiboot.post-install b/srcpkgs/gummiboot/files/kernel.d/gummiboot.post-install index 7f4d27e985d..2517421e3e5 100644 --- a/srcpkgs/gummiboot/files/kernel.d/gummiboot.post-install +++ b/srcpkgs/gummiboot/files/kernel.d/gummiboot.post-install @@ -13,33 +13,33 @@ if [ "$GUMMIBOOT_DISABLE" ]; then exit 0 fi -boot=$ROOTDIR/boot -entries=$boot/loader/entries -name=void-$VERSION -entry=$entries/$name.conf -options=$boot/loader/void-options.conf -loader=$boot/loader/loader.conf +boot="$ROOTDIR/boot" +entries="$boot/loader/entries" +name="void-$VERSION" +entry="$entries/$name.conf" +options="$boot/loader/void-options.conf" +loader="$boot/loader/loader.conf" -[ -d $boot ] || exit 0 +[ -d "$boot" ] || exit 0 -mkdir -p $entries +mkdir -p "$entries" -cat <<-EOF > $entry +cat <<-EOF > "$entry" title Void Linux version $VERSION linux /vmlinuz-$VERSION initrd /initramfs-$VERSION.img EOF -if [ -r $options ]; then +if [ -r "$options" ]; then # Add user provided options from /boot/loader/void-options.conf: - printf 'options %s\n' "$(cat $options | sed '/^#/d;/^$/d')" >> $entry + printf 'options %s\n' "$(cat "$options" | sed '/^#/d;/^$/d')" >> "$entry" fi -if grep -q ^default $loader 2>/dev/null; then +if grep -q ^default "$loader" 2>/dev/null; then # Replace existing default entry with this entry: - sed -i "s/default.*/default $name/" $loader + sed -i "s/default.*/default $name/" "$loader" else # Add this entry as the default: - printf 'default %s\n' $name >>$loader + printf 'default %s\n' $name >>"$loader" fi diff --git a/srcpkgs/gummiboot/files/kernel.d/gummiboot.post-remove b/srcpkgs/gummiboot/files/kernel.d/gummiboot.post-remove index b946d62456a..a207b2d362c 100644 --- a/srcpkgs/gummiboot/files/kernel.d/gummiboot.post-remove +++ b/srcpkgs/gummiboot/files/kernel.d/gummiboot.post-remove @@ -7,15 +7,15 @@ PKGNAME="$1" VERSION="$2" -boot=$ROOTDIR/boot -entries=$boot/loader/entries -name=void-$VERSION -entry=$entries/$name.conf -loader=$boot/loader/loader.conf +boot="$ROOTDIR/boot" +entries="$boot/loader/entries" +name="void-$VERSION" +entry="$entries/$name.conf" +loader="$boot/loader/loader.conf" -[ -d $boot ] || exit 0 +[ -d "$boot" ] || exit 0 -rm -f $entry +rm -f "$entry" # No default entry if the removed entry was the default: -sed -i "/^default $name\$/d" $loader +[ -e "$loader" ] && sed -i "/^default $name\$/d" "$loader" diff --git a/srcpkgs/gummiboot/template b/srcpkgs/gummiboot/template index a824e27c021..052776fe7ff 100644 --- a/srcpkgs/gummiboot/template +++ b/srcpkgs/gummiboot/template @@ -1,7 +1,7 @@ # Template file for 'gummiboot' pkgname=gummiboot version=48.1 -revision=5 +revision=6 archs="i686* x86_64* aarch64*" build_style=gnu-configure conf_files="/etc/default/gummiboot" From 2ae30447a7e4e59d0c3fda08c9a3cd593438dc8a Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 5 Aug 2020 12:13:09 -0400 Subject: [PATCH 5/7] mkinitcpio: improve consistency of relative paths in kernel hooks --- srcpkgs/mkinitcpio/files/kernel-hook-postinst | 4 ++-- srcpkgs/mkinitcpio/files/kernel-hook-postrm | 4 +--- srcpkgs/mkinitcpio/template | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/srcpkgs/mkinitcpio/files/kernel-hook-postinst b/srcpkgs/mkinitcpio/files/kernel-hook-postinst index 31fe5705812..c6f2ab81264 100644 --- a/srcpkgs/mkinitcpio/files/kernel-hook-postinst +++ b/srcpkgs/mkinitcpio/files/kernel-hook-postinst @@ -7,9 +7,9 @@ PKGNAME="$1" VERSION="$2" -if [ ! -x bin/mkinitcpio ]; then +if [ ! -x usr/bin/mkinitcpio ]; then exit 0 fi -mkinitcpio -g boot/initramfs-${VERSION}.img -k ${VERSION} +usr/bin/mkinitcpio -g boot/initramfs-${VERSION}.img -k ${VERSION} exit $? diff --git a/srcpkgs/mkinitcpio/files/kernel-hook-postrm b/srcpkgs/mkinitcpio/files/kernel-hook-postrm index f099aba66ca..028fd097b87 100644 --- a/srcpkgs/mkinitcpio/files/kernel-hook-postrm +++ b/srcpkgs/mkinitcpio/files/kernel-hook-postrm @@ -7,7 +7,5 @@ PKGNAME="$1" VERSION="$2" -if [ -f /boot/initramfs-${VERSION}.img ]; then - rm -f /boot/initramfs-${VERSION}.img -fi +rm -f boot/initramfs-${VERSION}.img exit $? diff --git a/srcpkgs/mkinitcpio/template b/srcpkgs/mkinitcpio/template index 303905d0f1f..a0f44360db4 100644 --- a/srcpkgs/mkinitcpio/template +++ b/srcpkgs/mkinitcpio/template @@ -1,7 +1,7 @@ # Template file for 'mkinitcpio' pkgname=mkinitcpio version=27 -revision=1 +revision=2 archs=noarch build_style=gnu-makefile depends="busybox-static bsdtar bash" From ea584cab2ce5d2c8e8b91441dcdcaf3a4ea25a59 Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 5 Aug 2020 12:13:09 -0400 Subject: [PATCH 6/7] refind: improve consistency of relative paths in kernel hooks --- srcpkgs/refind/files/kernel.post-install | 2 +- srcpkgs/refind/files/kernel.post-remove | 2 +- srcpkgs/refind/template | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/srcpkgs/refind/files/kernel.post-install b/srcpkgs/refind/files/kernel.post-install index 88b261aaacd..cc00a607665 100755 --- a/srcpkgs/refind/files/kernel.post-install +++ b/srcpkgs/refind/files/kernel.post-install @@ -13,7 +13,7 @@ if [ "z$UPDATE_REFIND_CONF" != "z1" ]; then fi # Default refind.conf -: "${REFIND_CONF:=/boot/EFI/refind/refind.conf}" +: "${REFIND_CONF:=boot/EFI/refind/refind.conf}" zrefind_dir="${REFIND_CONF%/*}" mkdir -p "$zrefind_dir" diff --git a/srcpkgs/refind/files/kernel.post-remove b/srcpkgs/refind/files/kernel.post-remove index efb3786396c..caa91fbb9b4 100755 --- a/srcpkgs/refind/files/kernel.post-remove +++ b/srcpkgs/refind/files/kernel.post-remove @@ -13,7 +13,7 @@ if [ "z$UPDATE_REFIND_CONF" != "z1" ]; then fi # Default refind.conf -: "${REFIND_CONF:=/boot/EFI/refind/refind.conf}" +: "${REFIND_CONF:=boot/EFI/refind/refind.conf}" [ -f "$REFIND_CONF" ] || exit 0 diff --git a/srcpkgs/refind/template b/srcpkgs/refind/template index 5e9865b9667..d7f8f2fba1c 100644 --- a/srcpkgs/refind/template +++ b/srcpkgs/refind/template @@ -1,7 +1,7 @@ # Template file for 'refind' pkgname=refind version=0.12.0 -revision=1 +revision=2 archs="x86_64* i686* aarch64*" makedepends="gnu-efi-libs" depends="bash dosfstools efibootmgr" From e7b7134a236709e4db4d120424aa1752c71bf85d Mon Sep 17 00:00:00 2001 From: "Andrew J. Hesford" Date: Wed, 5 Aug 2020 12:13:09 -0400 Subject: [PATCH 7/7] sbsigntool: improve consistency of relative paths in kernel hooks --- srcpkgs/sbsigntool/files/kernel.d/sbsigntool.post-install | 8 ++++---- srcpkgs/sbsigntool/template | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/srcpkgs/sbsigntool/files/kernel.d/sbsigntool.post-install b/srcpkgs/sbsigntool/files/kernel.d/sbsigntool.post-install index bc450dbc428..64cdef10e42 100644 --- a/srcpkgs/sbsigntool/files/kernel.d/sbsigntool.post-install +++ b/srcpkgs/sbsigntool/files/kernel.d/sbsigntool.post-install @@ -38,17 +38,17 @@ if [ "x${EFI_SIGN_ENGINE}" != x ]; then fi if ! sbsign $options -k "${EFI_KEY_FILE}" -c "${EFI_CERT_FILE}" \ - "/boot/vmlinuz-${VERSION}"; then + "boot/vmlinuz-${VERSION}"; then msg "failed to sign kernel" exit 1 fi -if ! sbverify -c "${EFI_CERT_FILE}" "/boot/vmlinuz-${VERSION}.signed"; then +if ! sbverify -c "${EFI_CERT_FILE}" "boot/vmlinuz-${VERSION}.signed"; then msg "failed to verify the signature" exit 1 fi if [ "x${EFI_KEEP_UNSIGNED}" = "x1" ]; then - mv -f "/boot/vmlinuz-${VERSION}" "/boot/vmlinuz-${VERSION}.unsigned" + mv -f "boot/vmlinuz-${VERSION}" "boot/vmlinuz-${VERSION}.unsigned" fi -mv -f "/boot/vmlinuz-${VERSION}.signed" "/boot/vmlinuz-${VERSION}" +mv -f "boot/vmlinuz-${VERSION}.signed" "boot/vmlinuz-${VERSION}" diff --git a/srcpkgs/sbsigntool/template b/srcpkgs/sbsigntool/template index 6e39cac66d9..0bee8bf00b1 100644 --- a/srcpkgs/sbsigntool/template +++ b/srcpkgs/sbsigntool/template @@ -1,7 +1,7 @@ # Template file for 'sbsigntool' pkgname=sbsigntool version=0.9.4 -revision=2 +revision=3 archs="x86_64* i686* aarch64* arm*" wrksrc=sbsigntools-$version build_style=gnu-configure