summaryrefslogtreecommitdiff
path: root/sys-fs
diff options
context:
space:
mode:
authorMatthias Schwarzott <zzam@gentoo.org>2010-10-30 13:53:54 +0000
committerMatthias Schwarzott <zzam@gentoo.org>2010-10-30 13:53:54 +0000
commitc780f08fe7c20b63906bfe6dfdd4ac44ed59b2ad (patch)
tree10699779983c39f04317d59f6d422b603fd8a810 /sys-fs
parentNew addition (diff)
downloadhistorical-c780f08fe7c20b63906bfe6dfdd4ac44ed59b2ad.tar.gz
historical-c780f08fe7c20b63906bfe6dfdd4ac44ed59b2ad.tar.bz2
historical-c780f08fe7c20b63906bfe6dfdd4ac44ed59b2ad.zip
Version bumped. Changed udev-postmount script to better check for ro filesystems and non bash shells. Bugs 342403, 326825. Remove /dev/loop if it is empty, Bug #338766.
Package-Manager: portage-2.2.0_alpha2/cvs/Linux x86_64
Diffstat (limited to 'sys-fs')
-rw-r--r--sys-fs/udev/ChangeLog15
-rw-r--r--sys-fs/udev/Manifest25
-rw-r--r--sys-fs/udev/files/164/40-gentoo.rules14
-rw-r--r--sys-fs/udev/files/164/90-network.rules8
-rw-r--r--sys-fs/udev/files/164/shell-compat-KV.sh45
-rw-r--r--sys-fs/udev/files/164/shell-compat-addon.sh71
-rw-r--r--sys-fs/udev/files/164/udev-dev-tarball.initd95
-rw-r--r--sys-fs/udev/files/164/udev-mount.initd107
-rw-r--r--sys-fs/udev/files/164/udev-postmount.initd53
-rw-r--r--sys-fs/udev/files/164/udev-start.sh55
-rw-r--r--sys-fs/udev/files/164/udev-stop.sh13
-rw-r--r--sys-fs/udev/files/164/udev.confd64
-rw-r--r--sys-fs/udev/files/164/udev.initd272
-rw-r--r--sys-fs/udev/udev-164.ebuild568
14 files changed, 1403 insertions, 2 deletions
diff --git a/sys-fs/udev/ChangeLog b/sys-fs/udev/ChangeLog
index f4a5f7757d54..cd3496476295 100644
--- a/sys-fs/udev/ChangeLog
+++ b/sys-fs/udev/ChangeLog
@@ -1,6 +1,19 @@
# ChangeLog for sys-fs/udev
# Copyright 1999-2010 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v 1.561 2010/10/29 06:13:22 jer Exp $
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v 1.562 2010/10/30 13:53:54 zzam Exp $
+
+*udev-164 (30 Oct 2010)
+
+ 30 Oct 2010; Matthias Schwarzott <zzam@gentoo.org>
+ +files/164/40-gentoo.rules, +files/164/90-network.rules,
+ +files/164/shell-compat-KV.sh, +files/164/shell-compat-addon.sh,
+ +files/164/udev.confd, +files/164/udev.initd,
+ +files/164/udev-dev-tarball.initd, +files/164/udev-mount.initd,
+ +files/164/udev-postmount.initd, +udev-164.ebuild,
+ +files/164/udev-start.sh, +files/164/udev-stop.sh:
+ Version bumped. Changed udev-postmount script to better check for ro
+ filesystems and non bash shells. Bugs 342403, 326825. Remove /dev/loop if
+ it is empty, Bug #338766.
29 Oct 2010; Jeroen Roovers <jer@gentoo.org> udev-151-r4.ebuild:
Stable for HPPA (bug #324507).
diff --git a/sys-fs/udev/Manifest b/sys-fs/udev/Manifest
index 11294339488c..a37d1890046e 100644
--- a/sys-fs/udev/Manifest
+++ b/sys-fs/udev/Manifest
@@ -1,3 +1,6 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA1
+
AUX 136/shell-compat-KV.sh 1012 RMD160 5bc85047b4237d502f7b0ccc7181f9974c2b0898 SHA1 bbc58d6181f3fc8d623de1537eddcc1ede919202 SHA256 2393918bc65c69e1c19d7712292c945a4adfe45ce02b88ae7663167b8745cf8b
AUX 136/shell-compat-addon.sh 930 RMD160 c96a77a2085698e4ca3636994d1b6d07326e4b5f SHA1 d696a1ff942d31b493d385cff27bc9cbacd3fa47 SHA256 94b1fe1f5ba892c82798cec6f15b5c5c76e1902ef2d13701ddfbb54f19079af9
AUX 136/udev-dev-tarball.initd 2579 RMD160 b7feb34f854a3eb08d1203f1faabf9cecee3101c SHA1 10ecda997314851d86a175db8cbfcc6a343e9bb2 SHA256 a829fa3efb9d6aadb137cb8879b8bc2660ef6500b2dbb8d55db8edf52f332d60
@@ -47,6 +50,17 @@ AUX 161/udev-start.sh 1355 RMD160 dee6ec04573d9b91fdd8aaf772cd4e665b859b6e SHA1
AUX 161/udev-stop.sh 237 RMD160 453c91a97f6b8410e8452d87f27b96970b3521b7 SHA1 72dbec362ab56d9e74c780d73ffc954250608416 SHA256 6b0f6a04cd881fc4baefbeccfa52d7c9db0396a7d0ff178373cb730189b9f84f
AUX 161/udev.confd 2003 RMD160 a6dc9af31a3a1374e7c71547c0d57c6c0698f9c5 SHA1 c6e8473952249ab48f1018f675904ff513b1bda1 SHA256 e47efd1839066b0ce38b84b6c881329363b2135f963327b704ad6bb8b4ea4cba
AUX 161/udev.initd 6672 RMD160 03e40f4d1de94a275b72a2a5c2f2614c66b8bed4 SHA1 34040e5fbb03d6e7e3f6f4d85a73998b3be648d6 SHA256 1a308d57e6e0fc9e2ca4cdcc4dcdce66c61facfa0675403b0fbbfd89dae067fe
+AUX 164/40-gentoo.rules 349 RMD160 e2f86db2c5839ce73b08006889c0aa6ff9ba1185 SHA1 14db0043b408e10c8c2e7e4d03de96c10208e5c9 SHA256 5d618b899475925ceccc330b6a738644aedd582d039f0cc404502637351347ea
+AUX 164/90-network.rules 280 RMD160 5e6877819613fbdb0d0c7e8d042e3f3f91247c29 SHA1 25f5abe857a1fe21fa3b035bb88f3d3f81e77b4e SHA256 ba1628cf8df2780546fb158946f1591ef4e4177186d44705e27e71b417590b55
+AUX 164/shell-compat-KV.sh 1012 RMD160 613bddb3853cb0e60ff9a115bc65b331e4937a2e SHA1 42fc07fbc8cd4ac8c7379a5d6df2a2db044d185b SHA256 ea54899826853c2df53beff744b3401c4676dc9667a48abed72bed4e6b9f3f7c
+AUX 164/shell-compat-addon.sh 1706 RMD160 92dd4c3b6fdbdd3ccbaf6d0ae21a6a472f0b4026 SHA1 1a41e6c59c48e795ca946a78dc17d00c579481cb SHA256 4883b9ab305372a93b1c344d1a586cc6e7d1177b8a0e697869ec9f62c84ca6c2
+AUX 164/udev-dev-tarball.initd 2579 RMD160 9c9b80177683ae5a3f5f63668c7a6455025a7431 SHA1 6f46db14fbbace485e80eb1c989929ec5674b04a SHA256 950c8c25b4dccafbd703bcfe5073750e4ce07bdce74305c7c22b9ed3cc8b161c
+AUX 164/udev-mount.initd 2707 RMD160 76afc0c54e3c185bc4a1220872c374ddfe3bb933 SHA1 ee1be53df5da7e7db7f0a009d8eb3236bc3c2baf SHA256 e7509016546307ce08703921086a5531d19da709e1f8f5217042f3c5e54dd847
+AUX 164/udev-postmount.initd 1279 RMD160 d1b0e355ece627013f853c7411ab03fffdec2fd7 SHA1 01a647771c5b17daac2bff70bd0c998a6bf61dce SHA256 90762e488887c488e28a4687c370dfb69302d36aa2b9b164c57059b182a15bca
+AUX 164/udev-start.sh 1355 RMD160 dee6ec04573d9b91fdd8aaf772cd4e665b859b6e SHA1 84f73cd4acf69592f3ce7050c9b8ed8fd5d03486 SHA256 92cd1683dd12690994d129fbea9b7e6c63e016959622bac496634f5624dcfe38
+AUX 164/udev-stop.sh 237 RMD160 453c91a97f6b8410e8452d87f27b96970b3521b7 SHA1 72dbec362ab56d9e74c780d73ffc954250608416 SHA256 6b0f6a04cd881fc4baefbeccfa52d7c9db0396a7d0ff178373cb730189b9f84f
+AUX 164/udev.confd 2003 RMD160 a6dc9af31a3a1374e7c71547c0d57c6c0698f9c5 SHA1 c6e8473952249ab48f1018f675904ff513b1bda1 SHA256 e47efd1839066b0ce38b84b6c881329363b2135f963327b704ad6bb8b4ea4cba
+AUX 164/udev.initd 6672 RMD160 03e40f4d1de94a275b72a2a5c2f2614c66b8bed4 SHA1 34040e5fbb03d6e7e3f6f4d85a73998b3be648d6 SHA256 1a308d57e6e0fc9e2ca4cdcc4dcdce66c61facfa0675403b0fbbfd89dae067fe
AUX blacklist-110 854 RMD160 6cb0acd91dad5c86c47b41f06f74a8529de08b8e SHA1 aa2c3c8340517053151ee687d76d4de05e28ac51 SHA256 438020f3499a2e10a19ba8d3fe7d567572322093ea878e8c18336b067442bcdd
AUX blacklist-146 950 RMD160 cc53bfcd2c56bca3cd65b745db80a821122b5c82 SHA1 bdfc5e83d17cef31b6f98546040e1ddf39af3795 SHA256 12d60698be657c9c5b40c8cb6c3649d02f8d8c8f05d63dab7c8bee0a30c339c4
AUX modprobe-114.sh 2106 RMD160 7b40f1d0c7e41aa51100c99d1b4accafe9309f00 SHA1 d8d3a6b047a416bf4a80a9dde6eddbcc1e7abb1b SHA256 acfff1be773352f71b7e68ec12aafa113150f76ecb1daa03088842d449df9d6b
@@ -95,6 +109,7 @@ DIST udev-151-testsys.tar.bz2 137712 RMD160 be8c9c99a770b9ba48449dbbea3b4a6367c0
DIST udev-151.tar.bz2 509815 RMD160 4faf310f72df791fae7f579e57964ba9ab705638 SHA1 04bab1fd73797815b0f2412edcf1070acd35bce1 SHA256 d37a94e75b962182ce940e4a839f07b1c7024dbe7e4b870a120bf0fe9ed0d55d
DIST udev-162.tar.bz2 547687 RMD160 eae0acab1053ce71d6adaecea4539c70c981cc6b SHA1 fca52717a09502b093a7c5f4ecc98a735e52c982 SHA256 dc1534fe1713e28fcf3c89b20cfeee027b8d74dfed1ccd98761cc86cc818becc
DIST udev-163.tar.bz2 556941 RMD160 d554e158d9a05737c1b86f2b49399904dea9fc50 SHA1 a8232bbb3d59344b99a142db1178bdb0d8490fa3 SHA256 a17dcf856726fcbd56bf6b2c65623448008d5f81fb3edf2807ec5471fdea9ae9
+DIST udev-164.tar.bz2 557126 RMD160 f169b21c955f96554b8c7af1fd174037e60dfe12 SHA1 ef6c6c707c249246f6d848f6a0a545bff8d903cf SHA256 81db1a089e4c13fd73fbb5ace7974ab84e2d92d8a39fad81d3707d92b6429258
EBUILD udev-114.ebuild 9053 RMD160 71cf9942c2680b37cde18fb1e6b45661863add68 SHA1 a61fd58682ed8e206468f15f35c718a838f6b2c7 SHA256 fa7bf704f3406c70bc55e1e9c9995d487266707d3c93e9ea7c44844e9fbee493
EBUILD udev-115-r1.ebuild 10130 RMD160 499b32c67f89eca774a1335b00e1c067747d453a SHA1 93ebcd32a7e1a10409464fed8e23e1bd3e8a6d24 SHA256 ce4c791c230e3430783efc180da8dce72104f337660690f8df0f90c4e37496aa
EBUILD udev-119.ebuild 10169 RMD160 e9e0b3b4d9487fb77495ff08e12a70cea5762a85 SHA1 709baaadef461a85ed4a876e04a4e3c11a72b994 SHA256 5c14efe9fcea0afa44aab6fb2579f69e02d083914170265cd2942df9b9d18842
@@ -107,6 +122,14 @@ EBUILD udev-149.ebuild 16579 RMD160 f3288d98ef291f33b688ca37688a939dda5ed421 SHA
EBUILD udev-151-r4.ebuild 16818 RMD160 6bcd9aaf66b17006cc0b530e19b7a9f018a14239 SHA1 c9709bdfa0ded088bf821c1f62b8f5eb2eb7f6d5 SHA256 0a821b6dd63a2090c620653db9af69404a53598d26b7739fef242acf76d521d7
EBUILD udev-162.ebuild 16011 RMD160 ae2acf58a16ee3834883ead2b11c535ef3664909 SHA1 a70f08516ef780f10c2c500b6fc3253d54b4ec7d SHA256 cc656960f29040db9dba06595d426940e0c38fa991d0060dc876585c2870ddc0
EBUILD udev-163.ebuild 16011 RMD160 12b78ea7ccc807bfe64e0bb1f24146b212f26ae1 SHA1 0c2e2f96bbdecf84e20f8d65092e239467f025cc SHA256 c31e77a7cfcd2d3ed8ed11e6b7d05c8204dfe9179720ded6f552317f639f2446
+EBUILD udev-164.ebuild 16342 RMD160 c94222337e34fa88b87e96058b9400790e55c2eb SHA1 1b9c0fa7e81f6d8d0945248bf70e744f2dad321d SHA256 cd8fd341209d2a216d6053124d28108a3cce8651e9093b686a7b2305cb97f7e8
EBUILD udev-9999.ebuild 15906 RMD160 eccb13d05abc0f7d53952a57fc8307310424b08a SHA1 0a85ac5886c0cb5bbc48b777b898b53c3d41e458 SHA256 71baec39e758add66fd8adedea72df90af659f1a7369c8bca0b94ad53ae43a7d
-MISC ChangeLog 115651 RMD160 1d6c45986531c55f87d8d46e5b01840bddbabf76 SHA1 c722887e75e31bb107d1d830970627e2f4f6731e SHA256 8eb51251ba8b6e28571e203ad4459d3607df5c9792eff20fa2abec370863aaf3
+MISC ChangeLog 116252 RMD160 bb250f7a9dd7054be2d939ea7cda11eb198fd302 SHA1 e67ea429d206f4ea2bd5bf4dc1ceeabbeb185059 SHA256 ac9addfbb664d63df744fa925ec1158d882ddd71cf28fb4acc01b58f318cec00
MISC metadata.xml 502 RMD160 f353faee03dd5920d1f7d65c123d93e018c7be53 SHA1 02c5eb9fd660e69127fa84487e0d70b85ee1d3cc SHA256 ca6a239a7be7949fdf1461eb524ca9234a0fd2aee9fc7eeb758a2347b6031664
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.16 (GNU/Linux)
+
+iEYEARECAAYFAkzMItQACgkQt2vP6XvVdOcNNQCgu2b/kRF8RbL4KwWDl3g7Utuz
+BKcAni854AH4xIavBmvLlmT9ZZbPAp2W
+=hEgO
+-----END PGP SIGNATURE-----
diff --git a/sys-fs/udev/files/164/40-gentoo.rules b/sys-fs/udev/files/164/40-gentoo.rules
new file mode 100644
index 000000000000..fa99ba9fe5e6
--- /dev/null
+++ b/sys-fs/udev/files/164/40-gentoo.rules
@@ -0,0 +1,14 @@
+# do not edit this file, it will be overwritten on update
+
+# setting permissions
+SUBSYSTEM=="usb", ENV{DEVTYPE}=="usb_device", GROUP="usb"
+
+# dialout devices
+KERNEL=="ippp*|isdn*|dcbri*|rfcomm*|ttyACM[0-9]*|pilot", GROUP="uucp"
+
+# sound devices (oss)
+SUBSYSTEM=="snd", GROUP="audio"
+
+# Sony Vaio Jogdial sonypi device
+KERNEL=="sonypi", MODE="0666"
+
diff --git a/sys-fs/udev/files/164/90-network.rules b/sys-fs/udev/files/164/90-network.rules
new file mode 100644
index 000000000000..50903af157dc
--- /dev/null
+++ b/sys-fs/udev/files/164/90-network.rules
@@ -0,0 +1,8 @@
+# do not edit this file, it will be overwritten on update
+
+# /etc/udev/rules/90-network.rules: triggering network init-scripts
+
+# Activate our network if we can
+SUBSYSTEM=="net", ACTION=="add", RUN+="net.sh %k start"
+SUBSYSTEM=="net", ACTION=="remove", RUN+="net.sh %k stop"
+
diff --git a/sys-fs/udev/files/164/shell-compat-KV.sh b/sys-fs/udev/files/164/shell-compat-KV.sh
new file mode 100644
index 000000000000..ce92e7120bf6
--- /dev/null
+++ b/sys-fs/udev/files/164/shell-compat-KV.sh
@@ -0,0 +1,45 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# provides get_KV and KV_to_int as not all openrc-versions installed via ebuild have these
+
+cmd_exist()
+{
+ type "$1" >/dev/null 2>&1
+}
+
+# does exist in baselayout-1
+# does not exist in openrc, but is added by openrc-ebuild since some time
+if ! cmd_exist KV_to_int; then
+ KV_to_int() {
+ [ -z $1 ] && return 1
+
+ local x=${1%%-*}
+ local KV_MAJOR=${x%%.*}
+ x=${x#*.}
+ local KV_MINOR=${x%%.*}
+ x=${x#*.}
+ local KV_MICRO=${x%%.*}
+ local KV_int=$((${KV_MAJOR} * 65536 + ${KV_MINOR} * 256 + ${KV_MICRO} ))
+
+ # We make version 2.2.0 the minimum version we will handle as
+ # a sanity check ... if its less, we fail ...
+ [ "${KV_int}" -lt 131584 ] && return 1
+
+ echo "${KV_int}"
+ }
+fi
+
+# same as KV_to_int
+if ! cmd_exist get_KV; then
+ _RC_GET_KV_CACHE=""
+ get_KV() {
+ [ -z "${_RC_GET_KV_CACHE}" ] \
+ && _RC_GET_KV_CACHE="$(uname -r)"
+
+ echo "$(KV_to_int "${_RC_GET_KV_CACHE}")"
+
+ return $?
+ }
+fi
+
diff --git a/sys-fs/udev/files/164/shell-compat-addon.sh b/sys-fs/udev/files/164/shell-compat-addon.sh
new file mode 100644
index 000000000000..efe7726567bf
--- /dev/null
+++ b/sys-fs/udev/files/164/shell-compat-addon.sh
@@ -0,0 +1,71 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# functions that may not be defined, but are used by the udev-start and udev-stop addon
+# used by baselayout-1 and openrc before version 0.4.0
+
+cmd_exist()
+{
+ type "$1" >/dev/null 2>&1
+}
+
+# does not exist in baselayout-1, does exist in openrc
+if ! cmd_exist yesno; then
+ yesno() {
+ [ -z "$1" ] && return 1
+ case "$1" in
+ yes|Yes|YES) return 0 ;;
+ esac
+ return 1
+ }
+fi
+
+# does not exist in baselayout-1, does exist in openrc
+#
+# mountinfo <path>
+# check if some filesystem is mounted at mountpoint <path>
+#
+# return value:
+# 0 filesystem is mounted at <path>
+# 1 no filesystem is mounted exactly at <path>
+if ! cmd_exist mountinfo; then
+ mountinfo() {
+ [ "$1" = "-q" ] && shift
+ local dir="$1"
+
+ # check if entry is in /proc/mounts
+ local ret=$(gawk 'BEGIN { found="false"; }
+ $1 ~ "^#" { next }
+ $2 == "'$dir'" { found="true"; }
+ END { print found; }
+ ' /proc/mounts)
+
+ "${ret}"
+ }
+fi
+
+# does not exist in baselayout-1, does exist in openrc
+#
+# used syntax: fstabinfo --mount /dev
+# it should mount /dev if an entry exists in /etc/fstab
+#
+# return value:
+# 0 mount succeeded
+# 1 mount failed or no entry exists
+#
+if ! cmd_exist fstabinfo; then
+ fstabinfo() {
+ [ "$1" = "--mount" ] || return 1
+ local dir="$2"
+
+ # RC_USE_FSTAB does only exist in baselayout-1
+ # this emulation is only needed on bl-1, so check always
+ yesno "${RC_USE_FSTAB}" || return 1
+
+ # no need to check fstab, mount does this already for us
+
+ # try mounting - better first check fstab and then mount without surpressing errors
+ mount -n "${dir}" 2>/dev/null
+ return $?
+ }
+fi
diff --git a/sys-fs/udev/files/164/udev-dev-tarball.initd b/sys-fs/udev/files/164/udev-dev-tarball.initd
new file mode 100644
index 000000000000..7d5a6b7cec41
--- /dev/null
+++ b/sys-fs/udev/files/164/udev-dev-tarball.initd
@@ -0,0 +1,95 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Maintain a tarball of not udev managed device nodes"
+[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev
+
+rc_device_tarball=${rc_device_tarball:-${RC_DEVICE_TARBALL:-NO}}
+device_tarball=/lib/udev/state/devices.tar.bz2
+
+depend() {
+ if [ -f /etc/init.d/sysfs ]; then
+ need udev-mount
+ fi
+}
+
+start()
+{
+ _start
+}
+
+_start() {
+ if yesno "${rc_device_tarball}" && \
+ [ -s "${device_tarball}" ]
+ then
+ ebegin "Populating /dev with saved device nodes"
+ tar -jxpf "${device_tarball}" -C /dev
+ eend $?
+ fi
+}
+
+stop() {
+ if [ -e /dev/.devfsd ] || [ ! -e /dev/.udev ] || [ ! -z "${CDBOOT}" ] || \
+ ! yesno "${rc_device_tarball}" || \
+ ! touch "${device_tarball}" 2>/dev/null
+ then
+ return 0
+ fi
+
+ ebegin "Saving device nodes"
+ # Handle our temp files
+ save_tmp_base=/tmp/udev.savedevices."$$"
+ devices_udev="${save_tmp_base}"/devices.udev
+ devices_real="${save_tmp_base}"/devices.real
+ devices_totar="${save_tmp_base}"/devices.totar
+ device_tmp_tarball="${save_tmp_base}"/devices
+
+ rm -rf "${save_tmp_base}"
+ mkdir "${save_tmp_base}"
+ touch "${devices_udev}" "${devices_real}" \
+ "${devices_totar}" "${device_tmp_tarball}"
+
+ if [ -f "${devices_udev}" -a -f "${devices_real}" -a \
+ -f "${devices_totar}" -a -f "${device_tmp_tarball}" ]
+ then
+ cd /dev
+ # Find all devices, but ignore .udev directory
+ find . -xdev -type b -or -type c -or -type l | \
+ cut -d/ -f2- | \
+ grep -v ^\\.udev >"${devices_real}"
+
+ # Figure out what udev created
+ udevadm info --export-db | sed -ne 's,^[SN]: \(.*\),\1,p' >"${devices_udev}"
+ # These ones we also do not want in there
+ for x in MAKEDEV core fd initctl pts shm stderr stdin stdout root; do
+ echo "${x}" >> "${devices_udev}"
+ done
+ if [ -d /lib/udev/devices ]; then
+ cd /lib/udev/devices
+ find . -xdev -type b -or -type c -or -type l | \
+ cut -d/ -f2- >> "${devices_udev}"
+ cd /dev
+ fi
+
+ fgrep -x -v -f "${devices_udev}" "${devices_real}" > "${devices_totar}"
+
+ # Now only tarball those not created by udev if we have any
+ if [ -s "${devices_totar}" ]; then
+ # we dont want to descend into mounted filesystems (e.g. devpts)
+ # looking up username may involve NIS/network
+ # and net may be down
+ tar --one-file-system --numeric-owner \
+ -jcpf "${device_tmp_tarball}" -T "${devices_totar}"
+ mv -f "${device_tmp_tarball}" "${device_tarball}"
+ else
+ rm -f "${device_tarball}"
+ fi
+ eend 0
+ else
+ eend 1 "Could not create temporary files!"
+ fi
+
+ rm -rf "${save_tmp_base}"
+}
+
diff --git a/sys-fs/udev/files/164/udev-mount.initd b/sys-fs/udev/files/164/udev-mount.initd
new file mode 100644
index 000000000000..3e4f88451ddb
--- /dev/null
+++ b/sys-fs/udev/files/164/udev-mount.initd
@@ -0,0 +1,107 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Mount tmpfs on /dev"
+[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev
+
+# get_KV and KV_to_int
+. /lib/udev/shell-compat-KV.sh
+
+# FIXME
+# Instead of this script testing kernel version, udev itself should
+# Maybe something like udevd --test || exit $?
+check_kernel()
+{
+ if [ $(get_KV) -lt $(KV_to_int '%KV_MIN%') ]; then
+ eerror "Your kernel is too old to work with this version of udev."
+ eerror "Current udev only supports Linux kernel %KV_MIN% and newer."
+ return 1
+ fi
+
+ yesno "${unreliable_kernel_warning:-yes}" || return 0
+
+ if [ $(get_KV) -lt $(KV_to_int '%KV_MIN_RELIABLE%') ]; then
+ ewarn "You need at least Linux kernel %KV_MIN_RELIABLE% for reliable operation of udev."
+ fi
+ return 0
+}
+
+
+mount_dev_directory()
+{
+ if mountinfo -q /dev; then
+ einfo "/dev is already mounted"
+ return 0
+ fi
+
+ # No options are processed here as they should all be in /etc/fstab
+ ebegin "Mounting /dev"
+ if ! fstabinfo --mount /dev; then
+ # we mount devtmpfs if supported
+ local fs=tmpfs
+ grep -qs devtmpfs /proc/filesystems && fs=devtmpfs
+
+ # Some devices require exec, Bug #92921
+ mount -n -t "$fs" -o "exec,nosuid,mode=0755,size=10M" udev /dev
+ fi
+ eend $?
+}
+
+seed_dev()
+{
+ # Seed /dev with some things that we know we need
+
+ # creating /dev/console, /dev/tty and /dev/tty1 to be able to write
+ # to $CONSOLE with/without bootsplash before udevd creates it
+ [ -c /dev/console ] || mknod -m 600 /dev/console c 5 1
+ [ -c /dev/tty1 ] || mknod -m 620 /dev/tty1 c 4 1
+ [ -c /dev/tty ] || mknod -m 666 /dev/tty c 5 0
+
+ # udevd will dup its stdin/stdout/stderr to /dev/null
+ # and we do not want a file which gets buffered in ram
+ [ -c /dev/null ] || mknod -m 666 /dev/null c 1 3
+ ${HAVE_SELINUX} && restorecon /dev/null
+
+ # so udev can add its start-message to dmesg
+ [ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11
+
+ # Create problematic directories
+ mkdir -p /dev/pts /dev/shm
+ ${HAVE_SELINUX} && restorecon -R /dev >/dev/null
+ return 0
+}
+
+
+start()
+{
+ # do not run this on too old baselayout - udev-addon is already loaded!
+ if [ ! -f /etc/init.d/sysfs ]; then
+ eerror "The $SVCNAME init-script is written for baselayout-2!"
+ eerror "Please do not use it with baselayout-1!".
+ return 1
+ fi
+
+ _start
+}
+
+_start()
+{
+ check_kernel || return 1
+ mount_dev_directory || return 1
+
+ # Selinux lovin; /selinux should be mounted by selinux-patched init
+ if [ -x /sbin/restorecon -a -c /selinux/null ]; then
+ HAVE_SELINUX=true
+ restorecon /dev > /selinux/null
+ else
+ HAVE_SELINUX=false
+ fi
+
+ # make sure it exists
+ mkdir -p /dev/.udev /dev/.udev/rules.d
+
+ seed_dev
+
+ return 0
+}
diff --git a/sys-fs/udev/files/164/udev-postmount.initd b/sys-fs/udev/files/164/udev-postmount.initd
new file mode 100644
index 000000000000..12a30f669a68
--- /dev/null
+++ b/sys-fs/udev/files/164/udev-postmount.initd
@@ -0,0 +1,53 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/files/164/udev-postmount.initd,v 1.1 2010/10/30 13:53:54 zzam Exp $
+
+depend() {
+ need localmount
+ after dbus # for trigger failed
+}
+
+dir_writeable()
+{
+ touch "$1"/.test.$$ 2>/dev/null && rm "$1"/.test.$$
+}
+
+# store persistent-rules that got created while booting
+# when / was still read-only
+store_persistent_rules() {
+ # only continue if rules-directory is writable
+ dir_writeable /etc/udev/rules.d || return 0
+
+ local file dest
+ for file in /dev/.udev/tmp-rules--*; do
+ dest=${file##*tmp-rules--}
+ [ "$dest" = '*' ] && break
+ type=${dest##70-persistent-}
+ type=${type%%.rules}
+ ebegin "Saving udev persistent ${type} rules to /etc/udev/rules.d"
+ cat "$file" >> /etc/udev/rules.d/"$dest" && rm -f "$file"
+ eend $? "Failed moving persistent rules!"
+ done
+}
+
+
+start() {
+ # check if this system uses udev
+ [ -d /dev/.udev/ ] || return 0
+
+ einfo "Doing udev cleanups"
+
+ # Run the events that failed at first udev trigger
+ udevadm trigger --type=failed -v
+
+ # store persistent-rules that got created while booting
+ # when / was still read-only
+ store_persistent_rules
+}
+
+stop() {
+ :
+}
+
+# vim:ts=4
diff --git a/sys-fs/udev/files/164/udev-start.sh b/sys-fs/udev/files/164/udev-start.sh
new file mode 100644
index 000000000000..a85d0c37d20b
--- /dev/null
+++ b/sys-fs/udev/files/164/udev-start.sh
@@ -0,0 +1,55 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+[ -e /etc/conf.d/udev ] && . /etc/conf.d/udev
+
+. /lib/udev/shell-compat-addon.sh
+
+compat_volume_nodes()
+{
+ # Only do this for baselayout-1*
+ # This check is likely to get false positives due to some multilib stuff,
+ # but that should not matter, as this can only happen on old openrc versions
+ # no longer available as ebuilds.
+ if [ ! -e /lib/librc.so ]; then
+
+ # Create nodes that udev can't
+ [ -x /sbin/lvm ] && \
+ /sbin/lvm vgscan -P --mknodes --ignorelockingfailure &>/dev/null
+ # Running evms_activate on a LiveCD causes lots of headaches
+ [ -z "${CDBOOT}" -a -x /sbin/evms_activate ] && \
+ /sbin/evms_activate -q &>/dev/null
+ fi
+}
+
+start_initd()
+{
+ (
+ . /etc/init.d/"$1"
+ _start
+ )
+}
+
+# set it as openrc does
+RC_BOOTLEVEL=${BOOTLEVEL:-default}
+RC_DEFAULTLEVEL=${DEFAULTLEVEL:-default}
+
+# mount tmpfs on /dev
+start_initd udev-mount || exit 1
+
+# Create a file so that our rc system knows it's still in sysinit.
+# Existance means init scripts will not directly run.
+# rc will remove the file when done with sysinit.
+# this is no longer needed as of openrc-0.4.0
+touch /dev/.rcsysinit
+
+# load device tarball
+start_initd udev-dev-tarball
+
+# run udevd
+start_initd udev || exit 1
+
+compat_volume_nodes
+
+# udev started successfully
+exit 0
diff --git a/sys-fs/udev/files/164/udev-stop.sh b/sys-fs/udev/files/164/udev-stop.sh
new file mode 100644
index 000000000000..784e5d509b4f
--- /dev/null
+++ b/sys-fs/udev/files/164/udev-stop.sh
@@ -0,0 +1,13 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+# for function yesno
+. /lib/udev/shell-compat-addon.sh
+
+# store device tarball
+(
+ . /etc/init.d/udev-dev-tarball
+ stop
+)
+
+exit 0
diff --git a/sys-fs/udev/files/164/udev.confd b/sys-fs/udev/files/164/udev.confd
new file mode 100644
index 000000000000..7c3d3eb2291e
--- /dev/null
+++ b/sys-fs/udev/files/164/udev.confd
@@ -0,0 +1,64 @@
+# /etc/conf.d/udev: config file for udev
+
+# We discourage to disable persistent-net!!
+# this may lead to random interface naming
+
+# Disable adding new rules for persistent-net
+persistent_net_disable="no"
+
+# Disable adding new rules for persistent-cd
+# Disabling this will stop new cdrom devices to appear
+# as /dev/{cdrom,cdrw,dvd,dvdrw}
+persistent_cd_disable="no"
+
+# Set to "yes" if you want to save /dev to a tarball on shutdown
+# and restore it on startup. This is useful if you have a lot of
+# custom device nodes that udev does not handle/know about.
+#
+# As this option is fragile, we recommend you
+# to create your devices in /lib/udev/devices.
+# These will be copied to /dev on boot.
+#rc_device_tarball="NO"
+
+# udev can trigger coldplug events which cause services to start and
+# kernel modules to be loaded.
+# Services are deferred to start in the boot runlevel.
+# Set rc_coldplug="NO" if you don't want this.
+# If you want module coldplugging but not coldplugging of services then you
+# can disable service coldplugging in baselayout/openrc config files.
+# The setting is named different in different versions.
+# in /etc/rc.conf: rc_hotplug="!*" or
+# in /etc/conf.d/rc: rc_plug_services="!*"
+#rc_coldplug="YES"
+
+
+
+
+# Expert options:
+
+# Disable warning about unreliable kernel/udev combination
+#unreliable_kernel_warning="no"
+
+# Timeout in seconds to wait for processing of uevents at boot.
+# There should be no need to change this.
+#udev_settle_timeout="60"
+
+# Add extra command line options to udevd, use with care
+# udevd --help for possible values
+#udev_opts=""
+
+# Run udevd --debug and write output to /dev/.udev/udev.log
+# Should not be kept on as it fills diskspace slowly
+#udev_debug="YES"
+
+# Run udevadmin monitor to get a log of all events
+# in /dev/.udev/udevmonitor.log
+#udev_monitor="YES"
+
+# Keep udevmonitor running after populating /dev.
+#udev_monitor_keep_running="no"
+
+# Set cmdline options for udevmonitor.
+# could be some of --env --kernel --udev
+#udev_monitor_opts="--env"
+
diff --git a/sys-fs/udev/files/164/udev.initd b/sys-fs/udev/files/164/udev.initd
new file mode 100644
index 000000000000..23fc39c33d95
--- /dev/null
+++ b/sys-fs/udev/files/164/udev.initd
@@ -0,0 +1,272 @@
+#!/sbin/runscript
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+
+description="Run udevd and create the device-nodes"
+
+[ -e /etc/udev/udev.conf ] && . /etc/udev/udev.conf
+
+rc_coldplug=${rc_coldplug:-${RC_COLDPLUG:-YES}}
+
+depend()
+{
+ if [ -f /etc/init.d/sysfs ]; then
+ # require new enough openrc with sysinit being extra runlevel
+ # on linux we just check if sysfs init-script exists
+ # this is to silence out ugly warnings about not-existing sysfs script
+ provide dev
+ if yesno "${rc_device_tarball:-no}"; then
+ need sysfs udev-mount udev-dev-tarball
+ else
+ need sysfs udev-mount
+ fi
+ before checkfs fsck
+
+ # udev does not work inside vservers
+ keyword novserver nolxc noopenvz
+ fi
+}
+
+cleanup()
+{
+ # fail more gracely and not leave udevd running
+ start-stop-daemon --stop --exec /sbin/udevd
+ exit 1
+}
+
+disable_hotplug_agent()
+{
+ if [ -e /proc/sys/kernel/hotplug ]; then
+ echo "" >/proc/sys/kernel/hotplug
+ fi
+}
+
+root_link()
+{
+ /lib/udev/write_root_link_rule
+}
+
+rules_disable_switch()
+{
+ # this function disables rules files
+ # by creating new files with the same name
+ # in a temp rules directory with higher priority
+ local f=/dev/.udev/rules.d/"$1" bname="$1" onoff="$2"
+
+ if yesno "${onoff}"; then
+ echo "# This file disables ${bname} due to /etc/conf.d/udev" \
+ > "${f}"
+ else
+ rm -f "${f}"
+ fi
+}
+
+# only called on openrc
+is_service_enabled() {
+ local svc="$1"
+
+ [ ! -e "/etc/init.d/${svc}" ] && return 1
+
+ [ -e "/etc/runlevels/${RC_BOOTLEVEL}/${svc}" ] && return 0
+ [ -e "/etc/runlevels/${RC_DEFAULTLEVEL}/${svc}" ] && return 0
+ return 1
+}
+
+check_openrc_net()
+{
+ local f=/dev/.udev/rules.d/90-network.rules
+ is_service_enabled network || return 0
+
+ # disable network hotplugging
+ echo "# This file disables network hotplug events calling old-style openrc net scripts" >> "${f}"
+ echo "# as we use new-style network init script /etc/init.d/network" >> "${f}"
+}
+
+start_udevd()
+{
+ # load unix domain sockets if built as module, Bug #221253
+ if [ -e /proc/modules ] ; then
+ modprobe -q unix 2>/dev/null
+ fi
+ local opts="${udev_opts}"
+
+ ebegin "Starting udevd"
+ if yesno "${udev_debug:-no}"; then
+ /sbin/udevd --daemon ${opts} --debug 2>/dev/.udev/udev.log
+ else
+ start-stop-daemon --start --exec /sbin/udevd -- --daemon ${opts}
+ fi
+
+ eend $?
+}
+
+# populate /dev with devices already found by the kernel
+populate_dev()
+{
+ if get_bootparam "nocoldplug" ; then
+ rc_coldplug="NO"
+ ewarn "Skipping udev coldplug as requested in kernel cmdline"
+ fi
+
+ ebegin "Populating /dev with existing devices through uevents"
+ udevadm control --property=STARTUP=1
+ if yesno "${rc_coldplug}"; then
+ udevadm trigger --action="add"
+ else
+ # Do not run any init-scripts, Bug #206518
+ udevadm control --property=do_not_run_plug_service=1
+
+ # only create device nodes
+ udevadm trigger --action="add" --attr-match=dev
+
+ # run persistent-net stuff, bug 191466
+ udevadm trigger --action="add" --subsystem-match=net
+ fi
+ eend $?
+
+ # we can speed up booting under these conditions:
+ # * using devtmpfs so kernel creates device nodes for us
+ # * only using kernel created device nodes at boot (in /etc/fstab and elsewhere)
+ #
+ ebegin "Waiting for uevents to be processed"
+ udevadm settle --timeout=${udev_settle_timeout:-60}
+ eend $?
+
+ udevadm control --property=do_not_run_plug_service=
+ udevadm control --property=STARTUP=
+ return 0
+}
+
+# for debugging
+start_udevmonitor()
+{
+ yesno "${udev_monitor:-no}" || return 0
+
+ udevmonitor_log=/dev/.udev/udevmonitor.log
+ udevmonitor_pid=/dev/.udev/udevmonitor.pid
+
+ einfo "udev: Running udevadm monitor ${udev_monitor_opts} to get a log of all events"
+ start-stop-daemon --start --stdout "${udevmonitor_log}" \
+ --make-pidfile --pidfile "${udevmonitor_pid}" \
+ --background --exec /sbin/udevadm -- monitor ${udev_monitor_opts}
+}
+
+stop_udevmonitor()
+{
+ yesno "${udev_monitor:-no}" || return 0
+
+ if yesno "${udev_monitor_keep_running:-no}"; then
+ ewarn "udev: udevmonitor is still running and writing into ${udevmonitor_log}"
+ else
+ einfo "udev: Stopping udevmonitor: Log is in ${udevmonitor_log}"
+ start-stop-daemon --stop --pidfile "${udevmonitor_pid}" --exec /sbin/udevadm
+ fi
+}
+
+display_hotplugged_services() {
+ local svcfile= svc= services=
+ for svcfile in "${RC_SVCDIR}"/hotplugged/*; do
+ svc="${svcfile##*/}"
+ [ -x "${svcfile}" ] || continue
+
+ services="${services} ${svc}"
+ done
+ [ -n "${services}" ] && einfo "Device initiated services:${HILITE}${services}${NORMAL}"
+}
+
+check_persistent_net()
+{
+ # check if there are problems with persistent-net
+ local syspath= devs= problem=false
+ for syspath in /sys/class/net/*_rename*; do
+ if [ -d "${syspath}" ]; then
+ devs="${devs} ${syspath##*/}"
+ problem=true
+ fi
+ done
+
+ ${problem} || return 0
+
+ eerror "UDEV: Your system has a problem assigning persistent names"
+ eerror "to these network interfaces: ${devs}"
+
+ einfo "Checking persistent-net rules:"
+ # the sed-expression lists all duplicate lines
+ # from the input, like "uniq -d" does, but uniq
+ # is installed into /usr/bin and not available at boot.
+ dups=$(
+ RULES_FILE='/etc/udev/rules.d/70-persistent-net.rules'
+ . /lib/udev/rule_generator.functions
+ find_all_rules 'NAME=' '.*' | \
+ tr ' ' '\n' | \
+ sort | \
+ sed '$!N; s/^\(.*\)\n\1$/\1/; t; D'
+ )
+ if [ -n "${dups}" ]; then
+ ewarn "The rules create multiple entries assigning these names:"
+ eindent
+ ewarn "${dups}"
+ eoutdent
+ else
+ ewarn "Found no duplicate names in persistent-net rules,"
+ ewarn "there must be some other problem!"
+ fi
+ return 1
+}
+
+check_udev_works()
+{
+ # should exist on every system, else udev failed
+ if [ ! -e /dev/zero ]; then
+ eerror "Assuming udev failed somewhere, as /dev/zero does not exist."
+ return 1
+ fi
+ return 0
+}
+
+start()
+{
+ # do not run this on old baselayout where udev-addon gets loaded
+ if [ ! -f /etc/init.d/sysfs ]; then
+ eerror "The $SVCNAME init-script is written for baselayout-2!"
+ eerror "Please do not use it with baselayout-1!".
+ return 1
+ fi
+
+ check_openrc_net
+ _start
+
+ display_hotplugged_services
+
+ return 0
+}
+
+_start()
+{
+ if [ ! -e /etc/runlevels/${RC_DEFAULTLEVEL:-default}/udev-postmount ]; then
+ ewarn "You should add udev-postmount service to your default runlevel."
+ fi
+
+ root_link
+ rules_disable_switch 75-persistent-net-generator.rules "${persistent_net_disable:-no}"
+ rules_disable_switch 75-cd-aliases-generator.rules ${persistent_cd_disable:-no}
+
+ disable_hotplug_agent
+ start_udevd || cleanup
+ start_udevmonitor
+ populate_dev || cleanup
+
+ check_persistent_net
+
+ check_udev_works || cleanup
+ stop_udevmonitor
+
+ return 0
+}
+
+stop() {
+ ebegin "Stopping udevd"
+ start-stop-daemon --stop --exec /sbin/udevd
+ eend $?
+}
+
diff --git a/sys-fs/udev/udev-164.ebuild b/sys-fs/udev/udev-164.ebuild
new file mode 100644
index 000000000000..505662da6a07
--- /dev/null
+++ b/sys-fs/udev/udev-164.ebuild
@@ -0,0 +1,568 @@
+# Copyright 1999-2010 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-164.ebuild,v 1.1 2010/10/30 13:53:54 zzam Exp $
+
+EAPI="1"
+
+inherit eutils flag-o-matic multilib toolchain-funcs linux-info
+
+#PATCHSET=${P}-gentoo-patchset-v1
+scriptversion=164
+
+if [[ ${PV} == "9999" ]]; then
+ EGIT_REPO_URI="git://git.kernel.org/pub/scm/linux/hotplug/udev.git"
+ EGIT_BRANCH="master"
+ inherit git autotools
+else
+ # please update testsys-tarball whenever udev-xxx/test/sys/ is changed
+ SRC_URI="mirror://kernel/linux/utils/kernel/hotplug/${P}.tar.bz2
+ test? ( mirror://gentoo/${PN}-151-testsys.tar.bz2 )"
+ [[ -n "${PATCHSET}" ]] && SRC_URI="${SRC_URI} mirror://gentoo/${PATCHSET}.tar.bz2"
+fi
+DESCRIPTION="Linux dynamic and persistent device naming support (aka userspace devfs)"
+HOMEPAGE="http://www.kernel.org/pub/linux/utils/kernel/hotplug/udev.html"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha ~amd64 ~arm ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86"
+IUSE="selinux extras test"
+
+COMMON_DEPEND="selinux? ( sys-libs/libselinux )
+ extras? (
+ sys-apps/acl
+ >=sys-apps/usbutils-0.82
+ virtual/libusb:0
+ sys-apps/pciutils
+ dev-libs/glib:2
+ )
+ >=sys-apps/util-linux-2.16
+ >=sys-libs/glibc-2.9"
+
+DEPEND="${COMMON_DEPEND}
+ extras? (
+ dev-util/gperf
+ dev-util/pkgconfig
+ )
+ virtual/os-headers
+ !<sys-kernel/linux-headers-2.6.29
+ test? ( app-text/tree )"
+
+RDEPEND="${COMMON_DEPEND}
+ !sys-apps/coldplug
+ !<sys-fs/lvm2-2.02.45
+ !sys-fs/device-mapper
+ >=sys-apps/baselayout-1.12.5"
+
+if [[ ${PV} == "9999" ]]; then
+ # for documentation processing with xsltproc
+ DEPEND="${DEPEND}
+ app-text/docbook-xsl-stylesheets
+ app-text/docbook-xml-dtd
+ dev-util/gtk-doc"
+fi
+
+# required kernel options
+CONFIG_CHECK="~INOTIFY_USER ~SIGNALFD ~!SYSFS_DEPRECATED ~!SYSFS_DEPRECATED_V2
+ ~!IDE"
+
+# We need the lib/rcscripts/addon support
+PROVIDE="virtual/dev-manager"
+
+udev_check_KV() {
+ local ok=0
+ if [[ ${KV_MAJOR} == 2 && ${KV_MINOR} == 6 ]]
+ then
+ if kernel_is -ge 2 6 ${KV_PATCH_reliable} ; then
+ ok=2
+ elif kernel_is -ge 2 6 ${KV_PATCH_min} ; then
+ ok=1
+ fi
+ fi
+ return $ok
+}
+
+pkg_setup() {
+ linux-info_pkg_setup
+
+ udev_libexec_dir="/$(get_libdir)/udev"
+
+ # udev requires signalfd introduced in kernel 2.6.25,
+ # but a glibc compiled against >=linux-headers-2.6.27 uses the
+ # new signalfd syscall introduced in kernel 2.6.27 without falling back
+ # to the old one. So we just depend on 2.6.27 here, see Bug #281312.
+ KV_PATCH_min=25
+ KV_PATCH_reliable=27
+ KV_min=2.6.${KV_PATCH_min}
+ KV_reliable=2.6.${KV_PATCH_reliable}
+
+ # always print kernel version requirements
+ ewarn
+ ewarn "${P} does not support Linux kernel before version ${KV_min}!"
+ if [[ ${KV_PATCH_min} != ${KV_PATCH_reliable} ]]; then
+ ewarn "For a reliable udev, use at least kernel ${KV_reliable}"
+ fi
+
+ echo
+ # We don't care about the secondary revision of the kernel.
+ # 2.6.30.4 -> 2.6.30 is all we check
+ udev_check_KV
+ case "$?" in
+ 2) einfo "Your kernel version (${KV_FULL}) is new enough to run ${P} reliably." ;;
+ 1) ewarn "Your kernel version (${KV_FULL}) is new enough to run ${P},"
+ ewarn "but it may be unreliable in some cases."
+ ebeep ;;
+ 0) eerror "Your kernel version (${KV_FULL}) is too old to run ${P}"
+ ebeep ;;
+ esac
+ echo
+
+ KV_FULL_SRC=${KV_FULL}
+ get_running_version
+ udev_check_KV
+ if [[ "$?" = "0" ]]; then
+ eerror
+ eerror "udev cannot be restarted after emerging,"
+ eerror "as your running kernel version (${KV_FULL}) is too old."
+ eerror "You really need to use a newer kernel after a reboot!"
+ NO_RESTART=1
+ ebeep
+ fi
+}
+
+sed_libexec_dir() {
+ sed -e "s#/lib/udev#${udev_libexec_dir}#" -i "$@"
+}
+
+src_unpack() {
+ if [[ ${PV} == "9999" ]] ; then
+ git_src_unpack
+ else
+ unpack ${A}
+
+ if use test; then
+ mv "${WORKDIR}"/test/sys "${S}"/test/
+ fi
+ fi
+
+ cd "${S}"
+
+ # patches go here...
+
+ # backport some patches
+ if [[ -n "${PATCHSET}" ]]; then
+ EPATCH_SOURCE="${WORKDIR}/${PATCHSET}" EPATCH_SUFFIX="patch" \
+ EPATCH_FORCE="yes" epatch
+ fi
+
+ # change rules back to group uucp instead of dialout for now
+ sed -e 's/GROUP="dialout"/GROUP="uucp"/' \
+ -i rules/{rules.d,arch}/*.rules \
+ || die "failed to change group dialout to uucp"
+
+ if [[ ${PV} != 9999 ]]; then
+ # Make sure there is no sudden changes to upstream rules file
+ # (more for my own needs than anything else ...)
+ MD5=$(md5sum < "${S}/rules/rules.d/50-udev-default.rules")
+ MD5=${MD5/ -/}
+ if [[ ${MD5} != f3c9ade42f70cec0459f9e58a99c632a ]]
+ then
+ echo
+ eerror "50-udev-default.rules has been updated, please validate!"
+ eerror "md5sum: ${MD5}"
+ die "50-udev-default.rules has been updated, please validate!"
+ fi
+ fi
+
+ sed_libexec_dir \
+ rules/rules.d/50-udev-default.rules \
+ rules/rules.d/78-sound-card.rules \
+ extras/rule_generator/write_*_rules \
+ || die "sed failed"
+
+ if [[ ${PV} == 9999 ]]; then
+ gtkdocize --copy
+ eautoreconf
+ fi
+}
+
+src_compile() {
+ filter-flags -fprefetch-loop-arrays
+
+ econf \
+ --prefix=/usr \
+ --sysconfdir=/etc \
+ --sbindir=/sbin \
+ --libdir=/usr/$(get_libdir) \
+ --with-rootlibdir=/$(get_libdir) \
+ --libexecdir="${udev_libexec_dir}" \
+ --enable-logging \
+ --enable-static \
+ $(use_with selinux) \
+ $(use_enable extras) \
+ --disable-introspection
+ # we don't have gobject-introspection in portage tree
+
+ emake || die "compiling udev failed"
+}
+
+src_install() {
+ local scriptdir="${FILESDIR}/${scriptversion}"
+
+ into /
+ emake DESTDIR="${D}" install || die "make install failed"
+
+ exeinto "${udev_libexec_dir}"
+ newexe "${FILESDIR}"/net-130-r1.sh net.sh || die "net.sh not installed properly"
+ newexe "${FILESDIR}"/move_tmp_persistent_rules-112-r1.sh move_tmp_persistent_rules.sh \
+ || die "move_tmp_persistent_rules.sh not installed properly"
+ newexe "${FILESDIR}"/write_root_link_rule-125 write_root_link_rule \
+ || die "write_root_link_rule not installed properly"
+
+ doexe "${scriptdir}"/shell-compat-KV.sh \
+ || die "shell-compat.sh not installed properly"
+ doexe "${scriptdir}"/shell-compat-addon.sh \
+ || die "shell-compat.sh not installed properly"
+
+ keepdir "${udev_libexec_dir}"/state
+ keepdir "${udev_libexec_dir}"/devices
+
+ # create symlinks for these utilities to /sbin
+ # where multipath-tools expect them to be (Bug #168588)
+ dosym "..${udev_libexec_dir}/scsi_id" /sbin/scsi_id
+
+ # Add gentoo stuff to udev.conf
+ echo "# If you need to change mount-options, do it in /etc/fstab" \
+ >> "${D}"/etc/udev/udev.conf
+
+ # let the dir exist at least
+ keepdir /etc/udev/rules.d
+
+ # Now installing rules
+ cd "${S}"/rules
+ insinto "${udev_libexec_dir}"/rules.d/
+
+ # Our rules files
+ doins "${scriptdir}"/??-*.rules
+
+ # support older kernels
+ doins misc/30-kernel-compat.rules
+
+ # Adding arch specific rules
+ if [[ -f arch/40-${ARCH}.rules ]]
+ then
+ doins "arch/40-${ARCH}.rules"
+ fi
+ cd "${S}"
+
+ # our udev hooks into the rc system
+ insinto /$(get_libdir)/rcscripts/addons
+ doins "${scriptdir}"/udev-start.sh \
+ || die "udev-start.sh not installed properly"
+ doins "${scriptdir}"/udev-stop.sh \
+ || die "udev-stop.sh not installed properly"
+
+ local init
+ # udev-postmount and init-scripts for >=openrc-0.3.1, Bug #240984
+ for init in udev udev-mount udev-dev-tarball udev-postmount; do
+ newinitd "${scriptdir}/${init}.initd" "${init}" \
+ || die "initscript ${init} not installed properly"
+ done
+
+ # insert minimum kernel versions
+ sed -e "s/%KV_MIN%/${KV_min}/" \
+ -e "s/%KV_MIN_RELIABLE%/${KV_reliable}/" \
+ -i "${D}"/etc/init.d/udev-mount
+
+ # config file for init-script and start-addon
+ newconfd "${scriptdir}/udev.confd" udev \
+ || die "config file not installed properly"
+
+ insinto /etc/modprobe.d
+ newins "${FILESDIR}"/blacklist-146 blacklist.conf
+ newins "${FILESDIR}"/pnp-aliases pnp-aliases.conf
+
+ # convert /lib/udev to real used dir
+ sed_libexec_dir \
+ "${D}/$(get_libdir)"/rcscripts/addons/*.sh \
+ "${D}/${udev_libexec_dir}"/write_root_link_rule \
+ "${D}"/etc/conf.d/udev \
+ "${D}"/etc/init.d/udev* \
+ "${D}"/etc/modprobe.d/*
+
+ # documentation
+ dodoc ChangeLog README TODO || die "failed installing docs"
+
+ # keep doc in just one directory, Bug #281137
+ rm -rf "${D}/usr/share/doc/${PN}"
+ if use extras; then
+ dodoc extras/keymap/README.keymap.txt || die "failed installing docs"
+ fi
+}
+
+pkg_preinst() {
+ # moving old files to support newer modprobe, 12 May 2009
+ local f dir=${ROOT}/etc/modprobe.d/
+ for f in pnp-aliases blacklist; do
+ if [[ -f $dir/$f && ! -f $dir/$f.conf ]]
+ then
+ elog "Moving $dir/$f to $f.conf"
+ mv -f "$dir/$f" "$dir/$f.conf"
+ fi
+ done
+
+ if [[ -d ${ROOT}/lib/udev-state ]]
+ then
+ mv -f "${ROOT}"/lib/udev-state/* "${D}"/lib/udev/state/
+ rm -r "${ROOT}"/lib/udev-state
+ fi
+
+ if [[ -f ${ROOT}/etc/udev/udev.config &&
+ ! -f ${ROOT}/etc/udev/udev.rules ]]
+ then
+ mv -f "${ROOT}"/etc/udev/udev.config "${ROOT}"/etc/udev/udev.rules
+ fi
+
+ # delete the old udev.hotplug symlink if it is present
+ if [[ -h ${ROOT}/etc/hotplug.d/default/udev.hotplug ]]
+ then
+ rm -f "${ROOT}"/etc/hotplug.d/default/udev.hotplug
+ fi
+
+ # delete the old wait_for_sysfs.hotplug symlink if it is present
+ if [[ -h ${ROOT}/etc/hotplug.d/default/05-wait_for_sysfs.hotplug ]]
+ then
+ rm -f "${ROOT}"/etc/hotplug.d/default/05-wait_for_sysfs.hotplug
+ fi
+
+ # delete the old wait_for_sysfs.hotplug symlink if it is present
+ if [[ -h ${ROOT}/etc/hotplug.d/default/10-udev.hotplug ]]
+ then
+ rm -f "${ROOT}"/etc/hotplug.d/default/10-udev.hotplug
+ fi
+
+ has_version "=${CATEGORY}/${PN}-103-r3"
+ previous_equal_to_103_r3=$?
+
+ has_version "<${CATEGORY}/${PN}-104-r5"
+ previous_less_than_104_r5=$?
+
+ has_version "<${CATEGORY}/${PN}-106-r5"
+ previous_less_than_106_r5=$?
+
+ has_version "<${CATEGORY}/${PN}-113"
+ previous_less_than_113=$?
+}
+
+# 19 Nov 2008
+fix_old_persistent_net_rules() {
+ local rules=${ROOT}/etc/udev/rules.d/70-persistent-net.rules
+ [[ -f ${rules} ]] || return
+
+ elog
+ elog "Updating persistent-net rules file"
+
+ # Change ATTRS to ATTR matches, Bug #246927
+ sed -i -e 's/ATTRS{/ATTR{/g' "${rules}"
+
+ # Add KERNEL matches if missing, Bug #246849
+ sed -ri \
+ -e '/KERNEL/ ! { s/NAME="(eth|wlan|ath)([0-9]+)"/KERNEL=="\1*", NAME="\1\2"/}' \
+ "${rules}"
+}
+
+# See Bug #129204 for a discussion about restarting udevd
+restart_udevd() {
+ if [[ ${NO_RESTART} = "1" ]]; then
+ ewarn "Not restarting udevd, as your kernel is too old!"
+ return
+ fi
+
+ # need to merge to our system
+ [[ ${ROOT} = / ]] || return
+
+ # check if root of init-process is identical to ours (not in chroot)
+ [[ -r /proc/1/root && /proc/1/root/ -ef /proc/self/root/ ]] || return
+
+ # abort if there is no udevd running
+ [[ -n $(pidof udevd) ]] || return
+
+ # abort if no /dev/.udev exists
+ [[ -e /dev/.udev ]] || return
+
+ elog
+ elog "restarting udevd now."
+
+ killall -15 udevd &>/dev/null
+ sleep 1
+ killall -9 udevd &>/dev/null
+
+ /sbin/udevd --daemon
+ sleep 3
+ if [[ ! -n $(pidof udevd) ]]; then
+ eerror "FATAL: udev died, please check your kernel is"
+ eerror "new enough and configured correctly for ${P}."
+ eerror
+ eerror "Please have a look at this before rebooting."
+ eerror "If in doubt, please downgrade udev back to your old version"
+ ebeep
+ fi
+}
+
+postinst_init_scripts() {
+ # FIXME: we may need some code that detects if this is a system bootstrap
+ # and auto-enables udev then
+ #
+ # FIXME: inconsistent handling of init-scripts here
+ # * udev is added to sysinit in openrc-ebuild
+ # * we add udev-postmount to default in here
+ #
+
+ # migration to >=openrc-0.4
+ if [[ -e "${ROOT}"/etc/runlevels/sysinit && ! -e "${ROOT}"/etc/runlevels/sysinit/udev ]]
+ then
+ ewarn
+ ewarn "You need to add the udev init script to the runlevel sysinit,"
+ ewarn "else your system will not be able to boot"
+ ewarn "after updating to >=openrc-0.4.0"
+ ewarn "Run this to enable udev for >=openrc-0.4.0:"
+ ewarn "\trc-update add udev sysinit"
+ ewarn
+ fi
+
+ # add udev-postmount to default runlevel instead of that ugly injecting
+ # like a hotplug event, 2009/10/15
+
+ # already enabled?
+ [[ -e "${ROOT}"/etc/runlevels/default/udev-postmount ]] && return
+
+ local enable_postmount=0
+ [[ -e "${ROOT}"/etc/runlevels/sysinit/udev ]] && enable_postmount=1
+ [[ "${ROOT}" = "/" && -d /dev/.udev/ ]] && enable_postmount=1
+
+ if [[ ${enable_postmount} = 1 ]]
+ then
+ local initd=udev-postmount
+
+ if [[ -e ${ROOT}/etc/init.d/${initd} ]] && \
+ [[ ! -e ${ROOT}/etc/runlevels/default/${initd} ]]
+ then
+ ln -snf /etc/init.d/${initd} "${ROOT}"/etc/runlevels/default/${initd}
+ elog "Auto-adding '${initd}' service to your default runlevel"
+ fi
+ else
+ elog "You should add the udev-postmount service to default runlevel."
+ elog "Run this to add it:"
+ elog "\trc-update add udev-postmount default"
+ fi
+}
+
+pkg_postinst() {
+ fix_old_persistent_net_rules
+
+ # "losetup -f" is confused if there is an empty /dev/loop/, Bug #338766
+ # So try to remove it here (will only work if empty).
+ rmdir "${ROOT}"/dev/loop 2>/dev/null
+ if [[ -d "${ROOT}"/dev/loop ]]; then
+ ewarn "Please make sure your remove /dev/loop,"
+ ewarn "else losetup may be confused when looking for unused devices."
+ fi
+
+ restart_udevd
+
+ postinst_init_scripts
+
+ # people want reminders, I'll give them reminders. Odds are they will
+ # just ignore them anyway...
+
+ # delete 40-scsi-hotplug.rules, it is integrated in 50-udev.rules, 19 Jan 2007
+ if [[ $previous_equal_to_103_r3 = 0 ]] &&
+ [[ -e ${ROOT}/etc/udev/rules.d/40-scsi-hotplug.rules ]]
+ then
+ ewarn "Deleting stray 40-scsi-hotplug.rules"
+ ewarn "installed by sys-fs/udev-103-r3"
+ rm -f "${ROOT}"/etc/udev/rules.d/40-scsi-hotplug.rules
+ fi
+
+ # Removing some device-nodes we thought we need some time ago, 25 Jan 2007
+ if [[ -d ${ROOT}/lib/udev/devices ]]
+ then
+ rm -f "${ROOT}"/lib/udev/devices/{null,zero,console,urandom}
+ fi
+
+ # Removing some old file, 29 Jan 2007
+ if [[ $previous_less_than_104_r5 = 0 ]]
+ then
+ rm -f "${ROOT}"/etc/dev.d/net/hotplug.dev
+ rmdir --ignore-fail-on-non-empty "${ROOT}"/etc/dev.d/net 2>/dev/null
+ fi
+
+ # 19 Mar 2007
+ if [[ $previous_less_than_106_r5 = 0 ]] &&
+ [[ -e ${ROOT}/etc/udev/rules.d/95-net.rules ]]
+ then
+ rm -f "${ROOT}"/etc/udev/rules.d/95-net.rules
+ fi
+
+ # Try to remove /etc/dev.d as that is obsolete, 23 Apr 2007
+ if [[ -d ${ROOT}/etc/dev.d ]]
+ then
+ rmdir --ignore-fail-on-non-empty "${ROOT}"/etc/dev.d/default "${ROOT}"/etc/dev.d 2>/dev/null
+ if [[ -d ${ROOT}/etc/dev.d ]]
+ then
+ ewarn "You still have the directory /etc/dev.d on your system."
+ ewarn "This is no longer used by udev and can be removed."
+ fi
+ fi
+
+ # 64-device-mapper.rules now gets installed by sys-fs/device-mapper
+ # remove it if user don't has sys-fs/device-mapper installed, 27 Jun 2007
+ if [[ $previous_less_than_113 = 0 ]] &&
+ [[ -f ${ROOT}/etc/udev/rules.d/64-device-mapper.rules ]] &&
+ ! has_version sys-fs/device-mapper
+ then
+ rm -f "${ROOT}"/etc/udev/rules.d/64-device-mapper.rules
+ einfo "Removed unneeded file 64-device-mapper.rules"
+ fi
+
+ # requested in bug #275974, added 2009/09/05
+ ewarn
+ ewarn "If after the udev update removable devices or CD/DVD drives"
+ ewarn "stop working, try re-emerging HAL before filling a bug report"
+
+ # requested in Bug #225033:
+ elog
+ elog "persistent-net does assigning fixed names to network devices."
+ elog "If you have problems with the persistent-net rules,"
+ elog "just delete the rules file"
+ elog "\trm ${ROOT}etc/udev/rules.d/70-persistent-net.rules"
+ elog "and then reboot."
+ elog
+ elog "This may however number your devices in a different way than they are now."
+
+ ewarn
+ ewarn "If you build an initramfs including udev, then please"
+ ewarn "make sure that the /sbin/udevadm binary gets included,"
+ ewarn "and your scripts changed to use it,as it replaces the"
+ ewarn "old helper apps udevinfo, udevtrigger, ..."
+
+ ewarn
+ ewarn "mount options for directory /dev are no longer"
+ ewarn "set in /etc/udev/udev.conf, but in /etc/fstab"
+ ewarn "as for other directories."
+
+ ewarn
+ ewarn "If you use /dev/md/*, /dev/loop/* or /dev/rd/*,"
+ ewarn "then please migrate over to using the device names"
+ ewarn "/dev/md*, /dev/loop* and /dev/ram*."
+ ewarn "The devfs-compat rules have been removed."
+ ewarn "For reference see Bug #269359."
+
+ ewarn
+ ewarn "Rules for /dev/hd* devices have been removed"
+ ewarn "Please migrate to libata."
+
+ elog
+ elog "For more information on udev on Gentoo, writing udev rules, and"
+ elog " fixing known issues visit:"
+ elog " http://www.gentoo.org/doc/en/udev-guide.xml"
+}