/[baselayout]/trunk/init.d/domainname
Gentoo

Contents of /trunk/init.d/domainname

Parent Directory Parent Directory | Revision Log Revision Log


Revision 693 - (show annotations) (download)
Mon Nov 15 15:43:28 2004 UTC (8 years, 6 months ago) by vapier
File size: 1423 byte(s)
new hostname/domainname scripts; move configuration to the standard conf.d/{hostname,domainname} files

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

Properties

Name Value
svn:eol-style native
svn:executable *
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.13