~ubuntu-branches/ubuntu/raring/maradns/raring

« back to all changes in this revision

Viewing changes to update/1.2.12.03/maradns-1.2.12.02-maraconf.patch

  • Committer: Bazaar Package Importer
  • Author(s): Kai Hendry
  • Date: 2010-01-24 12:17:40 UTC
  • mfrom: (1.1.13 upstream) (10.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20100124121740-a4e1fjobwaouz443
Tags: 1.4.02-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
--- maradns-1.2.12.02/tools/maraconf.sh 2006-08-14 15:02:08.000000000 -0500
2
 
+++ maradns-1.2.12.03/tools/maraconf.sh 2006-08-26 10:57:00.000000000 -0500
3
 
@@ -2,17 +2,34 @@
4
 
 
5
 
 #################################################################
6
 
 # MaraConf - The MaraDNS Configurator                                  #
7
 
-# Written by: Daniel Zilli (zilli.daniel@gmail.com) with a big  # 
8
 
-# help from Sam Trenholme.                                     #       
9
 
+# Written by: Daniel Zilli (zilli.daniel@gmail.com) with help   # 
10
 
+# from Sam Trenholme.                                          #       
11
 
 # License: BSD - http://www.maradns.org/license.html           #       
12
 
 #                                                              #
13
 
-# v1.2.00 beta04 - 04/08/2006                                  #
14
 
+# v1.2.12.03 - 17/08/2006                                      #
15
 
 ###                                                            #
16
 
 # ChangeLog                                                    #
17
 
 #                                                              #
18
 
+# v1.2.12.03                                                   #
19
 
+# - I cleaned up andimproved all the code. Especially           #
20
 
+#   all the questions.                                                 #               
21
 
+# - First public stable release.                               #
22
 
+#                                                              #
23
 
+# v1.2.00 -beta05                                              #
24
 
+# - All questions are treated now.                             #
25
 
+# - Fixed some loops.                                          #
26
 
+# - Made the trapping function.                                # 
27
 
+# - I think that "finished" the script. Now I will do some     # 
28
 
+#   final tests and waiting the community feedback.            #
29
 
+# - Made the confirm's functions better.                       #
30
 
+# - Added a function to configure your resolv.conf file in     #
31
 
+#   recursive mode...if you want, of course.                   #
32
 
+# - Maraconf now has a man-page. :-)                           #
33
 
+# - This is my last beta, so I will be careful.                        #
34
 
+#                                                              #
35
 
 # v1.2.00 -beta04                                              #       
36
 
 # - Explained what happens when you cancel the program.                #
37
 
-# - Authoritative mode is working. Is test time!               #       
38
 
+# - Authoritative mode is working. Is test time!               #
39
 
 #                                                              #
40
 
 # v1.2.00 -beta03                                              #       
41
 
 # - Made the maraconf arguments Gnu/Linux "standart".          #
42
 
@@ -56,10 +73,39 @@
43
 
 # - First beta release.                                                #
44
 
 #################################################################
45
 
 
46
 
-trap "echo \"For some reason, you canceled the program and lost your confs!\" ; exit" 2 3
47
 
+trap trapping 1 2 3 6
48
 
+
49
 
+trapping() {
50
 
+  echo 
51
 
+  echo "For some reason, you canceled the program.  You have lost your changes"
52
 
+  echo 
53
 
+  exit 1
54
 
+}
55
 
+
56
 
+confirm_resolv() {
57
 
+echo
58
 
+read -p "Would you like to configure your /etc/resolv.conf ? (y/n) " YN
59
 
+case "$YN" in 
60
 
+       y|Y)
61
 
+               if [ -e /etc/resolv.conf ] ; then
62
 
+                       BACKUP=resolv.conf.backup
63
 
+                       cp /etc/resolv.conf /etc/$BACKUP
64
 
+                       echo Current /etc/resolv.conf copied to /etc/$BACKUP
65
 
+               fi
66
 
+               echo "nameserver $IPADD" > /etc/resolv.conf
67
 
+       ;; 
68
 
+       n|N)
69
 
+               echo    
70
 
+               echo "Don't forget to put the IP $IPADD in your /etc/resolv.conf file"
71
 
+               echo
72
 
+       ;;
73
 
+       *) 
74
 
+               confirm_resolv  
75
 
+       ;; 
76
 
+esac
77
 
+}
78
 
 
79
 
 confirm_mararc() {
80
 
-# Let's decide with we copy the file to /etc or not.
81
 
 echo
82
 
 if [ -e /etc/$MARARC ] ; then
83
 
        echo -e "WARNING: /etc/$MARARC already exists; while this script"
84
 
@@ -67,46 +113,57 @@
85
 
        echo -e "will change if you select 'y'."
86
 
 fi
87
 
 echo
88
 
-echo -e "Would like to copy the created mararc file to /etc? (y/n)"
89
 
-read YN
90
 
-if [ "$YN"  = "y" ] || [ "$YN" = "Y" ]; then
91
 
-       if [ -e /etc/$MARARC ] ; then
92
 
-               BACKUP=$MARARC.$( date +%s )
93
 
-               cp /etc/$MARARC /etc/$BACKUP
94
 
-               echo Current /etc/$MARARC copied to /etc/$BACKUP
95
 
-       fi
96
 
-       cp -a $TMP/$MARARC /etc/
97
 
-else
98
 
-       echo
99
 
-       echo "Your mararc file is in $TMP"
100
 
-       echo
101
 
-fi
102
 
+read -p "Would like to copy the created mararc file to /etc? (y/n) " YN
103
 
+case "$YN" in 
104
 
+       y|Y)
105
 
+               if [ -e /etc/$MARARC ] ; then
106
 
+                       BACKUP=$MARARC.$( date +%s )
107
 
+                       cp /etc/$MARARC /etc/$BACKUP
108
 
+                       echo Current /etc/$MARARC copied to /etc/$BACKUP
109
 
+               fi
110
 
+               cp -a $TMP/$MARARC /etc/
111
 
+               confirm_resolv
112
 
+       ;; 
113
 
+       n|N)
114
 
+               echo    
115
 
+               echo "Your mararc file is in $TMP"
116
 
+               echo
117
 
+       ;;
118
 
+       *) 
119
 
+               confirm_mararc  
120
 
