Menu ▾ ▴

#4 stage 10 overwrites resolv.conf

open
None
5
2003-11-07
2003-10-28
Cal Evans
No

When I execute:
./glis 10 ./config
removes my existing /mnt/gentoo/etc/resolv.conf but
does not write a new one.

The problem seems to stem from this line in 100:
if [ $(ifconfig -a | grep -c eth[0-9]) -gt 0 ]; then

My interface is wlan0 it's defined in the config file
in the variable IFACE_PRE.

I've added a line to grab the DNS server if the domain
is set to DHCP in the config file.

[ "${DOMAIN}" == "DHCP" ] && DNS="$(cat
/etc/dhcpc/dhcp*.info | grep DNS | sort | uniq | tail
-n 1 | cut -d = -f2 | sed "s/'//g")"

Then I added a line to add the new DNS into the resolv.conf

echo "nameserver ${DNS}" >
/mnt/gentoo/etc/resolv.conf
echo "search ${DOMAIN}" >>
/mnt/gentoo/etc/resolv.conf
echo "domain ${DOMAIN}" >>
/mnt/gentoo/etc/resolv.conf

Finally, I moved the lines that build the resolv.conf
OUT of the for loop that spins through the eth*'s since
in my case it would never get triggered.

=C=

Discussion

  • Cal Evans

    Cal Evans - 2003-10-28

    Logged In: YES
    user_id=25137

    The line:

    [ "${DOMAIN}" == "DHCP" ] && DNS="$(cat
    /etc/dhcpc/dhcp*.info | grep DNS | sort | uniq | tail
    -n 1 | cut -d = -f2 | sed "s/'//g")"

    Needs to go directly beneath line 35 (echo ${HOSTNAME} >
    /mnt/gentoo/etc/hostname || return 1) in functions/100.

    =C=

     
  • Kevin Patrick Crowley

    • assigned_to: nobody --> calevans
     
  • Scott Hadfield

    Scott Hadfield - 2004-01-04

    Logged In: YES
    user_id=874833

    Perhaps a solution to this would be to add a IFACE_POST to
    the network configuration variables. This way
    100-implement_config wouldn't need to read the ifconfig
    output to do it's thing. It could just do what the config
    file tells it. A FE could control whether or not the user
    could add an interface. This would also allow for something
    like:

    IFACE_POST[0]="wlan0"
    IFACE_IP_POST[0]="192.168.0.22"
    IFACE_NETMASK_POST[0]="255.255.255.0"
    IFACE_BROADCAST_POST[0]="192.168.0.255"
    IFACE_GATEWAY_POST[0]="192.168.0.1" # Optional

    Which is currently not possible. What do you think?

     

Log in to post a comment.