1 |
On 2/3/19 12:39 PM, Grant Taylor wrote: |
2 |
> On 2/3/19 6:26 AM, Michael Orlitzky wrote: |
3 |
>> You can add commands to your existing network configuration that will be |
4 |
>> run when an interface comes up. For example, in /etc/conf.d/net, |
5 |
>> |
6 |
>> ifup_wlan0="iwconfig \$int key s:secretkey enc open essid foobar" |
7 |
> |
8 |
> Ya.... I find that to be an absolute kludge. Does it work? Yes. Is |
9 |
> it clean? Probably not. Is it graceful? Absolutely not. |
10 |
> |
11 |
> Think about how it's possible to configure bridging / bonding / VLANs |
12 |
> via various parameters and having netifrc construct the commands that |
13 |
> are run in the background. |
14 |
> |
15 |
|
16 |
Ultimately netifrc is just a shell script that parses another shell |
17 |
script to construct a third shell script. I don't think doing it with |
18 |
only two shell scripts is that much less elegant =) |
19 |
|
20 |
You could go all the way and write your own OpenRC service as |
21 |
/etc/init.d/whatever. You can make it depend on the network being up, |
22 |
and then just write everything that you want it to do into the start |
23 |
function with the corresponding "undo" steps in the stop function. |
24 |
|
25 |
If the series of commands is long and complicated and if you sometimes |
26 |
want to do/undo this subset of the configuration independently, then |
27 |
that's how I'd do it. |