+       ;; 
121
 
+esac
122
 
 }
123
 
 
124
 
 confirm_db() {
125
 
-echo
126
 
 if [ -e /etc/maradns/db.$DOMAIN ] ; then
127
 
+       echo
128
 
        echo -e "WARNING: /etc/maradns/db.$DOMAIN already exists;"
129
 
-       echo -e "while this script will backup it, the contents"
130
 
+       echo -e "while this script will back it up, the contents"
131
 
        echo -e "of this file will change if you select 'y'."
132
 
 fi
133
 
 echo
134
 
-echo -e "Would like to copy the db.$DOMAIN file to /etc/maradns? (y/n)"
135
 
-read YN
136
 
-if [ "$YN"  = "y" ] || [ "$YN" = "Y" ]; then
137
 
-       if [ -e /etc/maradns/db.$DOMAIN ] ; then
138
 
-               BACKUP=db.$DOMAIN.$( date +%s )
139
 
-               cp /etc/maradns/db.$DOMAIN /etc/maradns/$BACKUP
140
 
-               echo Current /etc/maradns/db.$DOMAIN copied to /etc/maradns/$BACKUP
141
 
-       fi
142
 
-       cp -a $TMP/tmp_zone /etc/maradns/db.$DOMAIN
143
 
-else
144
 
-       cd $TMP
145
 
-       mv tmp_zone db.$DOMAIN
146
 
-       echo
147
 
-       echo "Your db.$DOMAIN file is in $TMP"
148
 
-       echo
149
 
-fi
150
 
+read -p "Would like to copy the db.$DOMAIN file to /etc/maradns? (y/n) " YN
151
 
+case "$YN" in 
152
 
+       y|Y)
153
 
+               if [ -e /etc/maradns/db.$DOMAIN ] ; then
154
 
+                       BACKUP=db.$DOMAIN.$( date +%s )
155
 
+                       cp /etc/maradns/db.$DOMAIN /etc/maradns/$BACKUP
156
 
+                       echo Current /etc/maradns/db.$DOMAIN copied to /etc/maradns/$BACKUP
157
 
+               fi
158
 
+               cp -a $TMP/tmp_zone /etc/maradns/db.$DOMAIN
159
 
+       ;; 
160
 
+       n|N)
161
 
+               cd $TMP
162
 
+               mv tmp_zone db.$DOMAIN
163
 
+               echo
164
 
+               echo "Your db.$DOMAIN file is in $TMP"
165
 
+               echo
166
 
+       ;;
167
 
+       *) 
168
 
+               confirm_db
169
 
+       ;; 
170
 
+esac
171
 
 }
172
 
 
173
 
 #### RECURSIVE QUESTIONS #################
174
 
@@ -115,60 +172,63 @@
175
 
 ###
176
 
 ##
177
 
 #
178
 
