tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Conditional rc.d scripts?



Hello,

   I have a laptop which I connect to the 'net using either wired
ethernet, wifi or dial-up (ppp). I don't always know in advance which
I'll use next, so I sometimes boot it and got some kind of error
(depending on previous configuration), edit rc.conf, and either reboot
or manually start the relevant rc.d scripts to get to a typical usable
state.

   Each time I do those manual steps I think "There must be
(uncontroversial) ways to automate this.".

   Best case scenario would be:
   1) If a "3G"-device has been found by the kernel, use ppp.
   2) Else, check if ath0 exists -- if so, use it.
   3) Use bge0

   Or, have it ask during startup:

   "Where are you?
   1) Home (wired)
   2) Train (ppp)
   3) Work (wifi)"

   How would one typically do this? My immediate thought would be to
make rc.conf probe the system (or ask the user for input), and set up
the relevant variables. But are there some mechanism in rc.d which I'm
missing which would be able to facilitate in building such a solution?

   Also, I have seen at least one package in pkgsrc which runs ".
/etc/rc.conf" in order to check if certain variables are set --
something which would be slightly annoying if the second option were
used. And I suspect the first one has issues as well.

   If anyone has done something similar and has insights to share,
please do so.

-- 
Kind regards,
Jan Danielsson


Attachment: signature.asc
Description: OpenPGP digital signature



Home | Main Index | Thread Index | Old Index