#!/sbin/runscript # Copyright 1999-2005 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 depend() { need hostname before bootmisc } checkconfig_nis() { if [[ -f /etc/nisdomainname ]] ; then ewarn "You should stop using /etc/nisdomainname and use /etc/conf.d/domainname" export NISDOMAIN=$( /dev/null ; then ewarn "Unable to set domain in resolv.conf (ro root?)" return 1 else return 0 fi } start() { local retval=0 local retval2=0 if checkconfig_nis ; then ebegin "Setting NIS domainname to ${NISDOMAIN}" /bin/domainname "${NISDOMAIN}" retval=$? eend ${retval} "Failed to set the NIS domainname" fi if checkconfig_dns ; then ebegin "Setting DNS domainname to ${DNSDOMAIN}" resolv=$(grep -v '^[[:space:]]*domain' /etc/resolv.conf) [[ ${OVERRIDE} == "1" ]] \ && resolv="${resolv}"$'\n'"domain ${DNSDOMAIN}" \ || resolv="domain ${DNSDOMAIN}"$'\n'"${resolv}" echo "${resolv}" > /etc/resolv.conf retval2=$? eend ${retval2} "Failed to set the DNS domainname" fi return $((retval + retval2)) } # vim:ts=4