/[baselayout]/trunk/net/system.sh
Gentoo

Contents of /trunk/net/system.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 2681 - (show annotations) (download) (as text)
Thu May 3 11:21:26 2007 UTC (7 years, 3 months ago) by uberlord
File MIME type: text/x-sh
File size: 2963 byte(s)
dns_sortlist and dns_options now work as documented, #175367.
1 # Copyright 2005-2007 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3
4 _config_vars="$_config_vars dns_servers dns_domain dns_search"
5 _config_vars="$_config_vars dns_sortlist dns_options"
6 _config_vars="$_config_vars ntp_servers nis_servers nis_domain"
7
8 system_depend() {
9 after interface
10 before dhcp
11 }
12
13 _system_dns() {
14 local servers= domain= search= sortlist= options= x=
15
16 eval servers=\$dns_servers_${IFVAR}
17 [ -z "${servers}" ] && servers=${dns_servers}
18
19 eval domain=\$dns_domain_${IFVAR}
20 [ -z "${domain}" ] && domain=${dns_domain}
21
22 eval search=\$dns_search_${IFVAR}
23 [ -z "${search}" ] && search=${dns_search}
24
25 eval sortlist=\$dns_sortlist_${IFVAR}
26 [ -z "${sortlist}" ] && sortlist=${dns_sortlist}
27
28 eval options=\$dns_options_${IFVAR}
29 [ -z "${options}" ] && options=${dns_options}
30
31 [ -z "${servers}" -a -z "${domain}" -a -z "${search}" \
32 -a -z "${sortlist}" -a -z "${options}" ] && return 0
33
34 local buffer="# Generated by net-scripts for interface ${IFACE}\n"
35 [ -n "${domain}" ] && buffer="${buffer}domain ${domain}\n"
36 [ -n "${search}" ] && buffer="${buffer}search ${search}\n"
37
38 for x in ${servers} ; do
39 buffer="${buffer}nameserver ${x}\n"
40 done
41
42 [ -n "${sortlist}" ] && buffer="${buffer}sortlist ${sortlist}\n"
43 [ -n "${options}" ] && buffer="${buffer}options ${options}\n"
44
45 # Support resolvconf if we have it.
46 if [ -x /sbin/resolvconf ] ; then
47 printf "${buffer}" | resolvconf -a "${IFACE}"
48 else
49 printf "${buffer}" > /etc/resolv.conf
50 chmod 644 /etc/resolv.conf
51 fi
52 }
53
54 _system_ntp() {
55 local servers= buffer= x=
56
57 eval servers=\$ntp_servers_${IFVAR}
58 [ -z ${servers} ] && servers=${ntp_servers}
59 [ -z ${servers} ] && return 0
60
61 buffer="# Generated by net-scripts for interface ${IFACE}\n"
62 buffer="${buffer}restrict default noquery notrust nomodify\n"
63 buffer="${buffer}restrict 127.0.0.1\n"
64
65 for x in ${servers} ; do
66 buffer="${buffer}restrict ${x} nomodify notrap noquery\n"
67 buffer="${buffer}server ${x}\n"
68 done
69
70 buffer="${buffer}driftfile /var/lib/ntp/ntp.drift\n"
71 buffer="${buffer}logfile /var/log/ntp.log\n"
72
73 printf "${buffer}" > /etc/ntp.conf
74 chmod 644 /etc/ntp.conf
75 }
76
77 _system_nis() {
78 local servers= domain= x= buffer=
79
80 eval servers=\$nis_servers_${IFVAR}
81 [ -z "${servers}" ] && servers=${nis_servers}
82
83 eval domain=\$nis_domain_${IFVAR}
84 [ -z "${domain}" ] && domain=${nis_domain}
85
86 [ -z "${servers}" -a -z "${domain}" ] && return 0
87
88 buffer="# Generated by net-scripts for interface ${iface}\n"
89
90 if [ -n "${domain}" ] ; then
91 hostname -y "${domain}"
92 if [ -n "${servers}" ] ; then
93 for x in ${servers} ; do
94 buffer="${buffer}domain ${domain} server ${x}\n"
95 done
96 else
97 buffer="${buffer}domain ${domain} broadcast\n"
98 fi
99 else
100 for x in ${servers} ; do
101 buffer="${buffer}ypserver ${x}\n"
102 done
103 fi
104
105 printf "${buffer}" > /etc/yp.conf
106 chmod 644 /etc/yp.conf
107 }
108
109 system_pre_start() {
110 _system_dns
111 _system_ntp
112 _system_nis
113
114 return 0
115 }
116
117 # vim: set ts=4 :

  ViewVC Help
Powered by ViewVC 1.1.20