-
179
 
 rec_easy() {
180
 
-INLOOP=1
181
 
-while [ "$INLOOP" == "1" ]; do
182
 
- setterm -clear
183
 
-    echo -e "${DECOLINE}"
184
 
-    echo -e "| MaraConf ${VERSION} |"
185
 
-    echo -e "${DECOLINE}"
186
 
-    echo -e "|- RECURSIVE DNS - easy way"
187
 
-    echo -e "|"
188
 
-    echo -e "| Enter the address that this DNS server runs on:"
189
 
-    echo -e "|--type your value or press ENTER to use default (127.0.0.1):"
190
 
-    echo -n -e "=> "
191
 
-    read IPADD 
192
 
-    echo -e "| Enter the ip allowed to perform recursive queries:"
193
 
-    echo -e "|--type your value or press ENTER to use default (127.0.0.1):"
194
 
-    echo -n -e "=> "
195
 
-    read IPREC 
196
 
+setterm -clear
197
 
+echo -e "${DECOLINE}"
198
 
+echo -e "| MaraConf ${VERSION} |"
199
 
+echo -e "${DECOLINE}"
200
 
+echo -e "|-> RECURSIVE DNS -> Easy way"
201
 
+echo -e "|"
202
 
+echo -e "| Enter the address that this DNS server runs on:"
203
 
+echo -e "|--type your value or press ENTER to use default (127.0.0.1):"
204
 
+echo -n -e "=> "
205
 
+read IPADD     
206
 
+echo -e "| Enter the ip allowed to perform recursive queries:"
207
 
+echo -e "|--type your value or press ENTER to use default (127.0.0.1):"
208
 
+echo -n -e "=> "
209
 
+read IPREC     
210
 
 
211
 
 # Treating the variables.
212
 
-# Here I delete any blank space that the user typed and fill it with.
213
 
-# default value when needed. 
214
 
+# Here I delete any blank space that the user typed. 
215
 
+# If needed, default value are filled it. 
216
 
 if [ "$IPADD" != "" ]; then
217
 
-       IPADD=`echo ${IPADD// }`
218
 
+       IPADD=$( echo ${IPADD// } )
219
 
 else
220
 
        IPADD="127.0.0.1"
221
 
 fi     
222
 
 
223
 
 if [ "$IPREC" != "" ]; then
224
 
-       IPREC=`echo ${IPREC// }`
225
 
+       IPREC=$( echo ${IPREC// } )
226
 
 else
227
 
        IPREC="127.0.0.1"
228
 
 fi     
229
 
 
230
 
-# confirme the values entered.
231
 
-       echo
232
 
-       echo -e "Please confirm the values entered:"
233
 
-       echo -e "Q: Enter the address that this DNS server runs on:"
234
 
-       echo -e "A: $IPADD"
235
 
-       echo
236
 
-       echo -e "Q: Enter the ip allowed to perform recursive queries:"
237
 
-       echo -e "A: $IPREC"
238
 
-       echo
239
 
-       echo -e "Is this the information that you entered? (y/n)"
240
 
-       read YN
241
 
-       if [ "$YN"  = "y" ] || ["$YN" = "Y" ]
242
 
-           then
243
 
-               INLOOP=0
244
 
-           else
245
 
-               INLOOP=1
246
 
-       fi
247
 
-
248
 
+# Confirm the values entered.
249
 
+# The loop is to ensure that the user will only choose y or n.
250
 
+while [ -z "$opt" ]; do
251
 
+echo
252
 
+echo -e "Please confirm the values entered:"
253
 
+echo -e "Q: Enter the address that this DNS server runs on:"
254
 
+echo -e "A: $IPADD"
255
 
+echo
256
 
+echo -e "Q: Enter the ip allowed to perform recursive queries:"
257
 
+echo -e "A: $IPREC"
258
 
+echo
259
 
+read -p "Is this the information that you entered correct? (y/n) " YN
260
 
+# we must type something useful.
261
 
+  case "$YN" in 
262
 
+       y|Y)    
263
 
+               opt=ok
264
 
+       ;; 
265
 
+       n|N)    
266
 
+               rec_easy
267
 
+       ;; 
268
 
+       *) echo "--> Please type y or n to answer." 
269
 
+       ;; 
270
 
+  esac
271
 
 done
272
 
-       
273
 
+unset opt
274
 
+
275
 
 # Create the mararc file.
276
 
 cat << EOF > $TMP/$MARARC
277
 
 # Base settings.
278
 
@@ -184,72 +244,67 @@
279
 
 
280
 
 # Calling a function.
281
 
 confirm_mararc
282
 
-
283
 
 }
284
 
 
285
 
 rec_hard() {
286
 
-INLOOP=1
287
 
-while [ "$INLOOP" == "1" ] ; do
288
 
-    setterm -clear
289
 
-    echo -e "${DECOLINE}"
290
 
-    echo -e "| MaraConf ${VERSION} |"
291
 
-    echo -e "${DECOLINE}"
292
 
-    echo -e "|- RECURSIVE DNS - hard way"
293
 
-    echo -e "|"
294
 
-    echo -e "| Enter with the address that this DNS server runs on:"
295
 
-    echo -e "|--type your value or press ENTER to use default (127.0.0.1):"
296
 
-    echo -n -e "=> "
297
 
-    read IPADD 
298
 
-    echo -e "| Enter with the ip allowed to perform recursive queries:"
299
 
-    echo -e "|--type your value or press ENTER to use default (127.0.0.1):"
300
 
-    echo -n -e "=> "
301
 
-    read IPREC 
302
 
-    echo -e "| What is the directory with all of the zone files?"
303
 
-    echo -e "|--type your value or press ENTER to use default (/etc/maradns):"
304
 
-    echo -n -e "=> "
305
 
-    read CHROOT        
306
 
-    echo -e "| What is the numeric UID MaraDNS will run as?"
307
 
-    echo -e "|--type your value or press ENTER to use default (99):"
308
 
-    echo -n -e "=> "
309
 
-    read NUID  
310
 
-    echo -e "| What is the numeric GID MaraDNS will run as?"
311
 
-    echo -e "|--type your value or press ENTER to use default (99):"
312
 
-    echo -n -e "=> "
313
 
-    read NGID  
314
 
-    echo -e "| Which is the maximum number of threads that MaraDNS is allowed to run?"
315
 
-    echo -e "|--type your value or press ENTER to use default (64):"
316
 
-    echo -n -e "=> "
317
 
-    read MNT   
318
 
-    echo -e "| Do you want make MaraDNS obscure (for security reason)?"
319
 
-    echo -e " 0) no (default)"
320
 
-    echo -e " 1) yes"
321
 
-    echo -n -e "=> "
322
 
-    read NOFING        
323
 
-    echo -e "| Choose the level of the messages we log to stdout (0,1,2,3)?"
324
 
-    echo -e " 0) No messages except for fatal parsing errors and the legal disclaimer"
325
 
-    echo -e " 1) Only startup messages logged (default)"
326
 
-    echo -e " 2) Error queries logged"
327
 
-    echo -e " 3) All queries logged (but not very verbosely right now)"
328
 
-    echo -n -e "=> "
329
 
-    read NLOG  
330
 
-    echo -e "| Do you want to increase the time to process queries on some slow networks?"
331
 
-    echo -e "|--type your value or press ENTER to use default (2):"
332
 
-    echo -n -e "=> "
333
 
-    read TIMES
334
 
-    echo -e "| Do you want use other recursive DNS servers?"
335
 
-    echo -e " 0) no (default)"
336
 
-    echo -e " 1) yes"
337
 
-    echo -n -e "=> "  
338
 
-    read OTREC
339
 
-    if [ "$OTREC" == "1" ]; then
340
 
-       echo -e "| Enter the IP address for the other recursive DNS server:"
341
 
-       echo -n -e "=> "
342
 
-       read OTRECIP
343
 
-    fi
344
 
+setterm -clear
345
 
+echo -e "${DECOLINE}"
346
 
+echo -e "| MaraConf ${VERSION} |"
347
 
+echo -e "${DECOLINE}"
348
 
+echo -e "|-> RECURSIVE DNS -> Hard way"
349
 
+echo -e "|"
350
 
+echo -e "| Enter with the address that this DNS server runs on:"
351
 
+echo -e "|--type your value or press ENTER to use default (127.0.0.1):"
352
 
+echo -n -e "=> "
353
 
+read IPADD     
354
 
+echo -e "| Enter with the ip allowed to perform recursive queries:"
355
 
+echo -e "|--type your value or press ENTER to use default (127.0.0.1):"
356
 
+echo -n -e "=> "
357
 
+read IPREC     
358
 
+echo -e "| What is the directory with all of the zone files?"
359
 
+echo -e "|--type your value or press ENTER to use default (/etc/maradns):"
360
 
+echo -n -e "=> "
361
 
+read CHROOT    
362
 
+echo -e "| What is the numeric UID MaraDNS will run as?"
363
 
+echo -e "|--type your value or press ENTER to use default (99):"
364
 
+echo -n -e "=> "
365
 
+read NUID      
366
 
+echo -e "| What is the numeric GID MaraDNS will run as?"
367
 
+echo -e "|--type your value or press ENTER to use default (99):"
368
 
+echo -n -e "=> "
369
 
+read NGID      
370
 
+echo -e "| Which is the maximum number of threads that MaraDNS is allowed to run?"
371
 
+echo -e "|--type your value or press ENTER to use default (64):"
372
 
+echo -n -e "=> "
373
 
+read MNT       
374
 
+echo -e "| Do you want make MaraDNS obscure (for security reason)?"
375
 
+echo -e " 0) no (default)"
376
 
+echo -e " 1) yes"
377
 
+echo -n -e "=> "
378
 
+read NOFING    
379
 
+echo -e "| Choose the level of the messages we log to stdout (0,1,2,3)?"
380
 
+echo -e " 0) No messages except for fatal parsing errors and the legal disclaimer"
381
 
+echo -e " 1) Only start-up messages logged (default)"
382
 
+echo -e " 2) Error queries logged"
383
 
+echo -e " 3) All queries logged (but not very verbosely right now)"
384
 
+echo -n -e "=> "
385
 
+read NLOG      
386
 
+echo -e "| Do you want to increase the time to process queries on some slow networks?"
387
 
+echo -e "|--type your value or press ENTER to use default (2):"
388
 
+echo -n -e "=> "
389
 
+read TIMES
390
 
+echo -e "| Do you want use other recursive DNS servers?"
391
 
+echo -e " 0) no (default)"
392
 
+echo -e " 1) yes"
393
 
+echo -n -e "=> "  
394
 
+read OTREC
395
 
+if [ "$OTREC" == "1" ]; then
396
 
+ echo -e "| Enter the IP address for the other recursive DNS server:"
397
 
+ echo -n -e "=> "
398
 
+ read OTRECIP
399
 
+fi
400
 
     
401
 
 # Treating the variables.
402
 
-# Here I delete any blank space that the user typed and fill it with.
403
 
-# default value when needed. 
404
 
 if [ "$IPADD" != "" ]; then
405
 
        IPADD=`echo ${IPADD// }`
406
 
 else
407
 
@@ -307,50 +362,57 @@
408
 
 OTRECIP=`echo ${OTRECIP// }` 
409
 
 
410
 
 # Confirm the values entered
411
 
-       echo
412
 
-       echo -e "Please confirm the values entered:"
413
 
-       echo -e "Q: Enter the address that this DNS server runs on:"
414
 
-       echo -e "A: $IPADD"
415
 
-       echo
416
 
-       echo -e "Q: Enter the ip allowed to perform recursive queries:"
417
 
-       echo -e "A: $IPREC"
418
 
-       echo
419
 
-       echo -e "Q: What is the directory with all of the zone files?"
420
 
-       echo -e "A: $CHROOT"
421
 
-       echo
422
 
-       echo -e "Q: What is the numeric UID MaraDNS will run as?"
423
 
-       echo -e "A: $NUID"
424
 
-       echo
425
 
-       echo -e "Q: What is the numeric GID MaraDNS will run as?:"
426
 
-       echo -e "A: $NGID"
427
 
-       echo
428
 
-       echo -e "Q: Which is the maximum number of threads that MaraDNS is allowed to run?"
429
 
-       echo -e "A: $MNT"
430
 
-       echo
431
 
-       echo -e "Q: Do you want make MaraDNS obscure (for security reason)?"
432
 
-       echo -e "A: $NOFING"
433
 
-       echo
434
 
-       echo -e "Q: Choose the level of the messages we log to stdout (0,1,2,3)?"
435
 
-       echo -e "A: $NLOG"
436
 
-       echo
437
 
-       echo -e "Q: Do you want to increase the time to process queries on some slow networks?"
438
 
-       echo -e "A: $TIMES"
439
 
-       echo
440
 
-       echo -e "Q: Do you want to use other recursive DNS servers?"
441
 
-       if [ "$OTRECIP" != "" ]; then
442
 
+while [ -z "$opt" ]; do
443
 
+ echo
444
 
+ echo -e "Please confirm the values entered:"
445
 
+ echo -e "Q: Enter the address that this DNS server runs on:"
446
 
+ echo -e "A: $IPADD"
447
 
+ echo
448
 
+ echo -e "Q: Enter the ip allowed to perform recursive queries:"
449
 
+ echo -e "A: $IPREC"
450
 
+ echo
451
 
+ echo -e "Q: What is the directory with all of the zone files?"
452
 
+ echo -e "A: $CHROOT"
453
 
+ echo
454
 
+ echo -e "Q: What is the numeric UID MaraDNS will run as?"
455
 
+ echo -e "A: $NUID"
456
 
+ echo
457
 
+ echo -e "Q: What is the numeric GID MaraDNS will run as?:"
458
 
+ echo -e "A: $NGID"
459
 
+ echo
460
 
+ echo -e "Q: Which is the maximum number of threads that MaraDNS is allowed to run?"
461
 
+ echo -e "A: $MNT"
462
 
+ echo
463
 
+ echo -e "Q: Do you want make MaraDNS harder to detect (for security reason)?"
464
 
+ echo -e "A: $NOFING"
465
 
+ echo
466
 
+ echo -e "Q: Choose the level of the messages we log to stdout (0,1,2,3)?"
467
 
+ echo -e "A: $NLOG"
468
 
+ echo
469
 
+ echo -e "Q: Do you want to increase the time to process queries on some slow networks?"
470
 
+ echo -e "A: $TIMES"
471
 
+ echo
472
 
+ echo -e "Q: Do you want to use other recursive DNS servers?"
473
 
+ if [ "$OTRECIP" != "" ]; then
474
 
        echo -e "A: $OTRECIP"
475
 
-       else
476
 
+ else
477
 
        echo -e "A: no"
478
 
-       fi
479
 
-       echo
480
 
-       echo -e -n "Is this the information that you entered correct? (y/n) "
481
 
-       read YN
482
 
-       if [ "$YN"  = "y" ] || ["$YN" = "Y" ]; then
483
 
-               INLOOP=0
484
 
-       else
485
 
-               INLOOP=1
486
 
-       fi
487
 
+ fi
488
 
+ echo
489
 
+ read -p "Is this the information that you entered correct? (y/n) " YN
490
 
+ case "$YN" in 
491
 
+       y|Y)    
492
 
+               opt=ok
493
 
+       ;; 
494
 
+       n|N)     
495
 
