resolv revision 127345
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: head/etc/rc.d/resolv 127345 2004-03-23 23:22:35Z brooks $ 2866830Sobrien# 2943803Sdillon 30127345Sbrooks# PROVIDE: resolv 31127345Sbrooks# REQUIRE: initdiskless rcconf 32126744Spjd# KEYWORD: FreeBSD nojail 3375931Simp 34127345Sbrooks. /etc/rc.subr 3576409Sbsd 36127345Sbrooksname="resolv" 3776409Sbsd 38127345Sbrooksload_rc_config $name 3943803Sdillon 40108191Sdillon# if the info is available via dhcp/kenv 41108191Sdillon# build the resolv.conf 42108191Sdillon# 43120706Sphkif [ ! -e /etc/resolv.conf -a \ 44127345Sbrooks -n "`/bin/kenv dhcp.domain-name-servers 2> /dev/null`" ]; then 45127345Sbrooks /bin/cat /dev/null > /etc/resolv.conf 46108191Sdillon 47127345Sbrooks if [ -n "`/bin/kenv dhcp.domain-name 2> /dev/null`" ]; then 48127345Sbrooks echo domain `/bin/kenv dhcp.domain-name` > /etc/resolv.conf 49127345Sbrooks fi 50127345Sbrooks 51110943Sjhay set `/bin/kenv dhcp.domain-name-servers` 52108191Sdillon for ns in `IFS=','; echo $*`; do 53108191Sdillon echo nameserver $ns >> /etc/resolv.conf; 54108191Sdillon done 55108191Sdillonfi 56108191Sdillon 57