On Sat, May 21, 2005 at 12:35:45PM +0200, Jean Magnan de Bornier wrote

> I want to execute "ln -sf /etc/resolv.conf.fac /etc/resolv.conf" *before*
> /etc/init.d/net.eth0, so that if I am at the "fac" (my office) location I
> have these dns set up, but if I am home with dhcp the resolv.conf
> file will be overwritten. 
> Should I add a script in /etc/init.d for that, or is there something simpler?
> cheers,

  I don't think that you can get it done *BEFORE* net.eth0 is run. 
Gentoo needs to run net.eth0 to set up the network connection.  Then it
has to query ifconfig to find out what the situation is.  I think what
you need is to correct resolv.conf if you are at the office.  The
official Gentoo way to do this would be an init script.  I recommend the
following...

  1) If "local" is not already in the default runlevel, execute...

     etc-update add local default


  2) In /etc/conf.d/local.start add the following lines

if ifconfig eth0 | grep 194\.199\.136\.151 > /dev/null ; then
  cp /etc/resolv.conf.fac /etc/resolv.conf
fi

  *IMPORTANT*.  You must *COPY* /etc/resolv.conf.fac.  If you symlink it
to /etc/resolv.conf, then the next time dhcp overwrites /etc/resolv.conf
it will be overwriting /etc/resolv.conf.fac

-- 
Walter Dnes <[EMAIL PROTECTED]>
An infinite number of monkeys pounding away on keyboards will
eventually produce a report showing that Windows is more secure,
and has a lower TCO, than linux.
-- 
gentoo-user@gentoo.org mailing list

Reply via email to