#! /bin/sh

### BEGIN SUBROUTINE INFO
# Provides-Var:    $DNSSRVS $DOMAIN
# Requires-Var:    none
# Short-Description: <task desc.>
### END SUBROUTINE INFO

# use resolv.conf from dracut's initrd
if [ -f /run/initramfs/state/etc/resolv.conf ]; then
    cp  /run/initramfs/state/etc/resolv.conf /etc/resolv.conf
elif [ "$DNSSRVS" ]; then
    # create a resolv.conf using the DHCP information
    [ "$DOMAIN" ] && echo "domain $DOMAIN" >/etc/resolv.conf
    for dnshost in $DNSSRVS ; do
        echo "nameserver $dnshost" >>/etc/resolv.conf
    done
else
    # use the resolv.conf from the installserver
    [ -f /etc/resolv.conf-installserver ] && cp -p /etc/resolv.conf-installserver /etc/resolv.conf
fi
