slackware-current/source/a/mkinitrd/geninitrd
Patrick J Volkerding 41196c6ff1 Fri Dec 6 22:22:58 UTC 2024
a/kernel-generic-6.12.3-x86_64-1.txz:  Upgraded.
a/mkinitrd-1.4.11-x86_64-53.txz:  Rebuilt.
  /etc/default/geninitrd: added option AUTO_UPDATE_GRUB=true to run update-grub
  after generating the initrd.
  Move the remove-orphaned-initrds section from geninitrd to setup.01.mkinitrd.
  setup.01.mkinitrd: support AUTO_UPDATE_GRUB. Suppress warnings from
  libdevmapper when setup.01.mkinitrd is run within upgradepkg's flock locking.
a/pkgtools-15.1-noarch-20.txz:  Rebuilt.
  pkgtool: set INSIDE_INSTALLER in the Setup section to match the expected
  behavior. Thanks to Mechanikx.
  upgradepkg: allow text produced by install scripts to reach the console in
  --terse mode.
d/kernel-headers-6.12.3-x86-1.txz:  Upgraded.
k/kernel-source-6.12.3-noarch-1.txz:  Upgraded.
l/PyQt-builder-1.17.0-x86_64-1.txz:  Upgraded.
l/sof-firmware-2024.09.2-noarch-1.txz:  Upgraded.
l/xapian-core-1.4.27-x86_64-1.txz:  Upgraded.
x/mesa-24.3.1-x86_64-2.txz:  Rebuilt.
  Revert commit 4c065158927d7bacc5eb1e4f2491b1db93f1dc12:
  [PATCH] dri: revert INVALID modifier special-casing.
  This fixes a crash with AMD RX 470 through 590.
  Thanks to genss for the bug report.
xfce/xfce4-pulseaudio-plugin-0.4.9-x86_64-1.txz:  Upgraded.
isolinux/initrd.img:  Rebuilt.
kernels/*:  Upgraded.
usb-and-pxe-installers/usbboot.img:  Rebuilt.
2024-12-07 00:44:23 +01:00

88 lines
3.5 KiB
Bash

#!/bin/bash
# Copyright 2019, 2024 Patrick J. Volkerding, Sebeka, Minnesota, USA
# All rights reserved.
#
# Redistribution and use of this script, with or without modification, is
# permitted provided that the following conditions are met:
#
# 1. Redistributions of this script must retain the above copyright
# notice, this list of conditions and the following disclaimer.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# This is a simple script to generate an initial ramdisk when a new
# kernel is installed. If the kernel is vmlinuz-6.11.5, it will generate
# initrd-6.11.5.img. If there's a symlink pointing at the kernel (for
# example, vmlinuz-generic), it will also make a matching initrd-generic.img
# symlink. Finally, it also supports a plain initrd.gz symlink to the initrd,
# which might still be needed by some old setups.
# To generate an initrd automatically, just run "geninitrd".
# Which kernel will be used follows this priority:
# If a kernel was provided on the command line:
# geninitrd /boot/vmlinuz-6.12.1
# Then we will use that kernel.
# Otherwise, if the KERNEL environment variable was provided:
# KERNEL=/boot/vmlinuz-6.12.1 geninitrd
# Then we will use that kernel.
# Otherwise we will use the value for KERNEL defined in /etc/default/geninitrd.
# If KERNEL remains undefined after loading /etc/default/geninitrd, then
# we will fall back on using the newest kernel we find in /boot.
# If you use an encrypted root, you may need an appropriate /etc/mkinitrd.conf
# (if you will be setting GENERATOR=mkinitrd in /etc/default/geninitrd), or you
# could try using GENERATOR=dracut.
cd $(dirname $0)/../..
# Was KERNEL already defined? If so, save it as a possible override:
if [ ! -z "$KERNEL" ]; then
KERNEL_OVERRIDE=$KERNEL
fi
# Was a kernel given on the command line? If so, this is the highest priority
# for the kernel to use:
if [ ! -z "$1" ]; then
KERNEL_OVERRIDE=$1
fi
# Load default options:
if [ -r etc/default/geninitrd ]; then
. etc/default/geninitrd
fi
# If we have a KERNEL_OVERRIDE use it for the KERNEL:
if [ ! -z "$KERNEL_OVERRIDE" ]; then
KERNEL=$KERNEL_OVERRIDE
unset KERNEL_OVERRIDE
fi
if [ ! -z "$KERNEL" ]; then
export KERNEL
fi
# In case you cannot make this script do exactly what you require, you're
# welcome to create your own script to be run instead. Define this in
# /etc/default/geninitrd (GENINITRD_OVERRIDE_SCRIPT).
if [ ! -z $GENINITRD_OVERRIDE_SCRIPT ]; then
# If this is an absolute pathname, make it relative to /:
RELATIVE_OVERRIDE_SCRIPT=$GENINITRD_OVERRIDE_SCRIPT
if [ "$(echo $RELATIVE_OVERRIDE_SCRIPT | cut -b 1)" = "/" ]; then
RELATIVE_OVERRIDE_SCRIPT="$(echo $RELATIVE_OVERRIDE_SCRIPT | cut -b 2-)"
fi
fi
if [ -x "$RELATIVE_OVERRIDE_SCRIPT" ]; then
chroot . $GENINITRD_OVERRIDE_SCRIPT
else # we will run the default handler from the setup scripts:
chroot . /var/lib/pkgtools/setup/setup.01.mkinitrd
fi