Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
"Network Profile" for laptop users
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Nicolinux
Apprentice
Apprentice


Joined: 22 Dec 2002
Posts: 204

PostPosted: Thu Mar 25, 2004 6:07 am    Post subject: "Network Profile" for laptop users Reply with quote

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
View user's profile Send private message
Earthwings
Bodhisattva
Bodhisattva


Joined: 14 Apr 2003
Posts: 7753
Location: Germany

PostPosted: Thu Mar 25, 2004 9:22 am    Post subject: Reply with quote

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
View user's profile Send private message
Regor
Guru
Guru


Joined: 06 Aug 2002
Posts: 545
Location: 39° 2' 48" N, 120° 59' 2" W

PostPosted: Thu Mar 25, 2004 10:23 am    Post subject: Reply with quote

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
View user's profile Send private message
nevynxxx
Veteran
Veteran


Joined: 12 Nov 2003
Posts: 1123
Location: Manchester - UK

PostPosted: Thu Mar 25, 2004 10:58 am    Post subject: Reply with quote

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
View user's profile Send private message
Nicolinux
Apprentice
Apprentice


Joined: 22 Dec 2002
Posts: 204

PostPosted: Sat Mar 27, 2004 1:14 pm    Post subject: Reply with quote

Thanks people!

Stefan
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum