Gentoo Archives: gentoo-dev

From: Daniel <dragonheart@×××××××.au>
To: gentoo-dev@g.o
Subject: Re: [gentoo-dev] rc-scripts/init: new service dependency
Date: Wed, 07 May 2003 01:38:47
Message-Id: 200305071057.07337.dragonheart@tpg.com.au
In Reply to: Re: [gentoo-dev] rc-scripts/init: new service dependency by Wout Mertens
1 On Wed, 7 May 2003 09:26 am, Wout Mertens wrote:
2 >
3 > 1) semi-hardcoded:
4 > - put a bunch of SysV init style symlinks to initscripts in
5 > /etc/conf.d/net.d/ifup.d/
6 > - the interface comes up
7 > - start/stop each of them in order, with $INTERFACE set to the interface,
8 >
9 > Pro: Easy to write, the user has full control over what gets started or
10 > stopped
11 >
12 > Con: hard to maintain the SysV init style directory, each event needs a
13 > directory, solves only one problem.
14 >
15 > 2) event based:
16 > - the initscripts put subscribe statements in their depend() code
17 > - the interface comes up
18 > - the event dispatcher runs the subscribed initscripts event() functions,
19 > with details about the event (who, what and args).
20 >
21 > Pro: Easy to write the initscripts, solves many problems. The event
22 > dispatcher shouldn't be difficult.
23 >
24 > Con: Need to find a nice way for a user to disable an initscript, so it
25 > doesn't get events. Example: the net may be up, but the user doesn't want
26 > wwwoffle to be brought online.
27 >
28 >
29 > Wout.
30 >
31
32 Expanding (combining?, bastardising (hopefully not)) your ideas:
33
34 SysV init style scripts in /etc/netinit.d
35
36 Have /etc/netlevel directory (akin to /etc/runlevels) with the subdirectories
37 representing the interface e.g /etc/netlevel/ppp0 /etc/netlevel/eth0 and
38 possibly a sepecial /etc/netlevel/all (called for any interface going up or
39 down).
40
41 Could have a user interface in the form of:
42 "rc-netupdate {add|del} firewall ppp0"
43
44 Aguement to these scripts could be "start"."stop" as usual. Additionaly
45 "reconfig" for example if the network interface parmeter change (IP change)
46 with the details of the change in environment variables (IP_OLD,IP_NEW, etc).
47 I think it would be hard to make all permutations of network change in a
48 generic command line format. Are there any other generic events that need to
49 occur?
50
51 These would be called upon the hotplug events or /etc/ppp/ip-{up-down} since
52 as you mentioned a generic interface is getting hard. I mentioned
53 ip-{up|down} because of the case of dial-on-demand and
54 /etc/init.d/net.{interface} does not necessarly bring up the interface. If
55 its a simple interface the could be called from the /etc/init.d/net.* script
56 through some function.
57
58 This solves your con of having all events is a different direcory. Scripts are
59 now subscription based and triggered by "events".
60
61 Taking into account the hotplug usb device mount idea - a few find and
62 replaces "s/net/event/g" and replace net interface directories with
63 "/etc/eventlevel.d/net.{interface}" and the predominate mechanism is the
64 same. I'm not too familiar with hotplug so appoligies if this is unfesable.
65
66 Ok "evenlevel" sounds sucky but how does the framework sound.
67
68
69 Daniel
70 --
71 Key fingerprint = 2300 3292 3351 9665 D41B DC20 4C34 9BB6 32A6 4DC8
72
73
74 --
75 gentoo-dev@g.o mailing list