diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2009-10-15 21:40:47 +0000 |
---|---|---|
committer | Matthias Schwarzott <zzam@gentoo.org> | 2009-10-15 21:40:47 +0000 |
commit | 90c56c6cd80b2b080714e9777a6523974ca2c5d7 (patch) | |
tree | 794603230f14098d061743360b5a3bcf395bfd00 /sys-fs | |
parent | Version bump. (diff) | |
download | historical-90c56c6cd80b2b080714e9777a6523974ca2c5d7.tar.gz historical-90c56c6cd80b2b080714e9777a6523974ca2c5d7.tar.bz2 historical-90c56c6cd80b2b080714e9777a6523974ca2c5d7.zip |
Do not call net.* scripts when new-style network is used. Retry failed events in udev-postmount, Bug #283414. Add udev-postmount to runlevel default at update and no longer inject it. Use mountinfo for mounting the fstab entry, bug #288021.
Package-Manager: portage-2.2_rc46/cvs/Linux i686
Diffstat (limited to 'sys-fs')
-rw-r--r-- | sys-fs/udev/ChangeLog | 13 | ||||
-rw-r--r-- | sys-fs/udev/Manifest | 23 | ||||
-rw-r--r-- | sys-fs/udev/files/147/shell-compat-KV.sh | 45 | ||||
-rw-r--r-- | sys-fs/udev/files/147/shell-compat-addon.sh | 54 | ||||
-rwxr-xr-x | sys-fs/udev/files/147/udev-dev-tarball.initd | 95 | ||||
-rwxr-xr-x | sys-fs/udev/files/147/udev-mount.initd | 108 | ||||
-rwxr-xr-x | sys-fs/udev/files/147/udev-postmount.initd | 38 | ||||
-rw-r--r-- | sys-fs/udev/files/147/udev-start.sh | 51 | ||||
-rw-r--r-- | sys-fs/udev/files/147/udev-stop.sh | 13 | ||||
-rw-r--r-- | sys-fs/udev/files/147/udev.confd | 56 | ||||
-rw-r--r-- | sys-fs/udev/files/147/udev.initd | 258 | ||||
-rw-r--r-- | sys-fs/udev/udev-9999.ebuild | 21 |
12 files changed, 770 insertions, 5 deletions
diff --git a/sys-fs/udev/ChangeLog b/sys-fs/udev/ChangeLog index 2434e36e6e72..fe2a79e5711d 100644 --- a/sys-fs/udev/ChangeLog +++ b/sys-fs/udev/ChangeLog @@ -1,6 +1,17 @@ # ChangeLog for sys-fs/udev # Copyright 1999-2009 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v 1.498 2009/10/03 17:40:33 klausman Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v 1.499 2009/10/15 21:40:47 zzam Exp $ + + 15 Oct 2009; Matthias Schwarzott <zzam@gentoo.org> + +files/147/shell-compat-KV.sh, +files/147/shell-compat-addon.sh, + +files/147/udev.confd, +files/147/udev.initd, + +files/147/udev-dev-tarball.initd, +files/147/udev-mount.initd, + +files/147/udev-postmount.initd, +files/147/udev-start.sh, + +files/147/udev-stop.sh, udev-9999.ebuild: + Do not call net.* scripts when new-style network is used. Retry failed + events in udev-postmount, Bug #283414. Add udev-postmount to runlevel + default at update and no longer inject it. Use mountinfo for mounting the + fstab entry, bug #288021. 03 Oct 2009; Tobias Klausmann <klausman@gentoo.org> udev-146-r1.ebuild: Stable on alpha, bug #286074 diff --git a/sys-fs/udev/Manifest b/sys-fs/udev/Manifest index da58cb7f358c..aeb828e5f58c 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 @@ -7,6 +10,15 @@ AUX 136/udev-start.sh 1345 RMD160 c1b4aac1a52da1eac79f3b6a2ccb6e7036a81fdf SHA1 AUX 136/udev-stop.sh 237 RMD160 dea1f6d7525e792484c3d2c31d36e8b4d78ebda8 SHA1 72174a2e5e6be2133b2e5f68e477d0fa342b46ce SHA256 1dbdaa45b9f1e54faba9d153a93c0043aabe5b51270c233d3a5e48a6c1d20a1d AUX 136/udev.confd 1764 RMD160 255afed98d59675108bc96e1639f9b7e8baed4b3 SHA1 19f465c7140818860ce5031e85118d48544c3629 SHA256 6918ce2ad61a7998088e1628e5bd1b59a9082cdb89dc23b1385f641d8a59cdb6 AUX 136/udev.initd 5788 RMD160 76990933287475809083ddc6b2e83383d5500d67 SHA1 adc8c33d287f1ccdcc1db16655a7b11397d1ff79 SHA256 5a051c02f7a64d102d9b73b8a73bf1d6fe3d692d7839dde117da21a948d90ce9 +AUX 147/shell-compat-KV.sh 1012 RMD160 5bc85047b4237d502f7b0ccc7181f9974c2b0898 SHA1 bbc58d6181f3fc8d623de1537eddcc1ede919202 SHA256 2393918bc65c69e1c19d7712292c945a4adfe45ce02b88ae7663167b8745cf8b +AUX 147/shell-compat-addon.sh 1285 RMD160 2600a3a3e7a78f4085109ad3865c5a37c02eeff5 SHA1 d7adb321948aea4dbcf156c367ead954d473173e SHA256 37395c65b97bb77ab18eb6818350b59e2e787214393b6250265326c15de53681 +AUX 147/udev-dev-tarball.initd 2579 RMD160 b7feb34f854a3eb08d1203f1faabf9cecee3101c SHA1 10ecda997314851d86a175db8cbfcc6a343e9bb2 SHA256 a829fa3efb9d6aadb137cb8879b8bc2660ef6500b2dbb8d55db8edf52f332d60 +AUX 147/udev-mount.initd 2778 RMD160 69fe586d560834ba6eb18a84372abf975da57fb5 SHA1 8b63f22da75846316d6e5232e63827665c689abf SHA256 830d0e3a5679eeb8b3d1f40c3069418c4c0001989a9b297d79b42bf34bf71219 +AUX 147/udev-postmount.initd 907 RMD160 9fd233883a68f0d5f1c83d8e1fb4a68baaa07083 SHA1 2d2a2b3488e804ba621ad23c9ff05f62f7aaf27d SHA256 818486b6b2937978ae7e375358b4de16dc45223bc01663e1421e1bad5e7dc38a +AUX 147/udev-start.sh 1254 RMD160 9a9e610b17922d5bc32fe4acfc023b1e9d5474f9 SHA1 3518cd5076a346b0896c8195f032aa765127cc09 SHA256 1c01a6eda394c13524cbb5393bd25f9c771b77c19cb2fe4616ec8afeacbfcde9 +AUX 147/udev-stop.sh 237 RMD160 dea1f6d7525e792484c3d2c31d36e8b4d78ebda8 SHA1 72174a2e5e6be2133b2e5f68e477d0fa342b46ce SHA256 1dbdaa45b9f1e54faba9d153a93c0043aabe5b51270c233d3a5e48a6c1d20a1d +AUX 147/udev.confd 1764 RMD160 255afed98d59675108bc96e1639f9b7e8baed4b3 SHA1 19f465c7140818860ce5031e85118d48544c3629 SHA256 6918ce2ad61a7998088e1628e5bd1b59a9082cdb89dc23b1385f641d8a59cdb6 +AUX 147/udev.initd 6305 RMD160 dd3fe0e76294ecfc740b60e22c45ff695f004519 SHA1 b260763c1b1423f5eef2d720976e93f4659a2305 SHA256 82d69eaef77123ec1078e1e072a5c710be82f6c9a075fd81cd4606e9731bc13d 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 @@ -63,6 +75,13 @@ EBUILD udev-145-r3.ebuild 15407 RMD160 be741872a7fe457e088ff2111eb315b65c7225f1 EBUILD udev-145.ebuild 13607 RMD160 b0895ed911a6d6c4d45d14364e8c11259f52a463 SHA1 011bcbe8eadfd05385c2a39b96c9776ff7bdc34a SHA256 d4f95324a07c0a53df1397719b7aef06b10538a67ddf46a68549b1eff4d551d3 EBUILD udev-146-r1.ebuild 15411 RMD160 92b896131c4b6316030f5b9d086ab583a691f1bf SHA1 5dd50a2206eb10b1056f6c09c9db996cd7f0f2e3 SHA256 da93a288c65490d3d22e98f61f17d71792cadd7a5794abab31808f28c5348ef5 EBUILD udev-146.ebuild 15340 RMD160 d2d6ac34af9271ecba096607e01e679547b7df3c SHA1 c1d1cd2e96a395065b93315af38412d5f1c5f6ea SHA256 ea450be06bf24a677a89c89b89d8a04c49acae66c77a4d71aed92c998d1f8103 -EBUILD udev-9999.ebuild 15102 RMD160 958d2ad6b2e4e31c2b9ba35be80e7b5ddb3f0d2b SHA1 2e912b4c4e04722e2d180190e56faf7d28e92853 SHA256 db7514aecaca06c86b9908d657b269d2ae2540333d48cd60c8ed4a8d4cb5888e -MISC ChangeLog 101811 RMD160 591397b790bd32da5fdb1f3d89fb721a96e5b281 SHA1 ff2ed21e0cc10319f56c1f4581c80651d5855d31 SHA256 0eab078b174f3944adb664b0a1bf23c555ea3c89ed67cdec01815ca20b916d9f +EBUILD udev-9999.ebuild 15622 RMD160 41e9b3002e833236a10e668be0288b58f875c491 SHA1 f0cedf223544505d8af1de127f9eca57864c45d8 SHA256 482b1c32725523b133030b156033402c9cd08f76281451c515caf2bda9607dba +MISC ChangeLog 102397 RMD160 cde42726e54bd0addd7b5b3f24333006490d641d SHA1 4ed65bc1511247110f64b9be8d1c13d5fb1e0b88 SHA256 1693bfcee26cf3c0926df3a34801c17dee95cde8ed373e25b2fdf2f129b932b4 MISC metadata.xml 402 RMD160 fad8844286866f47eadb2fd958f54f650976fe2a SHA1 c966d4e9e509d399523d1ba6ef54277e750334de SHA256 1c524286463bf115615462e9504c27710331f1d82a0828de5d78686f5e303ed5 +-----BEGIN PGP SIGNATURE----- +Version: GnuPG v2.0.11 (GNU/Linux) + +iEYEARECAAYFAkrXluQACgkQt2vP6XvVdOdlHgCgqvI4SQ9Xgj8d3zeBcn6ZT3Cu +53YAoJYCv+nJ2tiBJlgwD9AREysLA4sy +=qnbf +-----END PGP SIGNATURE----- diff --git a/sys-fs/udev/files/147/shell-compat-KV.sh b/sys-fs/udev/files/147/shell-compat-KV.sh new file mode 100644 index 000000000000..be74fe49e3d6 --- /dev/null +++ b/sys-fs/udev/files/147/shell-compat-KV.sh @@ -0,0 +1,45 @@ +# Copyright 1999-2008 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/147/shell-compat-addon.sh b/sys-fs/udev/files/147/shell-compat-addon.sh new file mode 100644 index 000000000000..f9bf51bfa0e5 --- /dev/null +++ b/sys-fs/udev/files/147/shell-compat-addon.sh @@ -0,0 +1,54 @@ +# Copyright 1999-2008 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 + +if ! cmd_exist mountinfo; then + mountinfo() { + # returning false makes the behaviour same as without check + return 1 + } +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/147/udev-dev-tarball.initd b/sys-fs/udev/files/147/udev-dev-tarball.initd new file mode 100755 index 000000000000..2cdce4ff226b --- /dev/null +++ b/sys-fs/udev/files/147/udev-dev-tarball.initd @@ -0,0 +1,95 @@ +#!/sbin/runscript +# Copyright 1999-2008 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/147/udev-mount.initd b/sys-fs/udev/files/147/udev-mount.initd new file mode 100755 index 000000000000..74d85fa80823 --- /dev/null +++ b/sys-fs/udev/files/147/udev-mount.initd @@ -0,0 +1,108 @@ +#!/sbin/runscript +# Copyright 1999-2008 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() +{ + mountinfo -q /dev && return 0 + + # No options are processed here as they should all be in /etc/fstab + ebegin "Mounting /dev" + if ! fstabinfo --mount /dev; then + # Some devices require exec, Bug #92921 + # we could mount devtmpfs if supported + mount -n -t tmpfs -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 + + # so udev can add its start-message to dmesg + [ -c /dev/kmsg ] || mknod -m 660 /dev/kmsg c 1 11 + + # copy over any persistant things + if [ -d /lib/udev/devices ]; then + cp -RPp /lib/udev/devices/* /dev 2>/dev/null + fi + + # Not provided by sysfs but needed + ln -snf /proc/self/fd /dev/fd + ln -snf fd/0 /dev/stdin + ln -snf fd/1 /dev/stdout + ln -snf fd/2 /dev/stderr + [ -e /proc/kcore ] && ln -snf /proc/kcore /dev/core + + # Create problematic directories + mkdir -p /dev/pts /dev/shm + 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 + restorecon /dev > /selinux/null + fi + + # make sure it exists + mkdir -p /dev/.udev /dev/.udev/rules.d + + seed_dev + + return 0 +} diff --git a/sys-fs/udev/files/147/udev-postmount.initd b/sys-fs/udev/files/147/udev-postmount.initd new file mode 100755 index 000000000000..f67833640764 --- /dev/null +++ b/sys-fs/udev/files/147/udev-postmount.initd @@ -0,0 +1,38 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/files/147/udev-postmount.initd,v 1.1 2009/10/15 21:40:44 zzam Exp $ + +depend() { + need localmount + after dbus # for trigger failed +} + +dir_writeable() +{ + mkdir "$1"/.test.$$ 2>/dev/null && rmdir "$1"/.test.$$ +} + +start() { + # check if this system uses udev + [ -d /dev/.udev/ ] || return 0 + + # disable coldplug stop from /etc/init.d/udev trigger + udevadm control --env do_not_run_plug_service= + + # Run the events that failed at first udev trigger + udevadm trigger --type=failed -v + + # only continue if rules-directory is writable + dir_writeable /etc/udev/rules.d || return 0 + + # store persistent-rules that got created while booting + # when / was still read-only + /lib/udev/move_tmp_persistent_rules.sh +} + +stop() { + : +} + +# vim:ts=4 diff --git a/sys-fs/udev/files/147/udev-start.sh b/sys-fs/udev/files/147/udev-start.sh new file mode 100644 index 000000000000..f65c2f79c3e1 --- /dev/null +++ b/sys-fs/udev/files/147/udev-start.sh @@ -0,0 +1,51 @@ +# Copyright 1999-2007 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 + ) +} + +# 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/147/udev-stop.sh b/sys-fs/udev/files/147/udev-stop.sh new file mode 100644 index 000000000000..47e095607f0a --- /dev/null +++ b/sys-fs/udev/files/147/udev-stop.sh @@ -0,0 +1,13 @@ +# Copyright 1999-2007 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/147/udev.confd b/sys-fs/udev/files/147/udev.confd new file mode 100644 index 000000000000..bffea3569f9b --- /dev/null +++ b/sys-fs/udev/files/147/udev.confd @@ -0,0 +1,56 @@ +# /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" + +# 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/147/udev.initd b/sys-fs/udev/files/147/udev.initd new file mode 100644 index 000000000000..eba25645e879 --- /dev/null +++ b/sys-fs/udev/files/147/udev.initd @@ -0,0 +1,258 @@ +#!/sbin/runscript +# Copyright 1999-2008 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 + 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 +} + +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 + ebegin "Starting udevd" + start-stop-daemon --start --exec /sbin/udevd -- --daemon + 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" + if yesno "${rc_coldplug}"; then + udevadm trigger + else + # Do not run any init-scripts, Bug #206518 + udevadm control --env do_not_run_plug_service=1 + + # only create device nodes + udevadm trigger --attr-match=dev + + # run persistent-net stuff, bug 191466 + udevadm trigger --subsystem-match=net + fi + eend $? + + # we can speed up booting by not waiting for udev to finish event-processing + # if using devtmpfs so that kernel already created the device nodes for us + ebegin "Waiting for uevents to be processed" + udevadm settle --timeout=${udev_settle_timeout:-60} + eend $? + + udevadm control --env do_not_run_plug_service= + 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 +} + +_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-9999.ebuild b/sys-fs/udev/udev-9999.ebuild index ebb51d1daac9..90f72b229f8a 100644 --- a/sys-fs/udev/udev-9999.ebuild +++ b/sys-fs/udev/udev-9999.ebuild @@ -1,6 +1,6 @@ # Copyright 1999-2009 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-9999.ebuild,v 1.15 2009/10/02 11:30:20 zzam Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-9999.ebuild,v 1.16 2009/10/15 21:40:47 zzam Exp $ EAPI="1" @@ -184,7 +184,7 @@ src_compile() { } src_install() { - local scriptdir="${FILESDIR}/136" + local scriptdir="${FILESDIR}/147" into / emake DESTDIR="${D}" install || die "make install failed" @@ -355,6 +355,9 @@ pkg_preinst() { has_version "<${CATEGORY}/${PN}-113" previous_less_than_113=$? + + has_version "<${CATEGORY}/${PN}-146-r2" + previous_less_than_146_r2=$? } fix_old_persistent_net_rules() { @@ -489,6 +492,20 @@ pkg_postinst() { einfo "Removed unneeded file 64-device-mapper.rules" fi + # add udev-postmount to default runlevel instead of that ugly injecting + # like a hotplug event, added 2009/10/15 + if [[ $previous_less_than_146_r2 = 0 ]] + 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 + fi + # requested in bug #275974, added 2009/09/05 ewarn ewarn "If after the udev update removable devices or CD/DVD drives" |