diff options
author | Martin Jansa <martin.jansa@gmail.com> | 2012-07-30 17:03:14 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-04 14:08:35 +0100 |
commit | 0cc01a67f1c0bf1bff491c9c644348d6be318a72 (patch) | |
tree | 2c090dc35a587707b0944162cd265a4c7574b4e9 /meta/recipes-core/udev/udev | |
parent | c5003a45d9c54a7a6d1c78799b8c2e3962cf1e52 (diff) | |
download | poky-0cc01a67f1c0bf1bff491c9c644348d6be318a72.tar.gz |
udev-extraconf: Merge with udev-extra-rules from meta-oe
* Move parts of local.rules from udev to udev-extraconf
* Move mount.sh and network.sh to udev-extraconf along with rule fragments
* Add mount.blacklist to CONFFILES
* Change PV to 1.0 and bump PR to provide upgrade path from meta-oe's udev-extra-rules
including RREPLACE/RPROVIDES/RCONFLICTS trio
(From OE-Core rev: 0ca3a7823e97c4e4af6e89d852f98d29ed6193d7)
Signed-off-by: Martin Jansa <Martin.Jansa@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core/udev/udev')
-rw-r--r-- | meta/recipes-core/udev/udev/local.rules | 14 | ||||
-rw-r--r-- | meta/recipes-core/udev/udev/mount.sh | 68 | ||||
-rw-r--r-- | meta/recipes-core/udev/udev/network.sh | 52 |
3 files changed, 0 insertions, 134 deletions
diff --git a/meta/recipes-core/udev/udev/local.rules b/meta/recipes-core/udev/udev/local.rules index 625e49acb1..72d92ef627 100644 --- a/meta/recipes-core/udev/udev/local.rules +++ b/meta/recipes-core/udev/udev/local.rules | |||
@@ -13,20 +13,6 @@ | |||
13 | # %% the '%' char itself | 13 | # %% the '%' char itself |
14 | # | 14 | # |
15 | 15 | ||
16 | # Media automounting | ||
17 | SUBSYSTEM=="block", ACTION=="add" RUN+="/etc/udev/scripts/mount.sh" | ||
18 | SUBSYSTEM=="block", ACTION=="remove" RUN+="/etc/udev/scripts/mount.sh" | ||
19 | |||
20 | # Handle network interface setup | ||
21 | SUBSYSTEM=="net", ACTION=="add" RUN+="/etc/udev/scripts/network.sh" | ||
22 | SUBSYSTEM=="net", ACTION=="remove" RUN+="/etc/udev/scripts/network.sh" | ||
23 | |||
24 | # The first framebuffer is symlinked to /dev/fb | ||
25 | KERNEL=="fb0", SYMLINK+="fb" | ||
26 | |||
27 | # The first rtc device is symlinked to /dev/rtc | ||
28 | KERNEL=="rtc0", SYMLINK+="rtc" | ||
29 | |||
30 | # Try and modprobe for drivers for new hardware | 16 | # Try and modprobe for drivers for new hardware |
31 | ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" | 17 | ACTION=="add", DEVPATH=="/devices/*", ENV{MODALIAS}=="?*", RUN+="/sbin/modprobe $env{MODALIAS}" |
32 | 18 | ||
diff --git a/meta/recipes-core/udev/udev/mount.sh b/meta/recipes-core/udev/udev/mount.sh deleted file mode 100644 index c13b8bbb3b..0000000000 --- a/meta/recipes-core/udev/udev/mount.sh +++ /dev/null | |||
@@ -1,68 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | # | ||
3 | # Called from udev | ||
4 | # | ||
5 | # Attempt to mount any added block devices and umount any removed devices | ||
6 | |||
7 | |||
8 | MOUNT="/bin/mount" | ||
9 | PMOUNT="/usr/bin/pmount" | ||
10 | UMOUNT="/bin/umount" | ||
11 | |||
12 | for line in `cat /etc/udev/mount.blacklist` | ||
13 | do | ||
14 | if [ ` expr match "$DEVNAME" "$line" ` -gt 0 ]; | ||
15 | then | ||
16 | logger "udev/mount.sh" "[$DEVNAME] is blacklisted, ignoring" | ||
17 | exit 0 | ||
18 | fi | ||
19 | done | ||
20 | |||
21 | automount() { | ||
22 | name="`basename "$DEVNAME"`" | ||
23 | |||
24 | ! test -d "/media/$name" && mkdir -p "/media/$name" | ||
25 | |||
26 | if ! $MOUNT -t auto $DEVNAME "/media/$name" | ||
27 | then | ||
28 | #logger "mount.sh/automount" "$MOUNT -t auto $DEVNAME \"/media/$name\" failed!" | ||
29 | rm_dir "/media/$name" | ||
30 | else | ||
31 | logger "mount.sh/automount" "Auto-mount of [/media/$name] successful" | ||
32 | touch "/tmp/.automount-$name" | ||
33 | fi | ||
34 | } | ||
35 | |||
36 | rm_dir() { | ||
37 | # We do not want to rm -r populated directories | ||
38 | if test "`find "$1" | wc -l | tr -d " "`" -lt 2 -a -d "$1" | ||
39 | then | ||
40 | ! test -z "$1" && rm -r "$1" | ||
41 | else | ||
42 | logger "mount.sh/automount" "Not removing non-empty directory [$1]" | ||
43 | fi | ||
44 | } | ||
45 | |||
46 | if [ "$ACTION" = "add" ] && [ -n "$DEVNAME" ]; then | ||
47 | if [ -x "$PMOUNT" ]; then | ||
48 | $PMOUNT $DEVNAME 2> /dev/null | ||
49 | elif [ -x $MOUNT ]; then | ||
50 | $MOUNT $DEVNAME 2> /dev/null | ||
51 | fi | ||
52 | |||
53 | # If the device isn't mounted at this point, it isn't configured in fstab | ||
54 | grep -q "^$DEVNAME " /proc/mounts || automount | ||
55 | fi | ||
56 | |||
57 | |||
58 | |||
59 | if [ "$ACTION" = "remove" ] && [ -x "$UMOUNT" ] && [ -n "$DEVNAME" ]; then | ||
60 | for mnt in `cat /proc/mounts | grep "$DEVNAME" | cut -f 2 -d " " ` | ||
61 | do | ||
62 | $UMOUNT $mnt | ||
63 | done | ||
64 | |||
65 | # Remove empty directories from auto-mounter | ||
66 | name="`basename "$DEVNAME"`" | ||
67 | test -e "/tmp/.automount-$name" && rm_dir "/media/$name" | ||
68 | fi | ||
diff --git a/meta/recipes-core/udev/udev/network.sh b/meta/recipes-core/udev/udev/network.sh deleted file mode 100644 index bccd422dbf..0000000000 --- a/meta/recipes-core/udev/udev/network.sh +++ /dev/null | |||
@@ -1,52 +0,0 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | # We get two "add" events for hostap cards due to wifi0 | ||
4 | echo "$INTERFACE" | grep -q wifi && exit 0 | ||
5 | |||
6 | |||
7 | # Check if /etc/init.d/network has been run yet to see if we are | ||
8 | # called by starting /etc/rcS.d/S03udev and not by hotplugging a device | ||
9 | # | ||
10 | # At this stage, network interfaces should not be brought up | ||
11 | # automatically because: | ||
12 | # a) /etc/init.d/network has not been run yet (security issue) | ||
13 | # b) /var has not been populated yet so /etc/resolv,conf points to | ||
14 | # oblivion, making the network unusable | ||
15 | # | ||
16 | |||
17 | spoofp="`grep ^spoofprotect /etc/network/options`" | ||
18 | if test -z "$spoofp" | ||
19 | then | ||
20 | # This is the default from /etc/init.d/network | ||
21 | spoofp_val=yes | ||
22 | else | ||
23 | spoofp_val=${spoofp#spoofprotect=} | ||
24 | fi | ||
25 | |||
26 | test "$spoofp_val" = yes && spoofp_val=1 || spoofp_val=0 | ||
27 | |||
28 | # I think it is safe to assume that "lo" will always be there ;) | ||
29 | if test "`cat /proc/sys/net/ipv4/conf/lo/rp_filter`" != "$spoofp_val" -a -n "$spoofp_val" | ||
30 | then | ||
31 | echo "$INTERFACE" >> /dev/udev_network_queue | ||
32 | exit 0 | ||
33 | fi | ||
34 | |||
35 | # | ||
36 | # Code taken from pcmcia-cs:/etc/pcmcia/network | ||
37 | # | ||
38 | |||
39 | # if this interface has an entry in /etc/network/interfaces, let ifupdown | ||
40 | # handle it | ||
41 | if grep -q "iface \+$INTERFACE" /etc/network/interfaces; then | ||
42 | case $ACTION in | ||
43 | add) | ||
44 | ifconfig | grep -q "^$INTERFACE" || ifup $INTERFACE | ||
45 | ;; | ||
46 | remove) | ||
47 | ifdown $INTERFACE | ||
48 | ;; | ||
49 | esac | ||
50 | |||
51 | exit 0 | ||
52 | fi | ||