source: bootscripts/lfs/init.d/udev@ 5b77eee

clfs-1.2 clfs-2.1 clfs-3.0.0-systemd clfs-3.0.0-sysvinit systemd sysvinit
Last change on this file since 5b77eee was 163a6701, checked in by Jim Gifford <clfs@…>, 19 years ago

r720@server (orig r718): jim | 2005-11-18 08:06:26 -0800
Added bootscripts to cross-lfs svn

  • Property mode set to 100644
File size: 2.6 KB
Line 
1#!/bin/sh
2########################################################################
3# Begin $rc_base/init.d/udev
4#
5# Description : Udev cold-plugging script
6#
7# Authors : Zack Winkles
8#
9# Version : 00.01
10#
11# Notes :
12#
13########################################################################
14
15. /etc/sysconfig/rc
16. ${rc_functions}
17
18# Create some things that sysfs does not, and should not export for us. Feel
19# free to add devices to this list.
20make_extra_nodes() {
21 ln -s /proc/self/fd /dev/fd
22 ln -s /proc/self/fd/0 /dev/stdin
23 ln -s /proc/self/fd/1 /dev/stdout
24 ln -s /proc/self/fd/2 /dev/stderr
25 ln -s /proc/kcore /dev/core
26 mkdir /dev/pts
27 mkdir /dev/shm
28}
29
30case "${1}" in
31 start)
32 boot_mesg "Populating /dev with device nodes..."
33 if ! grep -q '[[:space:]]sysfs' /proc/mounts; then
34 boot_log " The SysFS filesystem could not be found. Unable to continue."
35 echo_failure
36 boot_mesg -n "FAILURE:\n\nUnable to create" ${FAILURE}
37 boot_mesg -n " devices without a SysFS filesystem"
38 boot_mesg -n "\n\nAfter you press Enter, this system"
39 boot_mesg -n " will be halted and powered off."
40 boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
41 boot_mesg "" ${NORMAL}
42 read ENTER
43 /etc/rc.d/init.d/halt stop
44 fi
45
46 # Mount a temporary file system over /dev, so that any devices
47 # made or removed during this boot don't affect the next one.
48 # The reason we don't write to mtab is because we don't ever
49 # want /dev to be unavailable (such as by `umount -a').
50 mount -n -t tmpfs tmpfs /dev -o mode=755
51 if [ ${?} != 0 ]; then
52 boot_log "Unable to mount a tmpfs onto /dev."
53 echo_failure
54 boot_mesg -n "FAILURE:\n\nCannot mount a tmpfs" ${FAILURE}
55 boot_mesg -n " onto /dev, this system will be halted."
56 boot_mesg -n "\n\nAfter you press Enter, this system"
57 boot_mesg -n " will be halted and powered off."
58 boot_mesg -n "\n\nPress Enter to continue..." ${INFO}
59 boot_mesg "" ${NORMAL}
60 read ENTER
61 /etc/rc.d/init.d/halt stop
62 fi
63
64 # Assign udevsend to get hotplug events. udevsend can manage the whole
65 # hotplug handling by taking over the kernel spawned event process
66 echo /sbin/udevsend > /proc/sys/kernel/hotplug
67
68 # Populate /dev with all the devices that are already available,
69 # and save it's status so we can report failures.
70 udevstart || failed=1
71
72 # Now, create some required files/directories/devices that sysfs
73 # doesn't export for us.
74 make_extra_nodes
75
76 # When reporting the status, base it on the success or failure
77 # of the `udevstart' command, since that's the most important.
78 (exit ${failed})
79 evaluate_retval
80 ;;
81
82 *)
83 echo "Usage ${0} {start}"
84 exit 1
85 ;;
86esac
87
88# End $rc_base/init.d/udev
Note: See TracBrowser for help on using the repository browser.