#!/bin/sh #BLURB="Generate /boot/initrd- for the kernel" # Assumed to have been written by Patrick J. Volkerding. # Adapted to Slint by Didier Spaier # 23 December 2020: added "-m crc32_generic:crc32_pclmul (dependency of f2fs) # to the command /usr/share/mkinitrd/mkinitrd_command_generator.sh if the file # system of the root directory is f2fs export TEXTDOMAIN=slint . gettext.sh # We take as argument the kernel version # If we are called directly, not with as argument 1 the mountpoint and as # argument 2 the root partition's name (as do SeTconfig in the installer and # geinitrd in an installed system), we assume that we are in an installed system # so the device name and the uuid of root partition are those of the partition # mounted on /. rm -rf /tmp/genintrd if [ $# -lt 2 ]; then ROOT_DEVICE=$(findmnt -no SOURCE /) else ROOT_DEVICE="$2" fi ROOT_FSTYPE=$(findmnt -no fstype $ROOT_DEVICE) ROOT_UUID=$(findmnt -no UUID $ROOT_DEVICE) KERNELLIST=$(ls /boot/vmlinuz-*|grep -v huge) # Remove the initrds that do not comply to the Debian naming scheme as we want # that all initrds be found by os-prober which uses this scheme. ls /boot/|grep ^initrd|while read INITRD; do if [ -f /boot/$INITRD ]; then KERNEL=$(echo /boot/$INITRD|sed s/initrd/vmlinuz/) if [ ! -f $KERNEL ]; then rm /boot/$INITRD fi fi done # We accept only kernels for which associated modules are installed and won't # rebuild existing initrds. echo "$KERNELLIST"|while read KERNEL; do KERNELVERSION=$(echo $KERNEL|sed "s/.*-//") KERNELNAME=$(echo $KERNEL|sed "s#\(.*\)-[^-]\{1,\}#\1#") INITRD=$(echo $KERNEL|sed s/vmlinuz/initrd/) if [ -d /lib/modules/$KERNELVERSION ] && [ ! -f $INITRD ]; then eval_gettext " Generating an initial ramdisk for use with the kernel $KERNELVERSION. Please wait" if [ "$ROOT_FSTYPE" = "f2fs" ]; then ADDED_MODULES='-m crc32_generic:crc32_pclmul' fi chroot . /usr/share/mkinitrd/mkinitrd_command_generator.sh -k $KERNELVERSION $ADDED_MODULES -a "-o $INITRD"|sed "s@-r [[:graph:]]\{1,\}@-r UUID=$ROOT_UUID@" | chroot . bash echo fi done