source: lsb-bootscripts/etc/init.d/udev@ b8d2a72

10.0 10.0-rc1 10.1 10.1-rc1 11.0 11.0-rc1 11.0-rc2 11.0-rc3 11.1 11.1-rc1 11.2 11.2-rc1 11.3 11.3-rc1 12.0 12.0-rc1 12.1 12.1-rc1 12.2 12.2-rc1 7.0 7.1 7.2 7.3 7.4 7.5 7.5-systemd 7.6 7.6-systemd 7.7 7.7-systemd 7.8 7.8-systemd 7.9 7.9-systemd 8.0 8.1 8.2 8.3 8.4 9.0 9.1 arm bdubbs/gcc13 ml-11.0 multilib renodr/libudev-from-systemd s6-init trunk xry111/arm64 xry111/arm64-12.0 xry111/clfs-ng xry111/lfs-next xry111/loongarch xry111/loongarch-12.0 xry111/loongarch-12.1 xry111/loongarch-12.2 xry111/mips64el xry111/multilib xry111/pip3 xry111/rust-wip-20221008 xry111/update-glibc
Last change on this file since b8d2a72 was d93bdd1e, checked in by DJ Lucas <dj@…>, 13 years ago

Multiple changes - cleanup and udev trigger - see changelog

git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@9544 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689

  • Property mode set to 100644
File size: 2.7 KB
RevLine 
[1c48007]1#!/bin/sh
2# Begin $rc_base/init.d/udev
3
4### BEGIN INIT INFO
5# Provides: udev
[67de919]6# Required-Start:
7# Should-Start: modules
[1c48007]8# Required-Stop:
9# Should-Stop:
[010d108]10# Default-Start: S
[1c48007]11# Default-Stop:
12# Short-Description: Populated /dev with device nodes.
13# Description: Mounts a tempfs on /dev and starts the udevd daemon.
14# Device nodes are created as defined by udev.
15# X-LFS-Provided-By: LFS
16### END INIT INFO
17
18. /lib/lsb/init-functions
19
20MESSAGE="Populating /dev with device nodes..."
21
22case "${1}" in
23 start)
24 if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
25 echo_failure
26 boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
27 boot_mesg -n " devices without a SysFS filesystem"
28 boot_mesg -n "\n\nAfter you press Enter, this system"
29 boot_mesg -n " will be halted and powered off."
30 boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
31 boot_mesg "" ${NORMAL}
[bd1b5be]32 $FAILURE_ACTION
[1c48007]33 /etc/rc.d/init.d/halt stop
34 fi
35
[dc55fb5e]36 # If not using DEVTMPFS mount a temporary file system over
37 # /dev, so that any devices made or removed during this boot
38 # don't affect the next one. The reason we don't write to mtab
39 # is because we don't ever want /dev to be unavailable (such as
40 # by `umount -a').
[3179cd6]41 if ! mountpoint /dev > /dev/null; then
42 mount -n -t tmpfs tmpfs /dev -o mode=755
43 fi
[5597318]44 if [ ${?} -ne 0 ]; then
[1c48007]45 echo_failure
46 boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
47 boot_mesg -n " onto /dev, this system will be halted."
48 boot_mesg -n "\n\nAfter you press Enter, this system"
49 boot_mesg -n " will be halted and powered off."
50 boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
51 boot_mesg "" ${NORMAL}
[bd1b5be]52 $FAILURE_ACTION
[1c48007]53 /etc/rc.d/init.d/halt stop
54 fi
55
[84ce1e3]56 # Create a symlink for POSIX shared memory
57 ln -s /run/shm /dev/shm
58
[1c48007]59 # Udev handles uevents itself, so we don't need to have
60 # the kernel call out to any binary in response to them
[dc55fb5e]61 # This is a failsafe and should be done in kernel config
[1c48007]62 echo > /proc/sys/kernel/hotplug
63
[f2ca25f]64 # Copy the only static device node that Udev >= 155 doesn't
[dc55fb5e]65 # handle to /dev (handled by default with DEVTMPFS)
66 if [ ! -f /dev/null ]; then
67 cp -a /lib/udev/devices/null /dev
68 fi
[1c48007]69
70 # Start the udev daemon to continually watch for, and act on,
71 # uevents
72 /sbin/udevd --daemon
73
74 # Now traverse /sys in order to "coldplug" devices that have
75 # already been discovered
[d93bdd1e]76 /sbin/udevadm trigger --action=add --type=subsystems
77 /sbin/udevadm trigger --action=add --type=devices
[1c48007]78
79 # Now wait for udevd to process the uevents we triggered
80 /sbin/udevadm settle
81 evaluate_retval standard
82 ;;
83
84 *)
85 echo "Usage ${0} {start}"
86 exit 1
87 ;;
88esac
89
90# End $rc_base/init.d/udev
Note: See TracBrowser for help on using the repository browser.