diff options
author | Matthias Schwarzott <zzam@gentoo.org> | 2009-10-20 12:38:15 +0000 |
---|---|---|
committer | Matthias Schwarzott <zzam@gentoo.org> | 2009-10-20 12:38:15 +0000 |
commit | 41f20b30545c40b2459b0f0fd68403d08c537717 (patch) | |
tree | e9023d6bc396d8f7f0269d5a81b8d90b6863ba52 /sys-fs | |
parent | x86 stable, bug #284967 (diff) | |
download | gentoo-2-41f20b30545c40b2459b0f0fd68403d08c537717.tar.gz gentoo-2-41f20b30545c40b2459b0f0fd68403d08c537717.tar.bz2 gentoo-2-41f20b30545c40b2459b0f0fd68403d08c537717.zip |
Update init-scripts. udev-postmount should be in default runlevel. No longer handle it like a synthetic hotplug event. Let it rerun failed events. Handle devtmpfs if supported, and also the case /dev is already mounted. Do not run net.* init-scripts if the new network init-script is used. Cleanup of pre/postinst code.
(Portage version: 2.2_rc46/cvs/Linux i686)
Diffstat (limited to 'sys-fs')
-rw-r--r-- | sys-fs/udev/ChangeLog | 11 | ||||
-rw-r--r-- | sys-fs/udev/files/147/shell-compat-addon.sh | 21 | ||||
-rwxr-xr-x | sys-fs/udev/files/147/udev-mount.initd | 12 | ||||
-rwxr-xr-x | sys-fs/udev/files/147/udev-postmount.initd | 5 | ||||
-rw-r--r-- | sys-fs/udev/files/147/udev.initd | 6 | ||||
-rw-r--r-- | sys-fs/udev/udev-9999.ebuild | 85 |
6 files changed, 86 insertions, 54 deletions
diff --git a/sys-fs/udev/ChangeLog b/sys-fs/udev/ChangeLog index fe2a79e5711d..3c509bb0511a 100644 --- a/sys-fs/udev/ChangeLog +++ b/sys-fs/udev/ChangeLog @@ -1,6 +1,15 @@ # 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.499 2009/10/15 21:40:47 zzam Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/ChangeLog,v 1.500 2009/10/20 12:38:15 zzam Exp $ + + 20 Oct 2009; Matthias Schwarzott <zzam@gentoo.org> + files/147/shell-compat-addon.sh, udev-9999.ebuild, files/147/udev.initd, + files/147/udev-mount.initd, files/147/udev-postmount.initd: + Update init-scripts. udev-postmount should be in default runlevel. No + longer handle it like a synthetic hotplug event. Let it rerun failed + events. Handle devtmpfs if supported, and also the case /dev is already + mounted. Do not run net.* init-scripts if the new network init-script is + used. Cleanup of pre/postinst code. 15 Oct 2009; Matthias Schwarzott <zzam@gentoo.org> +files/147/shell-compat-KV.sh, +files/147/shell-compat-addon.sh, diff --git a/sys-fs/udev/files/147/shell-compat-addon.sh b/sys-fs/udev/files/147/shell-compat-addon.sh index f9bf51bfa0e5..c271abfd548f 100644 --- a/sys-fs/udev/files/147/shell-compat-addon.sh +++ b/sys-fs/udev/files/147/shell-compat-addon.sh @@ -20,10 +20,27 @@ if ! cmd_exist yesno; then } 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() { - # returning false makes the behaviour same as without check - return 1 + [ "$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 diff --git a/sys-fs/udev/files/147/udev-mount.initd b/sys-fs/udev/files/147/udev-mount.initd index 74d85fa80823..179c9f80ac59 100755 --- a/sys-fs/udev/files/147/udev-mount.initd +++ b/sys-fs/udev/files/147/udev-mount.initd @@ -30,14 +30,20 @@ check_kernel() mount_dev_directory() { - mountinfo -q /dev && return 0 + 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 - # we could mount devtmpfs if supported - mount -n -t tmpfs -o "exec,nosuid,mode=0755,size=10M" udev /dev + mount -n -t "$fs" -o "exec,nosuid,mode=0755,size=10M" udev /dev fi eend $? } diff --git a/sys-fs/udev/files/147/udev-postmount.initd b/sys-fs/udev/files/147/udev-postmount.initd index f67833640764..439d1a596a6e 100755 --- a/sys-fs/udev/files/147/udev-postmount.initd +++ b/sys-fs/udev/files/147/udev-postmount.initd @@ -1,7 +1,7 @@ #!/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 $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/files/147/udev-postmount.initd,v 1.2 2009/10/20 12:38:14 zzam Exp $ depend() { need localmount @@ -17,9 +17,6 @@ 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 diff --git a/sys-fs/udev/files/147/udev.initd b/sys-fs/udev/files/147/udev.initd index eba25645e879..16b00894cd4d 100644 --- a/sys-fs/udev/files/147/udev.initd +++ b/sys-fs/udev/files/147/udev.initd @@ -115,8 +115,10 @@ populate_dev() 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 + # 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 $? diff --git a/sys-fs/udev/udev-9999.ebuild b/sys-fs/udev/udev-9999.ebuild index 90f72b229f8a..c014c8ae2d46 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.16 2009/10/15 21:40:47 zzam Exp $ +# $Header: /var/cvsroot/gentoo-x86/sys-fs/udev/udev-9999.ebuild,v 1.17 2009/10/20 12:38:15 zzam Exp $ EAPI="1" @@ -298,6 +298,7 @@ src_install() { } 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 ]] @@ -337,13 +338,6 @@ pkg_preinst() { rm -f "${ROOT}"/etc/hotplug.d/default/10-udev.hotplug fi - # is there a stale coldplug initscript? (CONFIG_PROTECT leaves it behind) - coldplug_stale="" - if [[ -f ${ROOT}/etc/init.d/coldplug ]] - then - coldplug_stale="1" - fi - has_version "=${CATEGORY}/${PN}-103-r3" previous_equal_to_103_r3=$? @@ -360,6 +354,7 @@ pkg_preinst() { previous_less_than_146_r2=$? } +# 19 Nov 2008 fix_old_persistent_net_rules() { local rules=${ROOT}/etc/udev/rules.d/70-persistent-net.rules [[ -f ${rules} ]] || return @@ -414,11 +409,18 @@ restart_udevd() { fi } -pkg_postinst() { - fix_old_persistent_net_rules - - restart_udevd - +postinst_init_scripts() { + # FIXME: we need some code like + # if use bootstrap; then + # add init-scripts + # fi + # + # 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 @@ -430,20 +432,32 @@ pkg_postinst() { ewarn fi - # people want reminders, I'll give them reminders. Odds are they will - # just ignore them anyway... - - if [[ ${coldplug_stale} == 1 ]] + # add udev-postmount to default runlevel instead of that ugly injecting + # like a hotplug event, 2009/10/15 + if [[ $previous_less_than_146_r2 = 0 ]] then - ewarn "A stale coldplug init script found. You should run:" - ewarn - ewarn " rc-update del coldplug" - ewarn " rm -f /etc/init.d/coldplug" - ewarn - ewarn "udev now provides its own coldplug functionality." + 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 +} + +pkg_postinst() { + fix_old_persistent_net_rules + + restart_udevd - # delete 40-scsi-hotplug.rules - all integrated in 50-udev.rules + 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 @@ -452,26 +466,27 @@ pkg_postinst() { rm -f "${ROOT}"/etc/udev/rules.d/40-scsi-hotplug.rules fi - # Removing some device-nodes we thought we need some time ago + # 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 + # 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 + # 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 @@ -483,7 +498,7 @@ pkg_postinst() { 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 + # 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 @@ -492,20 +507,6 @@ 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" |