1

I have gentoo running on a laptop that I use on two different networks. When I'm in the office there are a couple of tweaks I need/want in make.conf and resolve.conf.head: I have access to a local sync server and distributed compiling, and because of the way our dhcp is setup I need to add a line to resolve.conf.head to properly resolve intranet names. When I'm not on the office network I need to disable the resolve.conf.head and the distributed compile and local sync server in make.conf. Is there a way to make these changes automatically based on my current subnet? Perhaps by pointing a symlink to the appropriate *.conf file?

Any suggestions are appreciated!

1 Answer 1

1

I would suggest putting the extra lines you want to include for your office in separate files, e.g. /etc/resolv.conf.office and /etc/make.conf.office. Then in /etc/make.conf, you can write the following:

on_office_network && source /etc/make.conf.office

where on_office_network will be some command that runs successfully if and only if you are on your office network. If you can tell based on IP address, that command could be

ifconfig eth0 | grep -q 'inet addr:192.168.1.1'

(where 192.168.1.1 should be replaced with whatever your IP address is on your office network).

Since /etc/resolv.conf is not a bash script, you'll need to use a different technique there. The first thing I would ask is why the extra line you need isn't automatically inserted by DHCP, and whether there's some way you could modify /etc/conf.d/net to make it show up. If not, then I guess making /etc/resolv.conf.head a symlink and altering it to point to /etc/resolv.conf.office whenever you connect to the office network is probably a good way to go. Unfortunately, I don't know how to trigger a process to run whenever you connect to (or disconnect from) a network.

If you don't wind up getting good answers here, you might want to ask on the Gentoo Forums.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .