22
# mount a tmpfs over /dev, if somebody did not already do it
24
if grep -E -q "^[^[:space:]]+ /dev (dev)?tmpfs" /proc/mounts; then
25
mount -n -o remount,${dev_mount_options} -t tmpfs tmpfs /dev
22
# mount a devtmpfs over /dev, if somebody did not already do it
24
if grep -E -q "^[^[:space:]]+ /dev devtmpfs" /proc/mounts; then
25
mount -n -o remount,size=$tmpfs_size,mode=0755 -t devtmpfs devtmpfs /dev
29
if ! mount -n -o $dev_mount_options -t tmpfs tmpfs /dev; then
30
log_failure_msg "udev requires tmpfs support, not started"
29
if ! mount -n -o size=$tmpfs_size,mode=0755 -t devtmpfs devtmpfs /dev; then
30
log_failure_msg "udev requires devtmpfs support, not started"
45
45
# If the initramfs does not have /run, the initramfs udev database must
46
46
# be migrated from /dev/.udev/ to /run/udev/.
47
47
move_udev_database() {
48
[ -e "$udev_root/.udev/" ] || return 0
48
[ -e "/dev/.udev/" ] || return 0
49
49
[ ! -e /run/udev/ ] || return 0
50
50
[ -e /run/ ] || return 0
51
51
mountpoint -q /run/ || return 0
53
mv $udev_root/.udev/ /run/udev/ || true
53
mv /dev/.udev/ /run/udev/ || true
56
56
supported_kernel() {
116
if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then
117
log_failure_msg "udev requires tmpfs support, not started"
115
if ! grep -q '[[:space:]]devtmpfs$' /proc/filesystems; then
116
log_failure_msg "udev requires devtmpfs support, not started"
143
##############################################################################
145
# this is experimental and may not work well
146
if [ "$UDEV_DISABLED" = "yes" ]; then
147
udev_root=/etc/udev/.dev
148
export UDEV_ROOT=$udev_root
151
udev_root=${udev_root%/}
153
dev_mount_options='mode=0755'
154
if [ "$tmpfs_size" ]; then
155
dev_mount_options="size=${tmpfs_size},${dev_mount_options}"
158
if [ "$udev_root" != "/dev" ]; then
159
log_warning_msg "udev_root != /dev/"
163
if init_is_upstart 2>/dev/null; then
166
if mountpoint -q $udev_root/; then
167
log_failure_msg "$udev_root is already mounted"
171
echo > /sys/kernel/uevent_helper
173
mount -n -o $dev_mount_options -t tmpfs tmpfs $udev_root
175
log_daemon_msg "Starting the hotplug events dispatcher" "udevd"
176
if udevd --daemon; then
180
log_warning_msg "Waiting 15 seconds and trying to continue anyway"
184
/lib/udev/write_dev_root_rule
186
log_action_begin_msg "Synthesizing the initial hotplug events"
187
if udevadm trigger --action=add; then
188
log_action_end_msg $?
190
log_action_end_msg $?
195
# make sure a manual invocation of the init script doesn't stop an
196
# upstart-controlled instance of udev
197
if init_is_upstart 2>/dev/null && status udev | grep -q start; then
200
log_daemon_msg "Stopping the hotplug events dispatcher" "udevd"
201
if start-stop-daemon --stop --name udevd --user root --quiet --oknodo --retry 5; then
207
log_action_begin_msg "Unmounting $udev_root"
208
# unmounting with -l should never fail
209
if umount -n -l $udev_root; then
210
log_action_end_msg $?
212
log_action_end_msg $?
217
if init_is_upstart 2>/dev/null; then
220
log_daemon_msg "Stopping the hotplug events dispatcher" "udevd"
221
if start-stop-daemon --stop --name udevd --user root --quiet --oknodo --retry 5; then
224
log_end_msg $? || true
227
log_daemon_msg "Starting the hotplug events dispatcher" "udevd"
228
if udevd --daemon; then
236
udevadm control --reload-rules
240
status_of_proc /sbin/udevd udevd && exit 0 || exit $?
244
echo "Usage: /etc/init.d/udev {start|stop|restart|reload|force-reload|status}" >&2
250
fi # udev_root != /dev
252
##############################################################################
254
142
# When modifying this script, do not forget that between the time that the
255
143
# new /dev has been mounted and udevadm trigger has been run there will be
256
144
# no /dev/null. This also means that you cannot use the "&" shell command.
260
148
if init_is_upstart 2>/dev/null; then
263
if mountpoint -q $udev_root/; then
151
if mountpoint -q /dev/; then
265
elif [ -e "$udev_root/.udev/" ]; then
266
log_warning_msg ".udev/ already exists on the static $udev_root"
153
elif [ -e "/dev/.udev/" ]; then
154
log_warning_msg ".udev/ already exists on the static /dev"
269
if [ ! -e "$udev_root/.udev/" -a ! -e "/run/udev/" ]; then
157
if [ ! -e "/dev/.udev/" -a ! -e "/run/udev/" ]; then
270
158
warn_if_interactive