+               rec_hard                
496
 
+       ;; 
497
 
+       *) echo "--> Please type y or n to answer." 
498
 
+       ;; 
499
 
+ esac
500
 
+
501
 
 done
502
 
+unset opt
503
 
 
504
 
 # create the mararc
505
 
 cat << EOF > $TMP/$MARARC
506
 
@@ -385,7 +447,7 @@
507
 
 
508
 
 if [ "$OTRECIP" != "" ]; then
509
 
 cat << EOF >> $TMP/$MARARC
510
 
-# Using other recursives servers
511
 
+# Using others recursive servers.
512
 
 upstream_servers = {}
513
 
 upstream_servers["."] = "$OTRECIP"
514
 
 
515
 
@@ -394,51 +456,41 @@
516
 
 
517
 
 # Calling a function.
518
 
 confirm_mararc
519
 
-
520
 
 }
521
 
 
522
 
 rec_screen() {
523
 
-RS_INLOOP=1
524
 
-while [ "$RS_INLOOP" == "1" ] ; do
525
 
-    setterm -clear
526
 
+setterm -clear
527
 
     echo -e "${DECOLINE}"
528
 
     echo -e "| MaraConf ${VERSION} |"
529
 
     echo -e "${DECOLINE}"
530
 
-    echo -e "|- RECURSIVE DNS"
531
 
+    echo -e "|-> RECURSIVE DNS"
532
 
+    echo -e "|"
533
 
+    echo -e "|- How do you want to setup recursive dns?"
534
 
     echo -e "|"
535
 
-    echo -e "|- (How do you want to setup recursive dns?)"
536
 
     echo -e "| 1) The easy way (using a wizard)"
537
 
     echo -e "| 2) The hard way (for experienced users)"
538
 
     echo -e "| 0) Back"
539
 
     echo -e "|"
540
 
     echo -n -e "Choose a option [0-2] => "
541
 
-    read action
542
 
+    read ACTION
543
 
     echo -e ""
544
 
-
545
 
-case $action in
546
 
+case $ACTION in
547
 
        1)      rec_easy
