On Wednesday 03 May 2006 10:33, Henrik Brix Andersen wrote: > On Wed, May 03, 2006 at 10:13:58AM +0100, Roy Marples wrote: > > RC_HOTPLUG="yes|no" > > RC_COLDPLUG="yes|no" > > RC_PLUG_SERVICES="net.wlan !net.*" > > I like this idea much better than the current implementation in > baselayout-1.12_pre19-r1. > > I find it unintuitive that I can currently limit coldplug events but > not hotplug events.
Attached is a patch to pre19-r1 that does this. Anything else you'ed like to add? Thanks -- Roy Marples <[EMAIL PROTECTED]> Gentoo/Linux Developer (baselayout, networking)
Index: etc/conf.d/rc =================================================================== --- etc/conf.d/rc (revision 2022) +++ etc/conf.d/rc (working copy) @@ -16,16 +16,26 @@ RC_INTERACTIVE="yes" +# Do we allow hotplugging? If not, set to RC_HOTPLUG="no" + +RC_HOTPLUG="yes" + # Dynamic /dev managers can trigger coldplug events which cause services to # start before we are ready for them. If this happens, we can defer these -# services to start in the boot runlevel. RC_COLDPLUG is a list of services we -# allow to be coldplugged in this way. Globbing is allowed as is prefixing -# with ! which means don't coldplug. -# Example - RC_COLDPLUG="net.wlan !net.* *" -# This allows net.wlan and any service not matching net.* to coldplug. +# services to start in the boot runlevel. Set RC_COLDPLUG="no" if you don't +# want this. -RC_COLDPLUG="*" +RC_COLDPLUG="yes" +# Some people want a finer grain over hotplug/coldplug. RC_PLUG_SERVICES is a +# list of services that are matched in order, either allowing or not. By +# default we allow services through as RC_COLDPLUG/RC_HOTPLUG has to be yes +# anyway. +# Example - RC_PLUG_SERVICES="net.wlan !net.*" +# This allows net.wlan and any service not matching net.* to be plugged. + +RC_PLUG_SERVICES="" + # RC_NET_STRICT_CHECKING allows some flexibility with the 'net' service. # The following values are allowed: # none - The 'net' service is always considered up. Index: sbin/runscript.sh =================================================================== --- sbin/runscript.sh (revision 2023) +++ sbin/runscript.sh (working copy) @@ -27,16 +27,12 @@ # until after rc sysinit has completed so we punt them to the boot runlevel if [[ -e /dev/.rcsysinit ]] ; then eerror "ERROR: cannot run ${SVCNAME} until sysinit completes" - [[ "${RC_COLDPLUG} " == "!* "* ]] && exit 1 - if [[ "${RC_COLDPLUG} " != "* "* ]] ; then - cd /etc/init.d - shopt -s nullglob extglob - for x in ${RC_COLDPLUG} ; do - [[ ${SVCNAME} == "${x}" ]] && break - [[ "!${SVCNAME}" == "${x}" ]] && exit 1 - done - [[ ${SVCNAME} == "${x}" ]] || exit 1 - fi + [[ ${RC_COLDPLUG:-yes} != "yes" ]] && exit 1 + set -f + for x in ${RC_PLUG_SERVICES} ; do + [[ ${SVCNAME} == ${x} ]] && break + [[ "!${SVCNAME}" == ${x} ]] && exit 1 + done eerror "${SVCNAME} will be started in the ${BOOTLEVEL} runlevel" if [[ ! -L /dev/.rcboot/"${SVCNAME}" ]] ; then [[ ! -d /dev/.rcboot ]] && mkdir /dev/.rcboot @@ -45,6 +41,19 @@ exit 1 fi +# Only hotplug if we're allowed to +if [[ ${IN_HOTPLUG} == "1" && ${RC_HOTPLUG:-yes} == "yes" ]] ; then + set -f + for x in ${RC_PLUG_SERVICES} ; do + [[ ${SVCNAME} == ${x} ]] && break + if [[ "!${SVCNAME}" == ${x} ]] ; then + eerror "${SVCNAME} is not allowed to be hotplugged" + exit 1 + fi + done + set +f +fi + svc_trap() { trap 'eerror "ERROR: ${SVCNAME} caught an interrupt"; exit 1' \ INT QUIT TSTP