1
0
Fork 0
mirror of git://slackware.nl/current.git synced 2025-02-09 22:00:48 +01:00
slackware-current/source/a/mkinitrd/setup.01.mkinitrd
Patrick J Volkerding 2e588b58d9 Fri Nov 1 21:13:31 UTC 2024
a/kernel-firmware-20241101_376de1f-noarch-1.txz:  Upgraded.
a/kernel-generic-6.11.6-x86_64-1.txz:  Upgraded.
a/mkinitrd-1.4.11-x86_64-42.txz:  Rebuilt.
  geninitrd: you can still point this at a kernel symlink, but by default it
  will make initrd-${KERNEL_VERSION}.img for the newest kernel it finds in
  the /boot directory.
a/pkgtools-15.1-noarch-16.txz:  Rebuilt.
  make-kernel-backup: don't make copies of any of the files, nor include an
  initrd in the package. The only added "files" will be two symlinks,
  vmlinuz-backup, and initrd-backup.img (if symlinks are enabled).
d/kernel-headers-6.11.6-x86-1.txz:  Upgraded.
d/valgrind-3.24.0-x86_64-1.txz:  Upgraded.
k/kernel-source-6.11.6-noarch-1.txz:  Upgraded.
l/fluidsynth-2.4.0-x86_64-1.txz:  Upgraded.
l/gtk4-4.16.4-x86_64-1.txz:  Upgraded.
l/libzip-1.11.2-x86_64-1.txz:  Upgraded.
  Fix performance regression in zip_stat introduced in 1.11.
l/spirv-llvm-translator-19.1.1-x86_64-1.txz:  Upgraded.
n/uucp-1.07-x86_64-7.txz:  Rebuilt.
  Add some documentation. Thanks to jayjwa.
isolinux/initrd.img:  Rebuilt.
kernels/*:  Upgraded.
usb-and-pxe-installers/usbboot.img:  Rebuilt.
2024-11-01 23:16:00 +01:00

67 lines
2.3 KiB
Bash

#!/bin/sh
#BLURB="Generate an initrd for the kernel"
# Load defaults:
if [ -r etc/default/geninitrd ]; then
. etc/default/geninitrd
fi
# This was the old name for $KERNEL, so allow it still:
KERNEL=$KERNEL_SYMLINK
if [ -z "$KERNEL" ]; then
# If we weren't told anything else, then use the newest kernel:
KERNEL="$(find /boot -name "vmlinuz-*" -type f | xargs ls -t | head -n 1)"
fi
# In case this is a symlink, get the real file:
KERNEL="$(readlink -f $KERNEL)"
# Find the kernel version:
if [ -r $KERNEL ]; then
if file $KERNEL | grep -wq "Linux kernel" ; then
KERNEL_VERSION=$(strings $KERNEL | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ')
else
echo "error: $KERNEL is not a Linux kernel."
fi
else
echo "error: was not given a KERNEL to make an initrd."
exit 1
fi
# 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 "$GENINITRD_SILENT" ]; then
dialog --title "GENERATING INITIAL RAMDISK" --infobox \
"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 kernel." 8 70
fi
chroot . /usr/share/mkinitrd/mkinitrd_command_generator.sh -k $KERNEL_VERSION -a "$LVM_OPTION -o /boot/initrd-${KERNEL_VERSION}.img" | chroot . bash 1> /dev/null 2> /dev/null
if [ "$GENINITRD_NAMED_SYMLINK" = "true" ]; then
# Make initrd symlinks for all matching kernel symlinks:
( cd boot
for symlink in $(find . -type l -name "vmlinuz-*") ; do
SYMLINK_VERSION=$(strings $symlink | grep '([^ ]*@[^ ]*) #' | cut -f1 -d' ')
if [ "$SYMLINK_VERSION" = "$KERNEL_VERSION" ]; then
KERNEL_NAME="$(echo $symlink | cut -f 2- -d -)"
rm -f initrd-${KERNEL_NAME}.img
ln -sf initrd-${KERNEL_VERSION}.img initrd-${KERNEL_NAME}.img
fi
done
)
fi
if [ "$GENINITRD_INITRD_GZ_SYMLINK" = "true" ]; then
( cd boot
rm -f initrd.gz
ln -sf initrd-${KERNEL_VERSION}.img initrd.gz
)
fi