548
 
-               RS_INLOOP=0
549
 
-               ST_INLOOP=0
550
 
        ;;
551
 
        
552
 
        2)      rec_hard
553
 
-               RS_INLOOP=0
554
 
-               ST_INLOOP=0
555
 
        ;;
556
 
        
557
 
        0)
558
 
-               RS_INLOOP=0
559
 
-               ST_INLOOP=1
560
 
+               start
561
 
        ;;
562
 
        *)      echo "Please type in a number between 0 - 2." 1>&2
563
 
                sleep 2s
564
 
-               start
565
 
+               rec_screen
566
 
        ;;
567
 
-    esac       
568
 
-done
569
 
+esac   
570
 
 }
571
 
 
572
 
-
573
 
 #### AUTHORITATIVE QUESTIONS #################
574
 
 ####
575
 
 ####
576
 
@@ -446,20 +498,230 @@
577
 
 ##
578
 
 #
579
 
 
580
 
-aut_mode() {
581
 
+autho_a() {
582
 
+#
583
 
+# A record.
584
 
+read -p "| Do you want to setup an A record? (y/n) " YN
585
 
+case "$YN" in 
586
 
+       y|Y)    
587
 
+               echo 
588
 
+               echo -e "| Enter the IP address for the A record"
589
 
+               echo -n -e "=> "
590
 
+               read IPA
591
 
+               IPA=`echo ${IPA// }`
592
 
+               
593
 
+               # Save all the records here.
594
 
+               echo "$DOMAIN. $IPA" >> $TMP/tmp_zone
595
 
+               
596
 
+               # Ask again.
597
 
+               while [ -z "$opt" ] ; do
598
 
+               read -p "Do you want to setup an other A record? (y/n) " YN
599
 
+                       case "$YN" in
600
 
+                               y|Y) 
601
 
+                               # Here we go again.
602
 
+                               echo 
603
 
+                               echo -e "| Enter the IP address for the A record"
604
 
+                               echo -n -e "=> "
605
 
+                               read IPA        
606
 
+                               IPA=`echo ${IPA// }`
607
 
+               
608
 
+                               # Save all the records here.
609
 
+                               echo "$DOMAIN. $IPA" >> $TMP/tmp_zone
610
 
+                               ;;      
611
 
+                               n|N) break ; opt=ok ;;
612
 
+                               *) echo "--> Please type y or n to answer." ;;
613
 
+                       esac
614
 
+               done
615
 
+               unset opt 
616
 
+       ;; 
617
 
+       n|N)
618
 
+       return
619
 
+       # Nothing happens here.
620
 
+       ;;
621
 
+       *)      
622
 
+               echo "--> Please type y or n to answer."
623
 
+               autho_a
624
 
+       ;; 
625
 
+esac
626
 
+}
627
 
+
628
 
+autho_ns() {
629
 
+#
630
 
+# NS record.
631
 
+read -p "| Do you want to setup a NS record? (y/n) " YN
632
 
+case "$YN" in 
633
 
+       y|Y)    
634
 
+               echo 
635
 
+               echo -e "| Enter the IP address for the NS record"
636
 
+               read IPNS
637
 
+               IPNS=`echo ${IPNS// }`
638
 
+               
639
 
+               echo -e "| Enter with the hostname used with the NS record."
640
 
+               echo -n -e "=> "
641
 
+               read NS_HOST    
642
 
+               NS_HOST=`echo ${NS_HOST// }`
643
 
+               
644
 
+               # Save all the records here.
645
 
+               echo "$DOMAIN. NS $NS_HOST.$DOMAIN." >> $TMP/tmp_zone
646
 
+               echo "$NS_HOST.$DOMAIN. $IPNS" >> $TMP/tmp_zone
647
 
+               
648
 
+               # Ask again.
649
 
+               while [ -z "$opt" ] ; do
650
 
+               read -p echo -n "Do you want to setup an other NS record? (y/n) " YN
651
 
+                       case "$YN" in
652
 
+                               y|Y) 
653
 
+                               # Here we go again.
654
 
+                               echo -e "| Enter the IP address for the NS record"
655
 
+                               read IPNS
656
 
+                               IPNS=`echo ${IPNS// }`
657
 
+               
658
 
+                               echo -e "| Enter with the hostname used with the NS record."
659
 
+                               echo -n -e "=> "
660
 
+                               read NS_HOST    
661
 
+                               NS_HOST=`echo ${NS_HOST// }`
662
 
+               
663
 
+                               # Save all the records here.
664
 
+                               echo "$DOMAIN. NS $NS_HOST.$DOMAIN." >> $TMP/tmp_zone
665
 
