View previous topic :: View next topic |
Author |
Message |
Nicolinux Apprentice
Joined: 22 Dec 2002 Posts: 204
|
Posted: Thu Mar 25, 2004 6:07 am Post subject: "Network Profile" for laptop users |
|
|
Hi,
I wonder if it is some how possible to define a kind of a network profile for mobile use. I have a laptop that I use at home, at school and at work. I would like to have the runlevel changed (to a custom on) based on the ip (and other informations) that I get over dhcp. Or any other actions to be taken based upon this information.
When I am at work and get IP X with default gateway Y then I would like gentoo to boot into the runlevel "work" and login (in gdm) with the user "work".
Is this total nonsense or somehow possible?
Thanks
Stefan |
|
Back to top |
|
|
Earthwings Bodhisattva
Joined: 14 Apr 2003 Posts: 7753 Location: Germany
|
Posted: Thu Mar 25, 2004 9:22 am Post subject: |
|
|
That's possible, sure. One way would go like this:
Emerge ifplugd and configure it to execute a script (-r parameter in ifplugd, I think) that calls a different runlevel based on the IP.
The _automatic_ booting into a special runlevel is a thing I haven't solved well yet. Of course you can boot with a softlevel=xy parameter, but I'd like a more automatic way. I don't know if it is possible without modifying /sbin/rc. Calling another runlevel after default is easy though. |
|
Back to top |
|
|
Regor Guru
Joined: 06 Aug 2002 Posts: 545 Location: 39° 2' 48" N, 120° 59' 2" W
|
Posted: Thu Mar 25, 2004 10:23 am Post subject: |
|
|
You could write a script that detects whatever setting you want to trigger off of then calls the runlevel. Then call that script from /etc/conf.d/local.start. It gets run after (I think) all the other services in the default runlevel.
I wrote a script like this that greps dmesg to detect if my USB NIC is present and starts a runlevel that brings up networking and the desired services on top of that. I don't know that it's the most graceful solution imaginable, but it works fine. _________________ Sometimes the appropriate response to reality is to go insane.
-Philip K. Dick, Valis |
|
Back to top |
|
|
nevynxxx Veteran
Joined: 12 Nov 2003 Posts: 1123 Location: Manchester - UK
|
Posted: Thu Mar 25, 2004 10:58 am Post subject: |
|
|
Regor wrote: | I wrote a script like this that greps dmesg to detect if my USB NIC is present and starts a runlevel that brings up networking and the desired services on top of that. I don't know that it's the most graceful solution imaginable, but it works fine. |
Sounds like a job for DBUS and HAL! will be nice when they work. _________________ My Public Key
Wanted: Instructor in the art of Bowyery |
|
Back to top |
|
|
Nicolinux Apprentice
Joined: 22 Dec 2002 Posts: 204
|
Posted: Sat Mar 27, 2004 1:14 pm Post subject: |
|
|
Thanks people!
Stefan |
|
Back to top |
|
|
|