/[vps]/baselayout-vserver/trunk/init.d/domainname
Gentoo

Contents of /baselayout-vserver/trunk/init.d/domainname

Parent Directory Parent Directory | Revision Log Revision Log


Revision 3 - (show annotations) (download)
Sat Sep 3 16:10:27 2005 UTC (9 years, 1 month ago) by hollow
File size: 1416 byte(s)
import initial baselayout sources (1.12.0_pre8)
1 #!/sbin/runscript
2 # Copyright 1999-2005 Gentoo Foundation
3 # Distributed under the terms of the GNU General Public License v2
4
5 depend() {
6 need checkroot hostname
7 before bootmisc
8 }
9
10 checkconfig_nis() {
11 if [[ -f /etc/nisdomainname ]] ; then
12 ewarn "You should stop using /etc/nisdomainname and use /etc/conf.d/domainname"
13 export NISDOMAIN=$(</etc/nisdomainname)
14 return 0
15 fi
16 [[ -n ${NISDOMAIN} ]]
17 }
18
19 checkconfig_dns() {
20 if [[ -f /etc/dnsdomainname ]] ; then
21 ewarn "You should stop using /etc/dnsdomainname and use /etc/conf.d/domainname"
22 export DNSDOMAIN=$(</etc/dnsdomainname)
23 fi
24 [[ -z ${DNSDOMAIN} ]] && return 1
25
26 if ! touch /etc/resolv.conf 2> /dev/null ; then
27 ewarn "Unable to set domain in resolv.conf (ro root?)"
28 return 1
29 else
30 return 0
31 fi
32 }
33
34 start() {
35 local retval=0
36 local retval2=0
37
38 if checkconfig_nis ; then
39 ebegin "Setting NIS domainname to ${NISDOMAIN}"
40 /bin/domainname "${NISDOMAIN}"
41 retval=$?
42 eend ${retval} "Failed to set the NIS domainname"
43 fi
44
45 if checkconfig_dns ; then
46 ebegin "Setting DNS domainname to ${DNSDOMAIN}"
47 resolv=$(grep -v '^[[:space:]]*domain' /etc/resolv.conf)
48 [[ ${OVERRIDE} == "1" ]] \
49 && resolv="${resolv}"$'\n'"domain ${DNSDOMAIN}" \
50 || resolv="domain ${DNSDOMAIN}"$'\n'"${resolv}"
51 echo "${resolv}" > /etc/resolv.conf
52 retval2=$?
53 eend ${retval2} "Failed to set the DNS domainname"
54 fi
55
56 return $((retval + retval2))
57 }
58
59
60 # vim:ts=4

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20