8382bec2bbda4e3f1becc36429d9aa802bbfc2ef
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / eudev / S10udev
1 #!/bin/sh
2 #
3 # udev  This is a minimal non-LSB version of a UDEV startup script.  It
4 #       was derived by stripping down the udev-058 LSB version for use
5 #       with buildroot on embedded hardware using Linux 2.6.34+ kernels.
6 #
7 #       You may need to customize this for your system's resource limits
8 #       (including startup time!) and administration.  For example, if
9 #       your early userspace has a custom initramfs or initrd you might
10 #       need /dev much earlier; or without hotpluggable busses (like USB,
11 #       PCMCIA, MMC/SD, and so on) your /dev might be static after boot.
12 #
13 #       This script assumes your system boots right into the eventual root
14 #       filesystem, and that init runs this udev script before any programs
15 #       needing more device nodes than the bare-bones set -- /dev/console,
16 #       /dev/zero, /dev/null -- that's needed to boot and run this script.
17 #
18
19 # Check for missing binaries
20 UDEV_BIN=/sbin/udevd
21 test -x $UDEV_BIN || exit 5
22
23 # Check for config file and read it
24 UDEV_CONFIG=/etc/udev/udev.conf
25 test -r $UDEV_CONFIG || exit 6
26 . $UDEV_CONFIG
27
28 case "$1" in
29     start)
30         printf "Populating ${udev_root:-/dev} using udev: "
31         printf '\000\000\000\000' > /proc/sys/kernel/hotplug
32         $UDEV_BIN -d || (echo "FAIL" && exit 1)
33         udevadm trigger --type=subsystems --action=add
34         udevadm trigger --type=devices --action=add
35         udevadm settle --timeout=30 || echo "udevadm settle failed"
36         echo "done"
37         ;;
38     stop)
39         # Stop execution of events
40         udevadm control --stop-exec-queue
41         killall udevd
42         ;;
43     *)
44         echo "Usage: $0 {start|stop}"
45         exit 1
46         ;;
47 esac
48
49
50 exit 0