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: //usr/share/initramfs-tools/scripts/local-bottom/kdump-sysctl
#!/bin/sh
#
# kdump-tools will selectively override sysctls on kdump boot based in
# the sysctl settings present on file /etc/kdump/sysctl.conf.
# Only kdump minimal initrd contains this script - regular initrds won't
# get this script included, since KDUMP variable is not set by default.
#
# Well....this is not entirely true in Debian. Due to initramfs-tools
# on Debian lacking the OPTION=VAR feature (present in Ubuntu) to
# control which scripts get included in initrd (based on the OPTION
# value), this script *will* be included in regular initrd also.
# But we have a check below to prevent it from doing the sysctls
# overriding. We chose to kept the innocuous OPTION here to better
# code sync with Ubuntu.

# shellcheck disable=SC2034
OPTION=KDUMP

set +e
case "${1}" in
        prereqs)
                exit 0
                ;;
esac

# In Debian we don't have the fine-tuned control of what scripts should
# be included in the initrd based on OPTION=VAR (like Ubuntu). So, we
# need the folowing check in order to prevent this script from running
# on regular initrds - it should only be executed on kdump boot.
VMCORE_FILE=/proc/vmcore
if [ ! -e $VMCORE_FILE ]; then
	exit 0
fi

KDUMP_SYSCTL_PATH="/etc/kdump/sysctl.conf"
# Do not prevent the system boot on error, kdump may be the last resource!
if [ ! -d /run ]; then
	echo "WARNING: kdump-sysctl needs /run available in order to work"
	exit 0
fi

RT="${rootmnt?}"
SYSD="sysctl.d/"
FNAME="$(find "${RT}/usr/lib/${SYSD}" "${RT}/usr/local/lib/${SYSD}" "${RT}/lib/${SYSD}" "${RT}/etc/${SYSD}" "${RT}/run/${SYSD}" \
	-maxdepth=1 -name '*.conf' -printf '%f\n' 2>/dev/null | LC_ALL=C sort | tail -n1)"
FNAME="${FNAME}-kdump.conf"

if [ ! -f ${KDUMP_SYSCTL_PATH} ]; then
	echo "WARNING: kdump-sysctl needs ${KDUMP_SYSCTL_PATH} on initrd to continue"
	exit 0
fi

mkdir -p /run/sysctl.d
cp -p ${KDUMP_SYSCTL_PATH} "/run/sysctl.d/${FNAME}"