1 |
On Tue, 2003-05-06 at 21:59, Wout Mertens wrote: |
2 |
|
3 |
> That's what I meant: when the service is called for an action (start, |
4 |
> stop, restart, reload, custom things), runscript will run the event() |
5 |
> function for all the scripts that are subscribed to that script, and then |
6 |
> those scripts can figure out what to do with it themselves... |
7 |
> |
8 |
> And the gentoo-net scripts that I am working on will go down a |
9 |
> user-configurable list when certain things happen. (interface up/down, ip |
10 |
> address changed, etc. |
11 |
> |
12 |
> The design pattern we're looking at here is events and interested parties, |
13 |
> and it's just a matter of defining what events we handle and how we notify |
14 |
> the parties. |
15 |
> |
16 |
|
17 |
So in the network context: |
18 |
|
19 |
-------- add to /etc/conf.d/net --------- |
20 |
modules_eth0="static route firewall" |
21 |
----------------------------------------- |
22 |
|
23 |
-------- add to /etc/init.d/net.eth? ---- |
24 |
depend() { |
25 |
subscribe after ${modules_eth0} |
26 |
} |
27 |
----------------------------------------- |
28 |
|
29 |
and if net.eth0 starts (meaning the interface is present for example), |
30 |
it will run the 'static' module to set the static ip, then do the |
31 |
routes, and lastly add firewall/whatever rules. Same in reverse if |
32 |
its stopped. |
33 |
|
34 |
Note that above might be too simplified, and out of context. |
35 |
|
36 |
This brings up a question or two: |
37 |
|
38 |
1) should this work for all rc-scripts, or should we maybe |
39 |
add a /etc/init.d/modules/ that have very job specific |
40 |
scripts that are related to net.* (net.eth?, net.ppp?, net.foo) |
41 |
|
42 |
2) if yes to 1), will we need it for anything else than net.* stuff ? |
43 |
|
44 |
3) you mentioned a few events ... do we really need them all, or could |
45 |
we get away with a 'start/stop' only ? |
46 |
|
47 |
To get it running, is not the issue. The bigger issue is getting it |
48 |
functional, without too much bloat/speed decrease/complexity, with |
49 |
a stable API that do not have to change every few months. Basically |
50 |
we will need to think what exactly is needed, and will be needed. |
51 |
|
52 |
|
53 |
-- |
54 |
|
55 |
Martin Schlemmer |
56 |
Gentoo Linux Developer, Desktop/System Team Developer |
57 |
Cape Town, South Africa |