]>
gitweb.michael.orlitzky.com - mjo-overlay.git/blob - djbdns/files/tinydns-setup
4 # source functions.sh for einfo, eerror and ewarn
5 .
/etc
/init.d
/functions.sh
12 echo ">>> More information on this package can be found at"
13 echo ">>> http://cr.yp.to/djbdns/tinydns.html"
15 echo "If you have previously setup tinydns, those directories will"
16 echo "not be overwritten. To redo setup, delete your"
17 echo "tinydns dir tree first."
19 echo '(press enter to begin setup, or press control-C to abort)'
24 einfo
"Install location"
26 echo "Where do you want tinydns installed?"
27 echo "Ex. /var would install dnscache in /var/tinydns."
28 echo "!!No trailing slash!!"
30 read -p "[/var]> " mypath
33 if [ "$mypath" == "" ]
40 echo ">>> Creating ${mypath}..."
44 # check for existance of users tinydns and dnslog:
47 einfo
"Checking for tinydns and dnslog user accts ..."
49 /usr
/bin
/grep nofiles
/etc
/group
&> /dev
/null
52 echo ">>> Adding group nofiles ..."
53 /usr
/sbin
/groupadd nofiles
&> /dev
/null
56 /usr
/bin
/grep tinydns
/etc
/passwd
&> /dev
/null
59 echo ">>> Adding user tinydns ..."
60 /usr
/sbin
/useradd
-d /dev
/null
-s /bin
/false
-g nofiles \
64 /usr
/bin
/grep dnslog
/etc
/passwd
&> /dev
/null
67 echo ">>> Adding user dnslog ..."
68 /usr
/sbin
/useradd
-d /dev
/null
-s /bin
/false
-g nofiles \
74 addrs
=`ifconfig -a | grep "inet addr" | cut -f2 -d":" | cut -f1 -d" "`
76 echo "Specify an address to which tinydns should bind."
77 echo "NOTICE: tinydns must be able to bind to port 53 on "
78 echo "choosen ip address! udp by tinydns - tcp by axfrdns"
79 echo "Usually this is NOT 127.0.0.1"
80 echo "Currently running IP addresses:"
85 while [ "$myip" = "" ]
87 read -p "IP to bind nameserver to>" myip
91 if [ ! -e ${mypath}/tinydns
]
93 einfo
"Setting up tinydns..."
94 /usr
/bin
/tinydns
-conf tinydns dnslog \
95 ${mypath}/tinydns
$myip
97 ewarn
"*** tinydns directory currently exists, nothing done."
101 if [ ! -e ${mypath}/axfrdns
]
103 einfo
"Setting up axfrdns..."
104 /usr
/bin
/axfrdns
-conf tinydns dnslog \
105 ${mypath}/axfrdns
${mypath}/tinydns
$myip
107 ewarn
"*** axfrdns directory currently exists, nothing done."
110 #grant access to axfrdns
114 einfo
"Start service"
116 echo "tinydns is ready for startup."
117 echo "Do you want dnscache to be started and"
118 echo "supervised by daemontools now?"
121 echo "This requires daemontools to supervise"
124 echo '(press control-C to abort)'
127 # Don't make symbolic links to / !
128 # use ../ instead as it gives trouble in chrooted environments
129 # By Kalin KOZHUHAROV <kalin@ThinRope.net>
130 local fixedroot_path
=`echo ${mypath} | sed -e 's#^/#../#'`
132 ln -sf ${fixedroot_path}/tinydns .
133 ln -sf ${fixedroot_path}/axfrdns .
137 einfo
"Installation successfull"
142 # check for root user!
145 eerror
"${0}: must be root."