HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux WebLive 5.15.0-79-generic #86-Ubuntu SMP Mon Jul 10 16:07:21 UTC 2023 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //proc/thread-self/root/etc/kernel/postinst.d/kdump-tools
#!/bin/sh
set -eu

version="${1-}"
kdumpdir="/var/lib/kdump"

[ -x /usr/sbin/mkinitramfs ] || exit 0

# passing the kernel version is required
if [ -z "${version}" ]; then
	echo >&2 "W: kdump-tools: ${DPKG_MAINTSCRIPT_PACKAGE:-kdump-tools package} did not pass a version number"
	exit 2
fi

if ! linux-version list | grep "${version}" > /dev/null ; then
	exit 0
fi

# exit if kernel does not need an initramfs
if [ "${INITRD-}" = 'No' ]; then
	exit 0
fi

# avoid running multiple times
if [ -n "${DEB_MAINT_PARAMS-}" ]; then
	eval set -- "$DEB_MAINT_PARAMS"
	if [ -z "$1" ] || [ "$1" != "configure" ]; then
		exit 0
	fi
fi

if test ! -e /etc/initramfs-tools/initramfs.conf; then
	echo "W: kdump-tools: /etc/initramfs-tools/initramfs.conf is missing." >&2
	exit 2
fi
. /etc/initramfs-tools/initramfs.conf
for conf_file in /etc/initramfs-tools/conf.d/*; do
	if test -f "$conf_file" && basename "$conf_file" | grep '^[[:alnum:]][[:alnum:]\._-]*$' | grep -qv '\.dpkg-.*$'; then
		. "$conf_file"
	fi
done

if test "${MODULES-most}" = most; then
	# Switch from "most" to "dep" to reduce the size of the initramfs.
	# "netboot" and "list" are expected to be already small enough.
	KDUMP_MODULES=dep
fi

# We need a modified copy of initramfs-tools directory
# with MODULES=dep in initramfs.conf
if [ ! -d "$kdumpdir" ];then
	mkdir -p "$kdumpdir"
fi
# Force re-creation of $kdumpdir/initramfs-tools
# in case the source has changed since last time
# we ran
if [ -d "$kdumpdir/initramfs-tools" ];then
	rm -Rf $kdumpdir/initramfs-tools
fi
cp -pr /etc/initramfs-tools "$kdumpdir"

initramfsdir="$kdumpdir/initramfs-tools"

if test -n "${KDUMP_MODULES-}" -a "${KDUMP_MODULES-}" != "${MODULES}"; then
	mkdir -p "$initramfsdir/conf.d"
	echo "MODULES=${KDUMP_MODULES}" > "$initramfsdir/conf.d/zzz-kdump"
fi

# Add scsi_dh_* modules if in use otherwise
# kexec reboot on multipath will fail
# (LP: #1635597)
for I in $(lsmod | grep scsi_dh | cut -d" " -f1);do
	echo "${I}" >> $initramfsdir/modules
done

# Mark our custom initramfs.conf to indicate that kdump-tools
# hooks/scripts should run/get included in our minimal initrd.
#
# Unfortunately, this is not true for Debian. OPTION=VAR is a
# control provided only by Ubuntu initramfs-tools, so this is
# innocuous /harmless on Debian - kept here for better code
# sync between Debian and Ubuntu. We needed special checks on
# hook/script in Debian to prevent them on regular initrd.
echo "KDUMP=y" >> $initramfsdir/initramfs.conf

# Cleaning up existing initramfs with same version
# as mkinitramfs do not have a force option
if [ -e "$kdumpdir/initrd.img-${version}" ];then
	rm -f "$kdumpdir/initrd.img-${version}"
fi

# we're good - create initramfs.
echo "kdump-tools: Generating $kdumpdir/initrd.img-${version}"
if mkinitramfs -d "$initramfsdir" -o "$kdumpdir/initrd.img-${version}.new" "${version}";then
	mv "$kdumpdir/initrd.img-${version}.new" "$kdumpdir/initrd.img-${version}"
else
	mkinitramfs_return="$?"
	rm -f "$kdumpdir/initrd.img-${version}.new"
	echo "update-initramfs: failed for $kdumpdir/initrd.img-${version} with $mkinitramfs_return." >&2
	exit $mkinitramfs_return
fi