+                               echo "$NS_HOST.$DOMAIN. $IPNS" >> $TMP/tmp_zone
666
 
+                               ;;      
667
 
+                               n|N) break ; opt=ok ;;
668
 
+                               *) echo "--> Please type y or n to answer." ;;
669
 
+                       esac
670
 
+               done
671
 
+               unset opt 
672
 
+       ;; 
673
 
+       n|N)
674
 
+       return
675
 
+       # Nothing happens here.
676
 
+       ;;
677
 
+       *)      
678
 
+               echo "--> Please type y or n to answer."
679
 
+               autho_ns
680
 
+       ;; 
681
 
+esac
682
 
+}
683
 
+
684
 
+autho_mx() {
685
 
+#
686
 
+# MX record.
687
 
+read -p "| Do you want to setup a MX record? (y/n) " YN
688
 
+case "$YN" in 
689
 
+       y|Y)    
690
 
+               echo 
691
 
+               echo -e "| Enter the IP address for the MX record"
692
 
+               echo -n -e "=> "
693
 
+               read IPMX
694
 
+               IPMX=`echo ${IPMX// }`  
695
 
+               echo -e "| Enter with the hostname used with the MX record."
696
 
+               echo -n -e "=> "
697
 
+               read MX_HOST    
698
 
+               MX_HOST=`echo ${MX_HOST// }`
699
 
+       
700
 
+               # Save all the records here.
701
 
+               echo "$DOMAIN.  MX  10  $MX_HOST.$DOMAIN." >> $TMP/tmp_zone
702
 
+               echo "$MX_HOST.$DOMAIN. $IPNS" >> $TMP/tmp_zone
703
 
+               
704
 
+               # Ask again.
705
 
+               while [ -z "$opt" ] ; do
706
 
+               read -p echo -n "Do you want to setup an other MX record? (y/n) " YN
707
 
+                       case "$YN" in
708
 
+                               y|Y) 
709
 
+                               # Here we go again.
710
 
+                               echo -e "| Enter the IP address for the MX record"
711
 
+                               echo -n -e "=> "
712
 
+                               read IPMX
713
 
+                               IPMX=`echo ${IPMX// }`  
714
 
+                               echo -e "| Enter with the hostname used with the MX record."
715
 
+                               echo -n -e "=> "
716
 
+                               read MX_HOST    
717
 
+                               MX_HOST=`echo ${MX_HOST// }`
718
 
+       
719
 
+                               # Save all the records here.
720
 
+                               echo "$DOMAIN.  MX  10  $MX_HOST.$DOMAIN." >> $TMP/tmp_zone
721
 
+                               echo "$MX_HOST.$DOMAIN. $IPNS" >> $TMP/tmp_zone
722
 
+                               ;;      
723
 
+                               n|N) break ; opt=ok ;;
724
 
+                               *) echo "--> Please type y or n to answer." ;;
725
 
+                       esac
726
 
+               done
727
 
+               unset opt 
728
 
+       ;; 
729
 
+       n|N)
730
 
+       return
731
 
+       # Nothing happens here.
732
 
+       ;;
733
 
+       *)      
734
 
+               echo "--> Please type y or n to answer."
735
 
+               autho_mx
736
 
+       ;; 
737
 
+esac
738
 
+}
739
 
+
740
 
+autho_sn() {
741
 
 #
742
 
+# Single Names record.
743
 
+read -p "| Do you want to setup a single name to ip? (y/n) " YN
744
 
+case "$YN" in 
745
 
+       y|Y)    
746
 
+               echo 
747
 
+               echo -e "| Enter with the hostname for the single name."
748
 
+               echo -n -e "=> "
749
 
+               read SN_HOST    
750
 
+               SN_HOST=`echo ${SN_HOST// }`
751
 
+               echo -e "| Enter the IP address for the single name."
752
 
+               echo -n -e "=> "
753
 
+               read IPSN               
754
 
+               IPSN=`echo ${IPSN// }`
755
 
+
756
 
+               # Save all the records here.
757
 
+               echo "$SN_HOST.$DOMAIN. $IPSN" >> $TMP/tmp_zone
758
 
+               
759
 
+               # Ask again.
760
 
+               while [ -z "$opt" ] ; do
761
 
+               read -p "Do you want to setup an other single name? (y/n) " YN
762
 
+                       case "$YN" in
763
 
+                               y|Y) 
764
 
+                               # Here we go again.
765
 
+                               echo -e "| Enter with the hostname for the single name."
766
 
+                               echo -n -e "=> "
767
 
+                               read SN_HOST    
768
 
+                               SN_HOST=`echo ${SN_HOST// }`
769
 
+                               echo -e "| Enter the IP address for the single name."
770
 
+                               echo -n -e "=> "
771
 
+                               read IPSN               
772
 
+                               IPSN=`echo ${IPSN// }`
773
 
+
774
 
+                               # Save all the records here.
775
 
+                               echo "$SN_HOST.$DOMAIN. $IPSN" >> $TMP/tmp_zone
776
 
+                               ;;      
777
 
+                               n|N) break ; opt=ok ;;
778
 
+                               *) echo "--> Please type y or n to answer." ;;
779
 
+                       esac
780
 
+               done
781
 
+               unset opt 
782
 
+       ;; 
783
 
+       n|N)
784
 
+       return
785
 
+       # Nothing happens here.
786
 
+       ;;
787
 
+       *)      
788
 
+               echo "--> Please type y or n to answer."
789
 
+               autho_sn
790
 
+       ;; 
791
 
+esac
792
 
+}
793
 
+
794
 
 # Configuring mararc file.
795
 
 #
796
 
-INLOOP=1
797
 
-while [ "$INLOOP" == "1" ] ; do
798
 
