4 # Required-Start: mountkernfs
10 # Short-Description: wrapper around udev to support bootoptions noudev and blacklist
13 . /lib/lsb/init-functions
15 # shell version of /usr/bin/tty
17 [ -x /bin/readlink ] || return 0
18 [ -e /proc/self/fd/0 ] || return 0
19 readlink --silent /proc/self/fd/0 || true
22 # are we running within init (non_interactive) or within shell (interactive)?
23 check_for_non_interactive() {
24 if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then
29 if [ -z "$TTY" -o "$TTY" = "/dev/console" -o "$TTY" = "/dev/null" ]; then
36 # start init script through official Debian way
38 # avoid syntax error if called without valid parameter:
39 [ -z "$1" ] && exec /etc/init.d/udev "$1"
41 exec /etc/init.d/udev "$1"
44 # test whether udev is enabled in init's configuration
47 if [ -r /etc/runlevel.conf ] && egrep -q '^[0-9]+.*-.*-.*\/etc\/init.d\/ydev$' /etc/runlevel.conf ; then
52 if ls /etc/rcS.d/*udev >/dev/null 2>&1 ; then
59 # if original udev init script is enabled to not execute our script
62 log_warning_msg "Original udev init script is configured for startup, ignoring request to start $0"
69 # do not flood console with kernel driver messages
70 # grep -q debug /proc/cmdline || echo 0 > /proc/sys/kernel/printk
72 # do not display anything when bootoption *splash is present:
73 # if grep -qe ' splash' -qe ' tsplash' -qe ' textsplash' /proc/cmdline ; then
74 # exec >/dev/null </dev/null
77 # support bootoption blacklist, must be executed *before* udev is present
78 if [ -r /etc/grml/autoconfig.functions ] ; then
79 ( zsh -c '. /etc/grml/autoconfig.functions && config_blacklist || printf "Error when trying to run config_blacklist.\n">&2' )
81 printf 'Warning: /etc/grml/autoconfig.functions could not be read.\n'>&2
84 # support bootoption noudev and inform user how to skip
85 # execution of udev (being bootoption noudev)
86 if ! grep -q noudev /proc/cmdline ; then
87 check_for_non_interactive && \
88 log_warning_msg "If your system hangs now skip execution of udev via bootoption noudev"
90 # - allow execution of initscript through FORCE=1 when booting with noudev
91 if [ -z "$FORCE" ] ; then
92 log_failure_msg "Bootoption noudev found. Skipping execution of udev init script."
93 if ! check_for_non_interactive ; then
94 printf "\nIt has been detected that the udev init script\n"
95 printf "has been run from an interactive shell.\n"
96 printf "You booted your system using bootoption noudev.\n"
97 printf "To force startup of udev please run:\n\n"
98 printf "\tFORCE=1 Start udev\n\n"
104 udev_init_check && udev_exec start
108 # in any other situation just directly invoke udev:
110 udev_init_check && udev_exec "$1"
116 ##############################################################################