From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-relay-2.tiscali.it (mail-relay-2.tiscali.it [213.205.33.42]) by robin.gentoo.org (8.13.4/8.13.4) with ESMTP id j4QITo6s031415 for ; Thu, 26 May 2005 18:29:51 GMT Received: from default (84.222.81.186) by mail-relay-2.tiscali.it (7.1.021.3) id 420202CD00E15C23 for gentoo-dev@lists.gentoo.org; Thu, 26 May 2005 20:29:58 +0200 Date: Thu, 26 May 2005 20:29:59 +0200 X-Mailer: InScribe Message-ID: References: <1117114391.10326.6.camel@uberlaptop.ubernet> To: From: "Kevin F. Quinn" Subject: Re: [gentoo-dev] baselayout-1.11.12-r2 request for testers Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by robin.gentoo.org id j4QITo6s031415 X-Archives-Salt: 77465719-92d9-48e4-ae05-20367d85cbca X-Archives-Hash: d6e0ad6895972cf49165620f3fd947a0 On 26/5/2005 15:33:10, Roy Marples (uberlord@gentoo.org) wrote: > On Thu, 2005-05-26 at 15:04 +0200, Kevin F. Quinn wrote: > > I'm trying it on a laptop that connects to various different networks > > depending on the weather. I figured this would be a useful test as > > it's a less common configuration. It connects mostly via different > > docking stations. I use udev to rename ethernet devices according to > > MAC address (the ethernet devices are in the docking stations). > > Hotplug then runs the appropriately named network script via net.agent > > to start the service. Critically, the various net.* scripts are > > therefore -not- in any runlevel. > > > > This hotplugging of the network devices all kicks off early on - well > > before the boot level has finished. The new /sbin/runscript.sh simply > > drops the addition of the network device if the boot level hasn't > > finished - leaving me with no network (or at least, a network that has > > to be started manually). For now, I've commented out the check in > > /sbin/runscript.sh, and it all works ok. I don't know what this will > > break; obviously the check wasn't added just for laughs! > > > > > emerge ifplugd and get that to monitor your interfaces. It will bring > them up/down when a cable is inserted/removed. > You'll probably have to tell it to not fail if the interfaces don't > exist as you're using udev to rename them. > > A better solution would be to allow configuration via MAC address, which > we may put into baselayout-1.12.0 Thanks for the suggestions. I didn't want to go the ifplugd route as the interfaces don't appear/disappear while the system is running. I've thought a bit about this, and it occurs to me that what I really want is for the hotplug-initiated scripts that runscript.sh doesn't want to do at boot, deferred to default (rather than just dropped). I've implemented this in a simple fashion: ======== --- runscript.sh.orig 2005-05-26 20:02:37.000000000 +0200 +++ runscript.sh 2005-05-26 20:06:28.000000000 +0200 @@ -45,8 +45,9 @@ # has completed if [[ ${NETSERVICE} == "yes" && ${IFACE} != "lo" ]] ; then if [[ -z ${mylevel} || ${mylevel} == ${BOOTLEVEL} ]] ; then - eerror "$0: cannot start until the runlevel "${BOOTLEVEL}" has completed" - exit 1 + echo $* >> ${svcdir}/deferred + ewarn "$0: deferring, service not suitable for runlevel "${BOOTLEVEL}"." + exit 0 fi fi ======== with the following in /etc/init.d/deferred: ======== #!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ dodeferred() { local myline myservice if [[ -f ${svcdir}/deferred ]]; then while read myline; do myservice=${myline%% *} ${myservice} $1 done < ${svcdir}/deferred fi } start() { dodeferred start } stop() { dodeferred stop /bin/rm -f ${svcdir}/deferred } restart() { dodeferred restart } ======== 'rc-update add deferred default' ensures the deferred startups happen when the default runlevel is entered, and are not done if the kernel parameters indicate startup shouldn't continue past the boot runlevel. Continuing manually to the default level catches the deferred startups automatically. The 'deferred' script above doesn't deal with runscript options (--quiet etc), and it may be better to do the 'rm ${svcdir}/deferred' somehwere else, but it illustrates the idea. > > On a somewhat related matter, I have bluetooth stuff installed, which > > is also started by hotplug/pcmcia. In order to prevent it being > > stopped by changing runlevels, I've made a softlink to net.bluetooth > > and started that in my hotplug config instead of 'bluetooth'. Bit of > > a hack, relying on the fact /sbin/rc does not automatically stop > > anything that begins with "net.". Is there a tidier way to prevent > > /sbin/rc from messing with services started & stopped via hotplug? > > Try experimenting with the RC_STRICT_NET_CHECKING in /etc/conf.d/rc My problem here (such that it is) is that the only way for a service to survive a runtime level transition, if it is started by hotplug, is to call it 'net.'. Deferring it (as above) solves the transition problem. Of course, it might be worth having a "not-at-boot" indication feature for init scripts, rather than having them named net. :) Kev. -- gentoo-dev@gentoo.org mailing list