166830Sobrien#!/bin/sh 266830Sobrien# 366830Sobrien# Copyright (c) 1999 Matt Dillon 466830Sobrien# All rights reserved. 566830Sobrien# 666830Sobrien# Redistribution and use in source and binary forms, with or without 766830Sobrien# modification, are permitted provided that the following conditions 866830Sobrien# are met: 966830Sobrien# 1. Redistributions of source code must retain the above copyright 1066830Sobrien# notice, this list of conditions and the following disclaimer. 1166830Sobrien# 2. Redistributions in binary form must reproduce the above copyright 1266830Sobrien# notice, this list of conditions and the following disclaimer in the 1366830Sobrien# documentation and/or other materials provided with the distribution. 1466830Sobrien# 1566830Sobrien# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1666830Sobrien# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1766830Sobrien# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1866830Sobrien# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1966830Sobrien# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2066830Sobrien# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2166830Sobrien# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2266830Sobrien# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2366830Sobrien# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2466830Sobrien# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25100280Sgordon# SUCH DAMAGE. 2651231Ssheldonh# 2766830Sobrien# $FreeBSD$ 2866830Sobrien# 2943803Sdillon 30127345Sbrooks# PROVIDE: resolv 31240336Sobrien# REQUIRE: netif FILESYSTEMS 32136224Smtm# KEYWORD: nojail 3375931Simp 34127345Sbrooks. /etc/rc.subr 3576409Sbsd 36127345Sbrooksname="resolv" 37298514Slmedesc="Create /etc/resolv.conf from kenv" 38174464Sdougbstop_cmd=':' 3976409Sbsd 40127345Sbrooksload_rc_config $name 4143803Sdillon 42108191Sdillon# if the info is available via dhcp/kenv 43108191Sdillon# build the resolv.conf 44108191Sdillon# 45225670Shrsif [ -n "`/bin/kenv dhcp.domain-name-servers 2> /dev/null`" ]; then 46225670Shrs interface="`/bin/kenv boot.netif.name`" 47225670Shrs ( 48127345Sbrooks if [ -n "`/bin/kenv dhcp.domain-name 2> /dev/null`" ]; then 49225670Shrs echo domain `/bin/kenv dhcp.domain-name` 50127345Sbrooks fi 51127345Sbrooks 52170198Sdougb set -- `/bin/kenv dhcp.domain-name-servers` 53170198Sdougb for ns in `IFS=','; echo $*`; do 54225670Shrs echo nameserver $ns 55170198Sdougb done 56225670Shrs ) | /sbin/resolvconf -a ${interface}:dhcp4 57108191Sdillonfi 58108191Sdillon 59