diff options
| author | Otavio Salvador <otavio@ossystems.com.br> | 2011-12-20 13:00:05 +0000 |
|---|---|---|
| committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-01-03 12:14:27 +0000 |
| commit | f4e60ec827d574efdd74663c4904a7da51304fcc (patch) | |
| tree | 43959cb13d4b1a13734dad04f79921316e8e8c19 /meta/recipes-core/udev/files/init | |
| parent | a99a63959b2e91519a26ff6305729b1072e638fa (diff) | |
| download | poky-f4e60ec827d574efdd74663c4904a7da51304fcc.tar.gz | |
udev: drop 145 version
The 164 version has been the default version for some time and as we
don't have any clear reasoning to keep 145 around, we're removing it
now.
Some files were also removed as 164 recipe provides specific versions
of it and thus those were going to be unused.
(From OE-Core rev: 7376f027c39716561b513a70f6e7f86fb14df178)
Signed-off-by: Otavio Salvador <otavio@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev/files/init')
| -rwxr-xr-x | meta/recipes-core/udev/files/init | 212 |
1 files changed, 0 insertions, 212 deletions
diff --git a/meta/recipes-core/udev/files/init b/meta/recipes-core/udev/files/init deleted file mode 100755 index 8cbab188f0..0000000000 --- a/meta/recipes-core/udev/files/init +++ /dev/null | |||
| @@ -1,212 +0,0 @@ | |||
| 1 | #!/bin/sh -e | ||
| 2 | |||
| 3 | UDEVSTART=/sbin/udevstart | ||
| 4 | |||
| 5 | # defaults | ||
| 6 | tmpfs_size="10M" | ||
| 7 | udev_root="/dev" | ||
| 8 | |||
| 9 | [ -x $UDEVSTART ] || exit 0 | ||
| 10 | |||
| 11 | . /etc/udev/udev.conf | ||
| 12 | |||
| 13 | ############################################################################## | ||
| 14 | |||
| 15 | # we need to unmount /dev/pts/ and remount it later over the tmpfs | ||
| 16 | unmount_devpts() { | ||
| 17 | if mountpoint -q /dev/pts/; then | ||
| 18 | umount -l /dev/pts/ | ||
| 19 | fi | ||
| 20 | |||
| 21 | if mountpoint -q /dev/shm/; then | ||
| 22 | umount -l /dev/shm/ | ||
| 23 | fi | ||
| 24 | } | ||
| 25 | |||
| 26 | # mount a tmpfs over /dev, if somebody did not already do it | ||
| 27 | mount_tmpfs() { | ||
| 28 | if grep -E -q "^[^[:space:]]+ /dev tmpfs" /proc/mounts; then | ||
| 29 | return 0 | ||
| 30 | fi | ||
| 31 | |||
| 32 | # /dev/.static/dev/ is used by MAKEDEV to access the real /dev/ directory. | ||
| 33 | # /etc/udev/ is recycled as a temporary mount point because it's the only | ||
| 34 | # directory which is guaranteed to be available. | ||
| 35 | mount -n -o bind /dev /etc/udev | ||
| 36 | |||
| 37 | if ! mount -n -o size=$tmpfs_size,mode=0755 -t tmpfs tmpfs /dev; then | ||
| 38 | umount /etc/udev | ||
| 39 | echo "udev requires tmpfs support, not started." | ||
| 40 | exit 1 | ||
| 41 | fi | ||
| 42 | |||
| 43 | # using ln to test if /dev works, because touch is in /usr/bin/ | ||
| 44 | if ln -s test /dev/test-file; then | ||
| 45 | rm /dev/test-file | ||
| 46 | else | ||
| 47 | echo "udev requires tmpfs support, not started." | ||
| 48 | umount /etc/udev | ||
| 49 | umount /dev | ||
| 50 | exit 1 | ||
| 51 | fi | ||
| 52 | |||
| 53 | mkdir -p /dev/.static/dev | ||
| 54 | chmod 700 /dev/.static/ | ||
| 55 | # The mount options in busybox are non-standard... | ||
| 56 | if test -x /bin/mount.util-linux | ||
| 57 | then | ||
| 58 | /bin/mount.util-linux --move /etc/udev /dev/.static/dev | ||
| 59 | elif test -x /bin/busybox | ||
| 60 | then | ||
| 61 | busybox mount -n -o move /etc/udev /dev/.static/dev | ||
| 62 | else | ||
| 63 | echo "udev requires an identifiable mount command, not started." | ||
| 64 | umount /etc/udev | ||
| 65 | umount /dev | ||
| 66 | exit 1 | ||
| 67 | fi | ||
| 68 | } | ||
| 69 | |||
| 70 | # I hate this hack. -- Md | ||
| 71 | make_extra_nodes() { | ||
| 72 | [ -e /etc/udev/links.conf ] || return 0 | ||
| 73 | grep '^[^#]' /etc/udev/links.conf | \ | ||
| 74 | while read type name arg1; do | ||
| 75 | [ "$type" -a "$name" -a ! -e "/dev/$name" -a ! -L "/dev/$name" ] ||continue | ||
| 76 | case "$type" in | ||
| 77 | L) ln -s $arg1 /dev/$name ;; | ||
| 78 | D) mkdir -p /dev/$name ;; | ||
| 79 | M) mknod -m 600 /dev/$name $arg1 ;; | ||
| 80 | *) echo "links.conf: unparseable line ($type $name $arg1)" ;; | ||
| 81 | esac | ||
| 82 | done | ||
| 83 | } | ||
| 84 | |||
| 85 | # this function is duplicated in preinst, postinst and d-i | ||
| 86 | supported_kernel() { | ||
| 87 | case "$(uname -r)" in | ||
| 88 | 2.[012345].*|2.6.[0-9]|2.6.[0-9][!0-9]*) return 1 ;; | ||
| 89 | 2.6.1[01]|2.6.1[01][!0-9]*) return 1 ;; | ||
| 90 | esac | ||
| 91 | return 0 | ||
| 92 | } | ||
| 93 | |||
| 94 | # shell version of /usr/bin/tty | ||
| 95 | my_tty() { | ||
| 96 | [ -x /bin/readlink ] || return 0 | ||
| 97 | [ -e /proc/self/fd/0 ] || return 0 | ||
| 98 | readlink --silent /proc/self/fd/0 || true | ||
| 99 | } | ||
| 100 | |||
| 101 | warn_if_interactive() { | ||
| 102 | if [ "$RUNLEVEL" = "S" -a "$PREVLEVEL" = "N" ]; then | ||
| 103 | return 0 | ||
| 104 | fi | ||
| 105 | |||
| 106 | TTY=$(my_tty) | ||
| 107 | if [ -z "$TTY" -o "$TTY" = "/dev/console" ]; then | ||
| 108 | return 0 | ||
| 109 | fi | ||
| 110 | |||
| 111 | printf "\n\n\nIt has been detected that the command\n\n\t$0 $*\n\n" | ||
| 112 | printf "has been run from an interactive shell.\n" | ||
| 113 | printf "It will probably not do what you expect, so this script will wait\n" | ||
| 114 | printf "60 seconds before continuing. Press ^C to stop it.\n" | ||
| 115 | printf "RUNNING THIS COMMAND IS HIGHLY DISCOURAGED!\n\n\n\n" | ||
| 116 | sleep 60 | ||
| 117 | } | ||
| 118 | |||
| 119 | ############################################################################## | ||
| 120 | |||
| 121 | if ! supported_kernel; then | ||
| 122 | echo "udev requires a kernel >= 2.6.12, not started." | ||
| 123 | exit 1 | ||
| 124 | fi | ||
| 125 | |||
| 126 | if [ ! -e /proc/filesystems ]; then | ||
| 127 | echo "udev requires a mounted procfs, not started." | ||
| 128 | exit 1 | ||
| 129 | fi | ||
| 130 | |||
| 131 | if ! grep -q '[[:space:]]tmpfs$' /proc/filesystems; then | ||
| 132 | echo "udev requires tmpfs support, not started." | ||
| 133 | exit 1 | ||
| 134 | fi | ||
| 135 | |||
| 136 | if [ ! -d /sys/class/ ]; then | ||
| 137 | echo "udev requires a mounted sysfs, not started." | ||
| 138 | exit 1 | ||
| 139 | fi | ||
| 140 | |||
| 141 | if [ ! -e /proc/sys/kernel/hotplug ] && [ ! -e /sys/kernel/uevent_helper ]; then | ||
| 142 | echo "udev requires hotplug support, not started." | ||
| 143 | exit 1 | ||
| 144 | fi | ||
| 145 | |||
| 146 | ############################################################################## | ||
| 147 | |||
| 148 | # When modifying this script, do not forget that between the time that | ||
| 149 | # the new /dev has been mounted and udevstart has been run there will be | ||
| 150 | # no /dev/null. This also means that you cannot use the "&" shell command. | ||
| 151 | |||
| 152 | case "$1" in | ||
| 153 | start) | ||
| 154 | if [ -e "$udev_root/.udevdb" ]; then | ||
| 155 | if mountpoint -q /dev/; then | ||
| 156 | TMPFS_MOUNTED=1 | ||
| 157 | else | ||
| 158 | echo ".udevdb already exists on the old $udev_root!" | ||
| 159 | fi | ||
| 160 | fi | ||
| 161 | warn_if_interactive | ||
| 162 | |||
| 163 | #echo /sbin/udevsend > /proc/sys/kernel/hotplug | ||
| 164 | if [ -e /sys/kernel/uevent_helper ] ; then | ||
| 165 | echo "" > /sys/kernel/uevent_helper | ||
| 166 | else | ||
| 167 | echo "" > /proc/sys/kernel/hotplug | ||
| 168 | fi | ||
| 169 | udevsend | ||
| 170 | if [ "$UDEV_DISABLED" = "yes" ]; then | ||
| 171 | echo "udev disabled on the kernel command line, not started." | ||
| 172 | exit 0 | ||
| 173 | fi | ||
| 174 | |||
| 175 | if [ ! "$TMPFS_MOUNTED" ]; then | ||
| 176 | unmount_devpts | ||
| 177 | mount_tmpfs | ||
| 178 | [ -d /proc/1 ] || mount -n /proc | ||
| 179 | # if this directory is not present /dev will not be updated by udev | ||
| 180 | mkdir /dev/.udevdb/ | ||
| 181 | echo "Creating initial device nodes..." | ||
| 182 | udevstart | ||
| 183 | fi | ||
| 184 | make_extra_nodes | ||
| 185 | ;; | ||
| 186 | stop) | ||
| 187 | warn_if_interactive | ||
| 188 | start-stop-daemon --stop --exec /sbin/udevd --quiet | ||
| 189 | unmount_devpts | ||
| 190 | if [ -d /dev/.static/dev/ ]; then | ||
| 191 | umount -l /dev/.static/dev/ || true | ||
| 192 | fi | ||
| 193 | echo "Unmounting /dev..." | ||
| 194 | # unmounting with -l should never fail | ||
| 195 | if ! umount -l /dev; then | ||
| 196 | exit 1 | ||
| 197 | fi | ||
| 198 | ;; | ||
| 199 | restart|force-reload) | ||
| 200 | start-stop-daemon --stop --exec /sbin/udevd --quiet | ||
| 201 | log_begin_msg "Recreating device nodes..." | ||
| 202 | udevstart | ||
| 203 | make_extra_nodes | ||
| 204 | log_end_msg 0 | ||
| 205 | ;; | ||
| 206 | *) | ||
| 207 | echo "Usage: /etc/init.d/udev {start|stop|restart|force-reload}" | ||
| 208 | exit 1 | ||
| 209 | ;; | ||
| 210 | esac | ||
| 211 | |||
| 212 | exit 0 | ||
