Lines 2-8
Link Here
|
2 |
# |
2 |
# |
3 |
# djbdns-setup |
3 |
# djbdns-setup |
4 |
# |
4 |
# |
5 |
# Copyright (C) 2004 Kalin Kozhuharov <kalin@ThinRope.net> |
5 |
# Copyright (C) 2004-2006 Kalin KOZHUHAROV <kalin@thinrope.net> |
|
|
6 |
# The latest version of this script can be accessed at: |
7 |
# rsync://rsync.tar.bz/gentoo-portage-pkalin/net-dns/djbdns/files/djbdns-setup |
6 |
# |
8 |
# |
7 |
# This program is free software; you can redistribute it and/or |
9 |
# This program is free software; you can redistribute it and/or |
8 |
# modify it under the terms of the GNU General Public License |
10 |
# modify it under the terms of the GNU General Public License |
Lines 16-36
Link Here
|
16 |
# http://www.gnu.org/copyleft/gpl.html |
18 |
# http://www.gnu.org/copyleft/gpl.html |
17 |
# |
19 |
# |
18 |
|
20 |
|
19 |
. /sbin/functions.sh |
21 |
# {{{ Rip off the ewarn code from /sbin/functions.sh |
20 |
# void ewarn(char* message) |
22 |
WARN=$'\e[33;01m' |
21 |
# |
23 |
NORMAL=$'\e[0m' |
22 |
# show a warning message and do NOT log it |
|
|
23 |
ewarn() { |
24 |
ewarn() { |
24 |
if [ "${RC_QUIET_STDOUT}" = "yes" ] |
25 |
echo -e " ${WARN}*${NORMAL} $*" |
25 |
then |
|
|
26 |
echo " ${*}" |
27 |
else |
28 |
echo -e " ${WARN}*${NORMAL} ${*}" |
29 |
fi |
30 |
|
31 |
return 0 |
26 |
return 0 |
32 |
} |
27 |
} |
|
|
28 |
# }}} |
33 |
|
29 |
|
|
|
30 |
# {{{ global vars |
34 |
S_SEPARATOR="--------------------------------------------------------------------------------" |
31 |
S_SEPARATOR="--------------------------------------------------------------------------------" |
35 |
D_SEPARATOR="================================================================================" |
32 |
D_SEPARATOR="================================================================================" |
36 |
|
33 |
|
Lines 44-86
Link Here
|
44 |
tinydns=1 |
41 |
tinydns=1 |
45 |
axfrdns=2 |
42 |
axfrdns=2 |
46 |
|
43 |
|
|
|
44 |
# global vars }}} |
45 |
|
46 |
# {{{ functions |
47 |
check_group_users() |
47 |
check_group_users() |
48 |
{ |
48 |
{ |
49 |
echo ": Checking for required group (${REQ_GROUP}) :" |
49 |
echo ": Checking for required group (${REQ_GROUP}) :" |
50 |
grep ${REQ_GROUP} /etc/group &> /dev/null |
50 |
grep ${REQ_GROUP} /etc/group &> /dev/null |
51 |
if [ $? -ne 0 ] |
51 |
if [ $? -ne 0 ] |
52 |
then |
52 |
then |
53 |
ebegin "Adding group ${REQ_GROUP}" |
53 |
ebegin "Adding group ${REQ_GROUP}" |
54 |
/usr/sbin/groupadd ${REQ_GROUP} &>/dev/null && eend 0 || eend 1 |
54 |
/usr/sbin/groupadd ${REQ_GROUP} &>/dev/null && eend 0 || eend 1 |
55 |
fi |
55 |
fi |
56 |
|
56 |
|
57 |
echo ": Checking for required users (${REQ_USERS}) :" |
57 |
echo ": Checking for required users (${REQ_USERS}) :" |
58 |
for user in ${REQ_USERS}; |
58 |
for user in ${REQ_USERS}; |
59 |
do |
59 |
do |
60 |
grep ${user} /etc/passwd &> /dev/null |
60 |
grep ${user} /etc/passwd &> /dev/null |
61 |
if [ $? -ne 0 ] |
61 |
if [ $? -ne 0 ] |
62 |
then |
62 |
then |
63 |
ebegin "Adding user ${user}" |
63 |
ebegin "Adding user ${user}" |
64 |
/usr/sbin/useradd -d /dev/null -s /bin/false -g ${REQ_GROUP} ${user} &>/dev/null && eend 0 || eend 1 |
64 |
/usr/sbin/useradd -d /dev/null -s /bin/false -g ${REQ_GROUP} ${user} &>/dev/null && eend 0 || eend 1 |
65 |
fi |
65 |
fi |
66 |
done |
66 |
done |
67 |
return 0 |
67 |
return 0 |
68 |
} |
68 |
} |
69 |
|
69 |
|
70 |
start_services() |
70 |
start_services() |
71 |
{ |
71 |
{ |
72 |
local services="$1" |
72 |
local services="$1" |
73 |
|
73 |
|
74 |
echo "${SEPARATOR}" |
74 |
echo "${SEPARATOR}" |
75 |
echo ": Start services :" |
75 |
echo ": Start services :" |
76 |
echo |
76 |
echo |
77 |
echo " Your services (${services// /, }) are ready for startup!" |
77 |
echo " Your services (${services// /, }) are ready for startup!" |
78 |
echo |
78 |
echo |
79 |
ewarn " The following requires daemontools to be running!" |
79 |
ewarn " The following requires daemontools to be running!" |
80 |
local answer="" |
80 |
local answer="" |
81 |
read -p " Would you like ${services// /, } to be started and supervised by daemontools now? [Y|n]> " answer |
81 |
read -p " Would you like ${services// /, } to be started and supervised by daemontools now? [Y|n]> " answer |
82 |
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ] |
82 |
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ] |
83 |
then |
83 |
then |
84 |
|
84 |
|
85 |
ebegin "Checking if daemontools are running" |
85 |
ebegin "Checking if daemontools are running" |
86 |
ps -A |grep svscanboot &>/dev/null && eend 0 || eend 1 |
86 |
ps -A |grep svscanboot &>/dev/null && eend 0 || eend 1 |
Lines 91-100
Link Here
|
91 |
local fixedroot_path=`echo ${mypath} | sed -e 's#^/#../#'` |
91 |
local fixedroot_path=`echo ${mypath} | sed -e 's#^/#../#'` |
92 |
for service in ${services}; |
92 |
for service in ${services}; |
93 |
do |
93 |
do |
94 |
for ip in ${IPs[${service}]}; |
94 |
for ip in ${IPs[${service}]}; |
95 |
do |
95 |
do |
96 |
ln -sf ${fixedroot_path}/${service}/${ip} /service/${service}_${ip} |
96 |
ln -sf ${fixedroot_path}/${service}/${ip} /service/${service}_${ip} |
97 |
done |
97 |
done |
98 |
done |
98 |
done |
99 |
|
99 |
|
100 |
eend 0 |
100 |
eend 0 |
Lines 110-127
Link Here
|
110 |
echo |
110 |
echo |
111 |
for service in ${services}; |
111 |
for service in ${services}; |
112 |
do |
112 |
do |
113 |
for ip in ${IPs[${service}]}; |
113 |
for ip in ${IPs[${service}]}; |
114 |
do |
114 |
do |
115 |
svstat /service/${service}_${ip} /service/${service}_${ip}/log |
115 |
svstat /service/${service}_${ip} /service/${service}_${ip}/log |
116 |
done |
116 |
done |
117 |
done |
117 |
done |
118 |
fi |
118 |
fi |
119 |
return 0 |
119 |
return 0 |
120 |
} |
120 |
} |
121 |
|
121 |
|
122 |
tinydns_setup() |
122 |
tinydns_setup() |
123 |
{ |
123 |
{ |
124 |
return 0 |
124 |
return 0 |
125 |
} |
125 |
} |
126 |
|
126 |
|
127 |
axfrdns_setup() |
127 |
axfrdns_setup() |
Lines 131-137
Link Here
|
131 |
echo |
131 |
echo |
132 |
TCPRULES_DIR="${mypath}/axfrdns/${myip}/control" |
132 |
TCPRULES_DIR="${mypath}/axfrdns/${myip}/control" |
133 |
echo " axfrdns is accessed by your secondary servers and when response cannot fit UDP packet" |
133 |
echo " axfrdns is accessed by your secondary servers and when response cannot fit UDP packet" |
134 |
echo " You have to specify their which IP addresses are allowed to access it" |
134 |
echo " You have to specify which IP addresses are allowed to access it" |
135 |
echo " in ${TCPRULES_DIR}/tcp.axfrdns" |
135 |
echo " in ${TCPRULES_DIR}/tcp.axfrdns" |
136 |
echo |
136 |
echo |
137 |
echo " Example:" |
137 |
echo " Example:" |
Lines 145-168
Link Here
|
145 |
sed -i -e "s#-x tcp.cdb#-x control/tcp.axfrdns.cdb#g" ${mypath}/axfrdns/${myip}/run |
145 |
sed -i -e "s#-x tcp.cdb#-x control/tcp.axfrdns.cdb#g" ${mypath}/axfrdns/${myip}/run |
146 |
if [ -e ${TCPRULES_DIR}/tcp.axfrdns ] |
146 |
if [ -e ${TCPRULES_DIR}/tcp.axfrdns ] |
147 |
then |
147 |
then |
148 |
ewarn "${TCPRULES_DIR}/tcp.axfrdns exists." |
148 |
ewarn "${TCPRULES_DIR}/tcp.axfrdns exists." |
149 |
read -p " Do you want it cleared? [Y|n]: " answer |
149 |
read -p " Do you want it cleared? [y|N]: " answer |
150 |
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ] |
150 |
if [ "${answer}" == "y" ] |
151 |
then |
151 |
then |
152 |
echo '# sample line: 1.2.3.4:allow,AXFR="heaven.af.mil/3.2.1.in-addr.arpa"' > ${TCPRULES_DIR}/tcp.axfrdns |
152 |
echo '# sample line: 1.2.3.4:allow,AXFR="heaven.af.mil/3.2.1.in-addr.arpa"' > ${TCPRULES_DIR}/tcp.axfrdns |
153 |
fi |
153 |
fi |
154 |
fi |
154 |
fi |
155 |
|
155 |
|
156 |
read -p " IP to allow (press Enter to end)> " ipallow |
156 |
read -p " IP to allow (press Enter to end)> " ipallow |
157 |
|
157 |
|
158 |
while [ "$ipallow" != "" ] |
158 |
while [ "$ipallow" != "" ] |
159 |
do |
159 |
do |
160 |
echo "${ipallow}:allow" >> ${TCPRULES_DIR}/tcp.axfrdns |
160 |
echo "${ipallow}:allow" >> ${TCPRULES_DIR}/tcp.axfrdns |
161 |
read -p " IP to allow (press Enter to end)> " ipallow |
161 |
read -p " IP to allow (press Enter to end)> " ipallow |
162 |
done |
162 |
done |
163 |
echo ":deny" >> ${TCPRULES_DIR}/tcp.axfrdns |
163 |
echo ":deny" >> ${TCPRULES_DIR}/tcp.axfrdns |
164 |
|
164 |
|
165 |
echo " Here is the tcprules file created so far:" |
165 |
echo " Here are the tcprules created so far:" |
166 |
echo |
166 |
echo |
167 |
cat ${TCPRULES_DIR}/tcp.axfrdns |
167 |
cat ${TCPRULES_DIR}/tcp.axfrdns |
168 |
echo |
168 |
echo |
Lines 170-177
Link Here
|
170 |
read -p " Would you like ${TCPRULES_DIR}/tcp.axfrdns.cdb updated? [Y|n]: " answer |
170 |
read -p " Would you like ${TCPRULES_DIR}/tcp.axfrdns.cdb updated? [Y|n]: " answer |
171 |
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ] |
171 |
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ] |
172 |
then |
172 |
then |
173 |
ebegin "Updating ${TCPRULES_DIR}/tcp.axfrdns.cdb" |
173 |
ebegin "Updating ${TCPRULES_DIR}/tcp.axfrdns.cdb" |
174 |
bash -c "cd ${TCPRULES_DIR} && make" && eend 0 || eend 1 |
174 |
bash -c "cd ${TCPRULES_DIR} && make" && eend 0 || eend 1 |
175 |
fi |
175 |
fi |
176 |
return 0 |
176 |
return 0 |
177 |
} |
177 |
} |
Lines 180-189
Link Here
|
180 |
{ |
180 |
{ |
181 |
echo ": Configure forwarding :" |
181 |
echo ": Configure forwarding :" |
182 |
echo |
182 |
echo |
183 |
echo " dnscache can be configured to forward queries to another DNS cache" |
183 |
echo " dnscache can be configured to forward queries to another" |
184 |
echo " (such as the one your ISP provides) rather than perform the lookups itself." |
184 |
echo " DNS cache (such as the one your ISP provides) rather than" |
|
|
185 |
echo " performing the lookups itself." |
185 |
echo |
186 |
echo |
186 |
echo " To enable this forwarding-only mode (a good idea most of the time)," |
187 |
echo " To enable this forwarding-only mode (usually a good idea)," |
187 |
echo " provide the IPs of the caches to forward to." |
188 |
echo " provide the IPs of the caches to forward to." |
188 |
echo " To have dnscache perform the lookups itself, just press Enter." |
189 |
echo " To have dnscache perform the lookups itself, just press Enter." |
189 |
echo |
190 |
echo |
Lines 191-232
Link Here
|
191 |
echo |
192 |
echo |
192 |
if [ "$myforward" != "" ] |
193 |
if [ "$myforward" != "" ] |
193 |
then |
194 |
then |
194 |
echo $myforward > ${mypath}/dnscache/${myip}/root/servers/\@ |
195 |
echo $myforward > ${mypath}/dnscache/${myip}/root/servers/\@ |
195 |
echo -n "1" > ${mypath}/dnscache/${myip}/env/FORWARDONLY |
196 |
echo -n "1" > ${mypath}/dnscache/${myip}/env/FORWARDONLY |
196 |
|
197 |
|
197 |
read -p " forward-to IP (press Enter to end)> " myforward |
198 |
read -p " forward-to IP (press Enter to end)> " myforward |
198 |
while [ "$myforward" != "" ] |
199 |
while [ "$myforward" != "" ] |
199 |
do |
200 |
do |
200 |
echo $myforward >> ${mypath}/dnscache/${myip}/root/servers/\@ |
201 |
echo $myforward >> ${mypath}/dnscache/${myip}/root/servers/\@ |
201 |
read -p " forward-to IP (press Enter to end)> " myforward |
202 |
read -p " forward-to IP (press Enter to end)> " myforward |
202 |
done |
203 |
done |
203 |
|
204 |
|
204 |
echo |
205 |
echo |
205 |
echo " Currently all queries will be forwarded to:" |
206 |
echo " Currently all queries will be forwarded to:" |
206 |
echo |
207 |
echo |
207 |
cat ${mypath}/dnscache/${myip}/root/servers/\@ |
208 |
cat ${mypath}/dnscache/${myip}/root/servers/\@ |
208 |
echo |
209 |
echo |
209 |
fi |
210 |
fi |
210 |
|
211 |
|
211 |
echo "${SEPARATOR}" |
212 |
echo "${SEPARATOR}" |
212 |
echo ": Configuring clients :" |
213 |
echo ": Configuring clients :" |
213 |
echo |
214 |
echo |
214 |
echo " By default dnscache allows only localhost (127.0.0.1) to access it." |
215 |
echo " By default dnscache allows only localhost (127.0.0.1) to" |
215 |
echo " You have to specify the IP addresses of the clients that shall be allowed to use it." |
216 |
echo " access it. You have to specify the IP addresses of the" |
|
|
217 |
echo " clients that shall be allowed to use it." |
216 |
echo |
218 |
echo |
217 |
echo " Example:" |
219 |
echo " Example:" |
218 |
echo " 1.2.3.4 would allow only the host 1.2.3.4" |
220 |
echo " 1.2.3.4 would allow only one host: 1.2.3.4" |
219 |
echo " 1.2.3 would allow all hosts 1.2.3.x (like 1.2.3.4, 1.2.3.100, etc.)" |
221 |
echo " 1.2.3 would allow all hosts 1.2.3.0/24 (e.g. 1.2.3.4, 1.2.3.100, etc.)" |
220 |
echo |
222 |
echo |
221 |
echo " Press Enter if you do not want to allow external clients!" |
223 |
echo " Press Enter if you do NOT want to allow external clients!" |
222 |
echo |
224 |
echo |
223 |
|
225 |
|
224 |
read -p " Allowed IP> " myclientip |
226 |
read -p " Allowed IP> " myclientip |
225 |
|
227 |
|
226 |
while [ "$myclientip" != "" ] |
228 |
while [ "$myclientip" != "" ] |
227 |
do |
229 |
do |
228 |
touch ${mypath}/dnscache/${myip}/root/ip/${myclientip} |
230 |
touch ${mypath}/dnscache/${myip}/root/ip/${myclientip} |
229 |
read -p " Allowed IP (press Enter to end)> " myclientip |
231 |
read -p " Allowed IP (press Enter to end)> " myclientip |
230 |
done |
232 |
done |
231 |
|
233 |
|
232 |
echo |
234 |
echo |
Lines 245-418
Link Here
|
245 |
|
247 |
|
246 |
common_setup() |
248 |
common_setup() |
247 |
{ |
249 |
{ |
248 |
local service_human="$1" |
250 |
local service_human="$1" |
249 |
local service_machine="$2" |
251 |
local service_machine="$2" |
250 |
local services="$3" |
252 |
local services="$3" |
251 |
|
253 |
|
252 |
echo ": ${service_human} setup :" |
254 |
echo ": ${service_human} setup :" |
253 |
echo |
255 |
echo |
254 |
|
256 |
|
255 |
for service in ${services}; |
257 |
for service in ${services}; |
256 |
do |
258 |
do |
257 |
if [ ! -e ${mypath}/${service} ] |
259 |
if [ ! -e ${mypath}/${service} ] |
258 |
then |
260 |
then |
259 |
ebegin "Creating ${mypath}/${service}" |
261 |
ebegin "Creating ${mypath}/${service}" |
260 |
mkdir -p $mypath/${service} && eend 0 || eend 1 |
262 |
mkdir -p $mypath/${service} && eend 0 || eend 1 |
261 |
fi |
263 |
fi |
262 |
done |
264 |
done |
263 |
|
265 |
|
264 |
echo "${SEPARATOR}" |
266 |
echo "${SEPARATOR}" |
265 |
echo ": IP address to bind to :" |
267 |
echo ": IP address to bind to :" |
266 |
echo |
268 |
echo |
267 |
echo " Specify an address to which the ${service_human} should bind." |
269 |
echo " Specify an address to which the ${service_human} should bind." |
268 |
echo " Currently accessible IPs:" |
270 |
echo " Currently accessible IPs:" |
269 |
local addrs=`ifconfig -a | grep "inet addr" | cut -f2 -d":" | cut -f1 -d" "` |
271 |
local addrs=`ifconfig -a | grep "inet addr" | cut -f2 -d":" | cut -f1 -d" "` |
270 |
echo " "$addrs |
272 |
echo " "$addrs |
271 |
echo |
273 |
echo |
272 |
|
274 |
|
273 |
while [ "${myip}" == "" ] |
275 |
while [ "${myip}" == "" ] |
274 |
do |
276 |
do |
275 |
read -p " IP to bind to> " myip |
277 |
read -p " IP to bind to> " myip |
276 |
done |
278 |
done |
277 |
echo |
279 |
echo |
278 |
|
280 |
|
279 |
for service in ${services}; |
281 |
for service in ${services}; |
280 |
do |
282 |
do |
281 |
IPs[${service}]="${IPs[${service}]} ${myip}" |
283 |
IPs[${service}]="${IPs[${service}]} ${myip}" |
282 |
done |
284 |
done |
283 |
|
285 |
|
284 |
local dnscache_INSTALL="/usr/bin/dnscache-conf dnscache dnslog ${mypath}/dnscache/${myip} $myip" |
286 |
local dnscache_INSTALL="/usr/bin/dnscache-conf dnscache dnslog ${mypath}/dnscache/${myip} $myip" |
285 |
local tinydns_INSTALL="/usr/bin/tinydns-conf tinydns dnslog ${mypath}/tinydns/${myip} $myip" |
287 |
local tinydns_INSTALL="/usr/bin/tinydns-conf tinydns dnslog ${mypath}/tinydns/${myip} $myip" |
286 |
local axfrdns_INSTALL="\ |
288 |
local axfrdns_INSTALL="\ |
287 |
/usr/bin/axfrdns-conf tinydns dnslog ${mypath}/axfrdns/${myip} ${mypath}/tinydns/${myip} $myip &&\ |
289 |
/usr/bin/axfrdns-conf tinydns dnslog ${mypath}/axfrdns/${myip} ${mypath}/tinydns/${myip} $myip &&\ |
288 |
mkdir -p ${mypath}/axfrdns/${myip}/control &&\ |
290 |
mkdir -p ${mypath}/axfrdns/${myip}/control &&\ |
289 |
echo -e \"tcp.axfrdns.cdb:\ttcp.axfrdns\n\ttcprules tcp.axfrdns.cdb .tcp.axfrdns.cdb.tmp < tcp.axfrdns\" > ${mypath}/axfrdns/${myip}/control/Makefile &&\ |
291 |
echo -e \"tcp.axfrdns.cdb:\ttcp.axfrdns\n\ttcprules tcp.axfrdns.cdb .tcp.axfrdns.cdb.tmp < tcp.axfrdns\" > ${mypath}/axfrdns/${myip}/control/Makefile &&\ |
290 |
rm -f ${mypath}/axfrdns/${myip}/tcp ${mypath}/axfrdns/${myip}/Makefile" |
292 |
rm -f ${mypath}/axfrdns/${myip}/tcp ${mypath}/axfrdns/${myip}/Makefile" |
291 |
|
293 |
|
292 |
for service in ${services}; |
294 |
for service in ${services}; |
293 |
do |
295 |
do |
294 |
if [ ! -e ${mypath}/${service}/${myip} ] |
296 |
if [ ! -e ${mypath}/${service}/${myip} ] |
295 |
then |
297 |
then |
296 |
ebegin "Setting up ${service} in ${mypath}/${service}/${myip}" |
298 |
ebegin "Setting up ${service} in ${mypath}/${service}/${myip}" |
297 |
eval command=\$${service}_INSTALL |
299 |
eval command=\$${service}_INSTALL |
298 |
/bin/bash -c "${command}" && eend 0 || eend 1 |
300 |
/bin/bash -c "${command}" && eend 0 || eend 1 |
299 |
else |
301 |
else |
300 |
ewarn "${service} directory ${mypath}/${service}/${myip} exists, nothing done." |
302 |
ewarn "${service} directory ${mypath}/${service}/${myip} exists, nothing done." |
301 |
fi |
303 |
fi |
302 |
done |
304 |
done |
303 |
|
305 |
|
304 |
} |
306 |
} |
305 |
|
307 |
|
|
|
308 |
# functions }}} |
306 |
|
309 |
|
307 |
|
310 |
# {{{ main script |
308 |
|
|
|
309 |
|
310 |
|
311 |
|
311 |
if [ `id -u` -ne 0 ] |
312 |
if [ `id -u` -ne 0 ] |
312 |
then |
313 |
then |
313 |
eerror "${0}: You must be root." |
314 |
ewarn "You must be root to run this script, sorry." |
314 |
exit 1 |
315 |
exit 1 |
315 |
else |
316 |
else |
316 |
|
317 |
|
317 |
echo "${D_SEPARATOR}" |
318 |
echo "${D_SEPARATOR}" |
318 |
echo ": DJB DNS setup :" |
319 |
echo ": DJB DNS setup :" |
319 |
echo |
320 |
echo |
320 |
echo " This script will help you setup the following:" |
321 |
echo " This script will help you setup the following:" |
321 |
echo |
322 |
echo |
322 |
echo " DNS server(s): to publish addresses of Internet hosts" |
323 |
echo " DNS server(s): to publish addresses of Internet hosts" |
323 |
echo |
324 |
echo |
324 |
echo " DNS cache(s) : to find addresses of Internet hosts" |
325 |
echo " DNS cache(s) : to find addresses of Internet hosts" |
325 |
echo |
326 |
echo |
326 |
echo " For further information see:" |
327 |
echo " For further information see:" |
327 |
echo " http://cr.yp.to/djbdns/blurb/overview.html" |
328 |
echo " http://cr.yp.to/djbdns/blurb/overview.html" |
328 |
echo |
329 |
echo |
329 |
ewarn "If you have already setup your services," |
330 |
ewarn "If you have already setup your services," |
330 |
ewarn "either exit now, or setup in different directories." |
331 |
ewarn "either exit now, or setup in different directories." |
331 |
echo |
332 |
echo |
332 |
|
333 |
|
333 |
answer="" |
334 |
answer="" |
334 |
read -p " Would you like to continue with setup? [Y|n]> " answer |
335 |
read -p " Would you like to continue with setup? [Y|n]> " answer |
335 |
if [ "${answer}" == "n" ] || [ "${answer}" == "N" ] |
336 |
if [ "${answer}" == "n" ] || [ "${answer}" == "N" ] |
336 |
then |
337 |
then |
337 |
ewarn "Aborting setup" |
338 |
ewarn "Aborting setup" |
338 |
exit 1 |
339 |
exit 1 |
339 |
fi |
340 |
fi |
340 |
|
341 |
|
341 |
echo "${D_SEPARATOR}" |
342 |
echo "${D_SEPARATOR}" |
342 |
echo ": Choose install location :" |
343 |
echo ": Choose install location :" |
343 |
echo |
344 |
echo |
344 |
default_path="/var" |
345 |
default_path="/var" |
345 |
echo " The default (${default_path}) will install them" |
346 |
echo " The default (${default_path}) will install them" |
346 |
echo " in ${default_path}/\${service}/\${IP_ADDRESS}" |
347 |
echo " in ${default_path}/\${service}/\${IP_ADDRESS}" |
347 |
echo |
348 |
echo |
348 |
echo " For example:" |
349 |
echo " For example:" |
349 |
echo " /var/tinydns /1.2.3.4" |
350 |
echo " /var/tinydns /1.2.3.4" |
350 |
echo " /192.168.33.1" |
351 |
echo " /192.168.33.1" |
351 |
echo " /axfrdns /1.2.3.4" |
352 |
echo " /axfrdns /1.2.3.4" |
352 |
echo " /192.168.33.1" |
353 |
echo " /192.168.33.1" |
353 |
echo " /dnscache/127.0.0.1" |
354 |
echo " /dnscache/127.0.0.1" |
354 |
echo |
355 |
echo |
355 |
ewarn "Do NOT enter trailing slash" |
356 |
ewarn "Do NOT enter trailing slash" |
356 |
echo " Where do you want services installed?" |
357 |
echo " Where do you want services installed?" |
357 |
read -p "[${default_path}] > " mypath |
358 |
read -p "[${default_path}] > " mypath |
358 |
echo |
359 |
echo |
359 |
|
360 |
|
360 |
if [ "${mypath}" == "" ] |
361 |
if [ "${mypath}" == "" ] |
361 |
then |
362 |
then |
362 |
mypath=${default_path} |
363 |
mypath=${default_path} |
363 |
fi |
364 |
fi |
364 |
|
365 |
|
365 |
echo "${D_SEPARATOR}" |
366 |
echo "${D_SEPARATOR}" |
366 |
check_group_users |
367 |
check_group_users |
367 |
|
368 |
|
368 |
answer="" |
369 |
answer="" |
369 |
another="" |
370 |
another="" |
370 |
until [ "$answer" == "n" ] |
371 |
until [ "$answer" == "n" ] |
371 |
do |
372 |
do |
372 |
echo "${D_SEPARATOR}" |
373 |
echo "${D_SEPARATOR}" |
373 |
answer="" |
374 |
answer="" |
374 |
read -p " Would you like to setup ${another}dnscache? [Y|n]> " answer |
375 |
read -p " Would you like to setup ${another}dnscache? [Y|n]> " answer |
375 |
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ] |
376 |
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ] |
376 |
then |
377 |
then |
377 |
myip="" |
378 |
myip="" |
378 |
echo "${S_SEPARATOR}" |
379 |
echo "${S_SEPARATOR}" |
379 |
common_setup "DNS cache" "dnscache" "dnscache" |
380 |
common_setup "DNS cache" "dnscache" "dnscache" |
380 |
if [ $? == 0 ] |
381 |
if [ $? == 0 ] |
381 |
then |
382 |
then |
382 |
dnscache_setup |
383 |
dnscache_setup |
383 |
else |
384 |
else |
384 |
ewarn "Skipping dnscache specific setup." |
385 |
ewarn "Skipping dnscache specific setup." |
385 |
fi |
386 |
fi |
386 |
fi |
387 |
fi |
387 |
another="another " |
388 |
another="another " |
388 |
done |
389 |
done |
389 |
|
390 |
|
390 |
answer="" |
391 |
answer="" |
391 |
another="" |
392 |
another="" |
392 |
until [ "$answer" == "n" ] |
393 |
until [ "$answer" == "n" ] |
393 |
do |
394 |
do |
394 |
echo "${D_SEPARATOR}" |
395 |
echo "${D_SEPARATOR}" |
395 |
answer="" |
396 |
answer="" |
396 |
read -p " Would you like to setup ${another}DNS server? [Y|n]> " answer |
397 |
read -p " Would you like to setup ${another}DNS server? [Y|n]> " answer |
397 |
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ] |
398 |
if [ "${answer}" == "Y" ] || [ "${answer}" == "" ] |
398 |
then |
399 |
then |
399 |
myip="" |
400 |
myip="" |
400 |
echo "${S_SEPARATOR}" |
401 |
echo "${S_SEPARATOR}" |
401 |
common_setup "DNS server" "{tinydns,afxrdns}" "tinydns axfrdns" |
402 |
common_setup "DNS server" "{tinydns,afxrdns}" "tinydns axfrdns" |
402 |
if [ $? == 0 ] |
403 |
if [ $? == 0 ] |
403 |
then |
404 |
then |
404 |
tinydns_setup |
405 |
tinydns_setup |
405 |
axfrdns_setup |
406 |
axfrdns_setup |
406 |
else |
407 |
else |
407 |
ewarn "Skipping tinydns and axfrdns specific setup." |
408 |
ewarn "Skipping tinydns and axfrdns specific setup." |
408 |
fi |
409 |
fi |
409 |
fi |
410 |
fi |
410 |
another="another " |
411 |
another="another " |
411 |
done |
412 |
done |
412 |
|
413 |
|
413 |
echo "${D_SEPARATOR}" |
414 |
echo "${D_SEPARATOR}" |
414 |
|
415 |
|
415 |
start_services "tinydns axfrdns dnscache" |
416 |
start_services "tinydns axfrdns dnscache" |
416 |
|
417 |
|
417 |
echo "${D_SEPARATOR}" |
418 |
echo "${D_SEPARATOR}" |
418 |
fi |
419 |
fi |
|
|
420 |
# main script }}} |
421 |
# vim: set ts=4 fenc=utf-8 foldmethod=marker: |