Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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!

share|improve this question

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

on_office_network && source /etc/

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:'

(where 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/ 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.

share|improve this answer

You must log in to answer this question.

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