+aut_mode() {
799
 
     setterm -clear
800
 
     echo -e "${DECOLINE}"
801
 
     echo -e "| MaraConf ${VERSION} |"
802
 
     echo -e "${DECOLINE}"
803
 
-    echo -e "|- AUTHORITATIVE DNS - configuring mararc:"
804
 
+    echo -e "|-> AUTHORITATIVE DNS -> Configuring mararc:"
805
 
     echo -e "|"
806
 
-    echo -e "| Enter the address that this DNS server runs on."
807
 
-    echo -e "|--you must type a value, there is no default here:"
808
 
+    echo -e "| Enter the IP(s) address(es) that this DNS server runs on."
809
 
+    echo -e "|--you must type the values separate by comma."
810
 
     echo -n -e "=> "
811
 
     read IPADD 
812
 
     echo -e "| Enter the domain."
813
 
@@ -473,24 +735,27 @@
814
 
     IPADD=`echo ${IPADD// }`
815
 
     DOMAIN=`echo ${DOMAIN// }`
816
 
 
817
 
-    # Confirme the values entered
818
 
-       echo
819
 
-       echo -e "Please confirm the values entered:"
820
 
-       echo -e "Q: Enter the address that this DNS server runs on:"
821
 
-       echo -e "A: $IPADD"
822
 
-       echo
823
 
-       echo -e "Q: Enter the domain:"
824
 
-       echo -e "A: $DOMAIN"
825
 
-       echo
826
 
-       echo -e -n "Is this the information that you entered? (y/n) "
827
 
-       read YN
828
 
-       if [ "$YN"  = "y" ] || ["$YN" = "Y" ]
829
 
-           then
830
 
-               INLOOP=0
831
 
-           else
832
 
-               INLOOP=1
833
 
-       fi
834
 
+    # Confirm the values entered.
835
 
+while [ -z "$opt" ] ; do
836
 
+    echo
837
 
+    echo -e "Please confirm the values entered:"
838
 
+    echo -e "Q: Enter the address that this DNS server runs on:"
839
 
+    echo -e "A: $IPADD"
840
 
+    echo
841
 
+    echo -e "Q: Enter the domain:"
842
 
+    echo -e "A: $DOMAIN"
843
 
+    echo
844
 
+    read -p "Is this the information that you entered correct? (y/n) " YN
845
 
+    case "$YN" in 
846
 
+       y|Y) opt=ok
847
 
+       ;; 
848
 
+       n|N) aut_mode
849
 
+       ;; 
850
 
+       *) echo "--> Please type y or n to answer." 
851
 
+       ;; 
852
 
+    esac
853
 
 done
854
 
+unset opt
855
 
 
856
 
 # create the mararc
857
 
 cat << EOF > $TMP/$MARARC
858
 
@@ -512,144 +777,58 @@
859
 
 #
860
 
 # Configuring  zone file.
861
 
 #
862
 
-
863
 
 INLOOP=1
864
 
 while [ "$INLOOP" == "1" ] ; do
865
 
  setterm -clear
866
 
     echo -e "${DECOLINE}"
867
 
     echo -e "| MaraConf ${VERSION} |"
868
 
     echo -e "${DECOLINE}"
869
 
-    echo -e "|- AUTHORITATIVE DNS - configuring the zone file:"
870
 
+    echo -e "|-> AUTHORITATIVE DNS -> Configuring the zone file:"
871
 
     echo -e "|"
872
 
 
873
 
 # A record.
874
 
-    ALOOP=1    
875
 
-       echo -n "| Do you want to setup an A record? (y/n) "
876
 
-       read YN
877
 
-       while [ "$ALOOP" == "1" ] && [ "$YN"  = "y" ] || [ "$YN" = "Y" ] ; do           
878
 
-               echo -e "| Enter the IP address for the A record"
879
 
-               echo -n -e "=> "
880
 
-               read IPA
881
 
-               IPA=`echo ${IPA// }`
882
 
-#              echo -e "| Enter with the hostname used with the A record."
883
 
-#              echo -n -e "=> "
884
 
-#              read A_HOST
885
 
-
886
 
-               # Save all the records here.
887
 
-               echo "$DOMAIN.  $IPA" >> $TMP/tmp_zone
888
 
-       
889
 
-               echo -n "Do you want to setup an other A record? (y/n) "
890
 
-               read YN
891
 
-               if [ "$YN"  = "n" ] || [ "$YN" = "N" ]; then 
892
 
-                       ALOOP=0
893
 
-               fi
894
 
-       done
895
 
+autho_a
896
 
 
897
 
 # NS record.
898
 
-NSLOOP=1    
899
 
-       echo
900
 
-       echo -n "| Do you want to setup a NS record? (y/n) "
901
 
-       read YN
902
 
-       while [ "$NSLOOP" == "1" ] && [ "$YN"  = "y" ] || [ "$YN" = "Y" ] ; do  
903
 
-               echo -e "| Enter the IP address for the NS record"
904
 
-               echo -n -e "=> "
905
 
-               read IPNS
906
 
-               IPNS=`echo ${IPNS// }`
907
 
-               echo -e "| Enter with the hostname used with the NS record."
908
 
-               echo -n -e "=> "
909
 
-               read NS_HOST    
910
 
-               NS_HOST=`echo ${NS_HOST// }`
911
 
-               # Save all the records here.
912
 
-               echo "$DOMAIN. NS $NS_HOST.$DOMAIN." >> $TMP/tmp_zone
913
 
-               echo "$NS_HOST.$DOMAIN. $IPNS" >> $TMP/tmp_zone
914
 
-       
915
 
-               echo -n "Do you want to setup an other NS record? (y/n) "
916
 
-               read YN
917
 
-               if [ "$YN"  = "n" ] || [ "$YN" = "N" ]; then 
918
 
-                       NSLOOP=0
919
 
-               fi
920
 
-       done
921
 
-
922
 
+autho_ns
923
 
 
924
 
 # MX record.
925
 
-MXLOOP=1    
926
 
-       echo
927
 
-       echo -n "| Do you want to setup a MX record? (y/n) "
928
 
-       read YN
929
 
-       while [ "$MXLOOP" == "1" ] && [ "$YN"  = "y" ] || [ "$YN" = "Y" ] ; do  
930
 
-               echo -e "| Enter the IP address for the MX record"
931
 
-               echo -n -e "=> "
932
 
-               read IPMX
933
 
-               IPMX=`echo ${IPMX// }`  
934
 
-               echo -e "| Enter with the hostname used with the MX record."
935
 
-               echo -n -e "=> "
936
 
-               read MX_HOST    
937
 
-               MX_HOST=`echo ${MX_HOST// }`
938
 
-       
939
 
-               # Save all the records here.
940
 
