3 PATH="/usr/sbin:/usr/bin:/sbin:/bin"
5 UDEVSTART=/sbin/udevstart
7 # default maximum size of the /dev ramfs
10 [ -x $UDEVSTART ] || exit 0
16 echo "udev requires a kernel >= 2.6, not started."
21 if ! grep -q '[[:space:]]ramfs$' /proc/filesystems; then
22 echo "udev requires ramfs support, not started."
26 if [ ! -e /proc/sys/kernel/hotplug ]; then
27 echo "udev requires hotplug support, not started."
31 ##############################################################################
33 # we need to unmount /dev/pts/ and remount it later over the ramfs
35 if mountpoint -q /dev/pts/; then
39 if mountpoint -q /dev/shm/; then
44 # mount a ramfs over /dev, if somebody did not already do it
46 if grep -E -q "^[^[:space:]]+ /dev ramfs" /proc/mounts; then
50 # /.dev is used by /sbin/MAKEDEV to access the real /dev directory.
51 # if you don't like this, remove /.dev/.
52 [ -d /.dev ] && mount --bind /dev /.dev
54 echo -n "Mounting a ramfs over /dev..."
55 mount -n -o size=$ramfs_size,mode=0755 -t ramfs none /dev
59 # I hate this hack. -- Md
61 if [ -f /etc/udev/links.conf ]; then
62 grep '^[^#]' /etc/udev/links.conf | \
63 while read type name arg1; do
64 [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue
67 ln -s $arg1 /dev/$name
73 mknod -m 600 /dev/$name $arg1
76 echo "unparseable line ($type $name $arg1)"
83 ##############################################################################
85 if [ "$udev_root" != "/dev" ]; then
86 echo "WARNING: udev_root != /dev"
90 if [ -e "$udev_root/.udev.tdb" ]; then
91 if mountpoint -q /dev/; then
92 echo "FATAL: udev is already active on $udev_root."
95 echo "WARNING: .udev.tdb already exists on the old $udev_root!"
98 mount -n -o size=$ramfs_size,mode=0755 -t ramfs none $udev_root
99 echo -n "Creating initial device nodes..."
104 start-stop-daemon -K -x /sbin/udevd
105 echo -n "Unmounting $udev_root..."
106 # unmounting with -l should never fail
107 if umount -l $udev_root; then
113 restart|force-reload)
118 echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"
124 fi # udev_root != /dev/
126 ##############################################################################
127 # When modifying this script, do not forget that between the time that
128 # the new /dev has been mounted and udevstart has been run there will be
129 # no /dev/null. This also means that you cannot use the "&" shell command.
133 if [ -e "$udev_root/.udev.tdb" ]; then
134 if mountpoint -q /dev/; then
135 echo "FATAL: udev is already active on $udev_root."
138 echo "WARNING: .udev.tdb already exists on the old $udev_root!"
144 echo -n "Creating initial device nodes..."
148 # /etc/init.d/mountvirtfs start
151 start-stop-daemon -K -x /sbin/udevd
153 echo -n "Unmounting /dev..."
154 # unmounting with -l should never fail
155 if umount -l /dev; then
157 umount -l /.dev || true
158 # /etc/init.d/mountvirtfs start
163 restart|force-reload)
164 start-stop-daemon -K -x /sbin/udevd
165 echo -n "Recreating device nodes..."
172 echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}"