diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:00:48 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 13:00:48 +0000 |
commit | f542925b701989ba6eed7b08b5226d4021b9b85f (patch) | |
tree | 57e14731f21a6d663326d30b7b88736e9d51c420 /debian/udev.preinst | |
parent | Adding upstream version 247.3. (diff) | |
download | systemd-debian.tar.xz systemd-debian.zip |
Adding debian version 247.3-7+deb11u4.debian/247.3-7+deb11u4debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | debian/udev.preinst | 83 |
1 files changed, 83 insertions, 0 deletions
diff --git a/debian/udev.preinst b/debian/udev.preinst new file mode 100644 index 0000000..7af4e94 --- /dev/null +++ b/debian/udev.preinst @@ -0,0 +1,83 @@ +#!/bin/sh + +set -e + +# adapted from postinst +chrooted() { + if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; + then + return 1 + fi + return 0 +} + +check_kernel_features() { + # skip the check if udev is not already active + [ -d /run/udev/ ] || return 0 + + if [ -e /proc/kallsyms ]; then + + local needed_symbols='inotify_init signalfd accept4 open_by_handle_at timerfd_create epoll_create' + for symbol in $needed_symbols; do + if ! egrep -q "^[a-fA-F0-9]+ T \.?sys_${symbol}$" /proc/kallsyms; then + cat <<END +Since release 198, udev requires support for the following features in +the running kernel: + +- inotify(2) (CONFIG_INOTIFY_USER) +- signalfd(2) (CONFIG_SIGNALFD) +- accept4(2) +- open_by_handle_at(2) (CONFIG_FHANDLE) +- timerfd_create(2) (CONFIG_TIMERFD) +- epoll_create(2) (CONFIG_EPOLL) +END + exit 1 + fi + done + + fi + + if ! grep -q '[[:space:]]devtmpfs$' /proc/filesystems; then + cat <<END +Since release 176, udev requires support for the following features in +the running kernel: + +- devtmpfs (CONFIG_DEVTMPFS) +END + exit 1 + fi + + if [ -d /sys/class/mem/null -a ! -L /sys/class/mem/null ] || + [ -e /sys/block -a ! -e /sys/class/block ]; then + cat <<END +The currently running kernel has the CONFIG_SYSFS_DEPRECATED option +enabled, which is incompatible with udev. +END + exit 1 + fi +} + +check_version() { + # $2 is non-empty when installing from the "config-files" state + [ -n "$2" ] || return 0 + + if dpkg --compare-versions $2 lt 204-4; then + # these must be checked first to allow aborting before changing anything + if chrooted; then + echo 'Running in a chroot, skipping the kernel versions checks!' + else + check_kernel_features + # suppress errors when the new rules files contain options not supported by + # the old daemon + udevadm control --log-priority=0 || true + fi + fi # 204-4 +} + +case "$1" in + install|upgrade|abort-upgrade) + check_version "$@" + ;; +esac + +#DEBHELPER# |