-               echo "$DOMAIN.  MX  10  $MX_HOST.$DOMAIN." >> $TMP/tmp_zone
941
 
-               echo "$MX_HOST.$DOMAIN. $IPNS" >> $TMP/tmp_zone
942
 
-       
943
 
-               echo -n "Do you want to setup an other MX record? (y/n) "
944
 
-               read YN
945
 
-               if [ "$YN"  = "n" ] || [ "$YN" = "N" ]; then 
946
 
-                       MXLOOP=0
947
 
-               fi
948
 
-       done
949
 
+autho_mx
950
 
 
951
 
 # Single names.
952
 
-SNLOOP=1    
953
 
-       echo
954
 
-       echo -n "| Do you want to setup a single name to ip? (y/n) "
955
 
-       read YN
956
 
-       while [ "$SNLOOP" == "1" ] && [ "$YN"  = "y" ] || [ "$YN" = "Y" ] ; do  
957
 
-               echo -e "| Enter with the hostname for the single name."
958
 
-               echo -n -e "=> "
959
 
-               read SN_HOST    
960
 
-               SN_HOST=`echo ${SN_HOST// }`
961
 
-               echo -e "| Enter the IP address for the single name."
962
 
-               echo -n -e "=> "
963
 
-               read IPSN               
964
 
-               IPSN=`echo ${IPSN// }`
965
 
-
966
 
-               # Save all the records here.
967
 
-               echo "$SN_HOST.$DOMAIN. $IPSN" >> $TMP/tmp_zone
968
 
-       
969
 
-               echo -n "Do you want to setup an other single name? (y/n) "
970
 
-               read YN
971
 
-               if [ "$YN"  = "n" ] || [ "$YN" = "N" ]; then 
972
 
-                       SNLOOP=0
973
 
-               fi
974
 
-       done
975
 
-
976
 
+autho_sn
977
 
 
978
 
-# confirme the values entered
979
 
+while [ -z "$opt" ]; do
980
 
        echo
981
 
        echo -e "Please confirm the values entered:"
982
 
        if [ -f $TMP/tmp_zone ]; then
983
 
                cat $TMP/tmp_zone
984
 
        else
985
 
-               echo "no zone file created"
986
 
+               echo "No zone file created, so we exit now."
987
 
+               exit 0
988
 
        fi
989
 
-       
990
 
        echo
991
 
-       echo -e -n "Is this the information that you entered? (y/n) "
992
 
-       read YN
993
 
-       if [ "$YN"  = "y" ] || [ "$YN" = "Y" ]; then
994
 
-           
995
 
-               INLOOP=0
996
 
-           else
997
 
-               INLOOP=1
998
 
-       fi
999
 
+       read -p "Is this the information that you entered correct? (y/n) " YN
1000
 
+       case "$YN" in 
1001
 
+               y|Y)    
1002
 
+                       opt=ok 
1003
 
+                       INLOOP=0
1004
 
+               ;;
1005
 
+               n|N)
1006
 
+                       opt=ok
1007
 
+               ;;
1008
 
+               *)
1009
 
+                       echo 
1010
 
+                       echo "--> Please type y or n to answer."
1011
 
+               ;;
1012
 
+       esac
1013
 
+done
1014
 
 done
1015
 
 
1016
 
 confirm_db
1017
 
-       
1018
 
 }
1019
 
 
1020
 
 start() {
1021
 
-ST_INLOOP=1
1022
 
-while [ "$ST_INLOOP" == "1" ] ; do
1023
 
     setterm -clear
1024
 
     echo -e "${DECOLINE}"
1025
 
     echo -e "| MaraConf ${VERSION} |"
1026
 
@@ -662,10 +841,10 @@
1027
 
     echo -e "| 0) Exit"
1028
 
     echo -e "|"
1029
 
     echo -n -e "Choose a option [0-2] => "
1030
 
-    read action
1031
 
+    read ACTION
1032
 
     echo -e ""
1033
 
 
1034
 
-case $action in
1035
 
+   case $ACTION in
1036
 
        1)      rec_screen
1037
 
        ;;
1038
 
        
1039
 
@@ -678,7 +857,6 @@
1040
 
                sleep 2s
1041
 
        ;;
1042
 
     esac       
1043
 
-done
1044
 
 }
1045
 
 
1046
 
 ##################
1047
 
@@ -709,9 +887,9 @@
1048
 
 
1049
 
 # Menu.
1050
 
 DECOLINE="+--------------------------------+"
1051
 
-VERSION="v1.2.00 -beta04      "
1052
 
+VERSION="v1.2.12.03           "
1053
 
 
1054
 
-case $1 in
1055
 
+case "$1" in
1056
 
        -s|--start)
1057
 
                # Calling the function.
1058
 
                clear
1059
 
@@ -719,13 +897,14 @@
1060
 
        ;;      
1061
 
        -h|--help)
1062
 
                # Msg screen.
1063
 
+               clear
1064
 
                echo "####################################" 
1065
 
                echo "# MaraDNS configurator               #"
1066
 
                echo "####################################" 
1067
 
                echo
1068
 
-               echo "This program is designed to help you setup a recursive and autothirative" 
1069
 
+               echo "This program is designed to help you setup a recursive and authoritative" 
1070
 
                echo "DNS servers using MaraDNS.  What this script will do is create a mararc" 
1071
 
-               echo "file and the respectives zone files for a domain, to be used for the"
1072
 
+               echo "file and the respective zone files for a domain, to be used for the"
1073
 
                echo "authoritative server.  It should work on any Unix-like system that has" 
1074
 
                echo "bash in /bin."
1075
 
                echo 
1076
 
@@ -741,14 +920,13 @@
1077
 
        ;;
1078
 
        *)
1079
 
                echo 
1080
 
-               echo -e "Usage: maraconf OPTION"
1081
 
+               echo -e "Usage: maraconf OPTIONS"
1082
 
                echo
1083
 
                echo -e "OPTIONS:"
1084
 
-               echo -e "-s, --start    initialize the configuration."
1085
 
+               echo -e "-s, --start    initialize the configurator."
1086
 
                echo -e "-h, --help     show a brief explanation."
1087
 
                echo
1088
 
                echo "MaraConf $VERSION"
1089
 
                echo
1090
 
        ;;
1091
 
 esac
1092
 
-