summaryrefslogtreecommitdiffstats
path: root/source/a/mkinitrd/setup.01.mkinitrd
diff options
context:
space:
mode:
author Patrick J Volkerding <volkerdi@slackware.com>2024-07-25 20:22:54 +0000
committer Eric Hameleers <alien@slackware.com>2024-07-25 23:16:46 +0200
commitbca17f28ccefb0ab1fd45bbacc572fa457e1bb68 (patch)
tree1d49aba1a116e97efc6022b10ccd6cad1b586d58 /source/a/mkinitrd/setup.01.mkinitrd
parent3fb0490c728ea33222f51f46b507884af000fac1 (diff)
downloadcurrent-bca17f28ccefb0ab1fd45bbacc572fa457e1bb68.tar.gz
current-bca17f28ccefb0ab1fd45bbacc572fa457e1bb68.tar.xz
Thu Jul 25 20:22:54 UTC 202420240725202254
Enjoy your shiny new vmlinuz-6.9.11-generic! Thanks again to LuckyCyborg for teaching me about the path of least resistance. a/grub-2.12-x86_64-14.txz: Rebuilt. Don't mention 09_slackware_linux in the /etc/default/grub comments. a/kernel-generic-6.9.11-x86_64-1.txz: Upgraded. a/kernel-huge-6.9.11-x86_64-1.txz: Upgraded. a/kernel-modules-6.9.11-x86_64-1.txz: Upgraded. a/mkinitrd-1.4.11-x86_64-35.txz: Rebuilt. d/kernel-headers-6.9.11-x86-1.txz: Upgraded. d/rust-1.80.0-x86_64-1.txz: Upgraded. k/kernel-source-6.9.11-noarch-1.txz: Upgraded. l/xapian-core-1.4.26-x86_64-1.txz: Upgraded. isolinux/initrd.img: Rebuilt. kernels/*: Upgraded. usb-and-pxe-installers/usbboot.img: Rebuilt.
Diffstat (limited to 'source/a/mkinitrd/setup.01.mkinitrd')
-rw-r--r--source/a/mkinitrd/setup.01.mkinitrd58
1 files changed, 36 insertions, 22 deletions
diff --git a/source/a/mkinitrd/setup.01.mkinitrd b/source/a/mkinitrd/setup.01.mkinitrd
index 31e871447..be05ef841 100644
--- a/source/a/mkinitrd/setup.01.mkinitrd
+++ b/source/a/mkinitrd/setup.01.mkinitrd
@@ -1,37 +1,51 @@
#!/bin/sh
#BLURB="Generate /boot/initrd.gz for the generic kernel"
-# Start with the version for vmlinuz-generic-smp:
-KERNEL_SYMLINK="boot/vmlinuz-generic-smp"
-if [ -L $KERNEL_SYMLINK ]; then
- KERNEL_VERSION_LIST=$(strings $KERNEL_SYMLINK | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ')
+# Load defaults:
+if [ -r etc/default/geninitrd ]; then
+ . etc/default/geninitrd
fi
-# Next add the version for vmlinuz-generic:
-KERNEL_SYMLINK="boot/vmlinuz-generic"
-if [ -L $KERNEL_SYMLINK ]; then
- if [ -z $KERNEL_VERSION_LIST ]; then
- KERNEL_VERSION_LIST=$(strings $KERNEL_SYMLINK | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ')
- else
- KERNEL_VERSION_LIST="$KERNEL_VERSION_LIST:$(strings $KERNEL_SYMLINK | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ')"
- fi
+if [ -z "$KERNEL_SYMLINK" ]; then
+ KERNEL_SYMLINK="boot/vmlinuz-generic"
+elif [ "$(echo $KERNEL_SYMLINK | cut -b 1)" = "/" ]; then # trim to make a relative path
+ KERNEL_SYMLINK="$(echo $KERNEL_SYMLINK | cut -b 2-)"
fi
-# Proper plural(s):
-if echo $KERNEL_VERSION_LIST | grep -q : ; then
- KERNEL=kernels
-else
- KERNEL=kernel
+# Find the kernel version:
+if [ -r $KERNEL_SYMLINK ]; then
+ KERNEL_VERSION=$(strings $KERNEL_SYMLINK | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ')
fi
+# Assume the kernel "name" aka flavor is just the second part of the symlink name:
+KERNEL_NAME="$(echo $KERNEL_SYMLINK | rev | cut -f 1 -d - | rev)"
+
+# Sometimes mkinitrd_command_generator.sh does not detect LVM properly. Until I
+# get to the bottom of that, it's safer to just always include LVM support.
+LVM_OPTION="-L"
+
# Generate the initrd:
-if [ ! -z $KERNEL_VERSION_LIST ]; then
+if [ ! -z $KERNEL_VERSION ]; then
dialog --title "GENERATING INITIAL RAMDISK" --infobox \
- "Generating an initial ramdisk for use with the $KERNEL_VERSION_LIST generic \
-${KERNEL}. The initial ramdisk contains kernel modules needed to mount the \
+ "Generating an initial ramdisk for use with the $KERNEL_VERSION kernel. \
+The initial ramdisk contains kernel modules needed to mount the \
root partition, and must be regenerated whenever the kernel is updated. To \
regenerate the initrd, select this setup script from within pkgtool, or run \
'geninitrd' which will produce an initial ramdisk (/boot/initrd.gz) for the \
-installed generic ${KERNEL}." 9 68
- chroot . /usr/share/mkinitrd/mkinitrd_command_generator.sh -k $KERNEL_VERSION_LIST | chroot . bash 1> /dev/null 2> /dev/null
+installed kernel." 8 70
+ chroot . /usr/share/mkinitrd/mkinitrd_command_generator.sh -k $KERNEL_VERSION -a "$LVM_OPTION -o /boot/initrd-${KERNEL_VERSION}-${KERNEL_NAME}.img" | chroot . bash 1> /dev/null 2> /dev/null
+fi
+
+if [ "$GENINITRD_NAMED_SYMLINK" = "true" ]; then
+ ( cd boot
+ rm -f initrd-${KERNEL_NAME}.img
+ ln -sf initrd-${KERNEL_VERSION}-${KERNEL_NAME}.img initrd-${KERNEL_NAME}.img
+ )
+fi
+
+if [ "$GENINITRD_INITRD_GZ_SYMLINK" = "true" ]; then
+ ( cd boot
+ rm -f initrd.gz
+ ln -sf initrd-${KERNEL_VERSION}-${KERNEL_NAME}.img initrd.gz
+ )
fi