[c5c522c] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | # Shut down stuff |
---|
| 4 | svcstop /service/tinydns || exit 1 |
---|
| 5 | svcstop /service/dnscache || exit 1 |
---|
| 6 | |
---|
| 7 | useradd -u 102 gdnslog -g nobody -s /bin/false |
---|
| 8 | useradd -u 103 gdnscache -g nobody -s /bin/false |
---|
| 9 | useradd -u 101 tinydns -g nobody -s /bin/false |
---|
| 10 | useradd -u 104 logacct -g nobody -s /bin/false |
---|
| 11 | |
---|
| 12 | #if [ ! -h /etc/dnscache ]; then |
---|
| 13 | # if [ -d /etc/dnscache ]; then |
---|
| 14 | # mv /etc/dnscache /home/system || exit 1 |
---|
| 15 | # ln -s /home/system/dnscache /etc |
---|
| 16 | # else |
---|
| 17 | # ln -s /home/system/dnscache /etc |
---|
| 18 | # fi |
---|
| 19 | #fi |
---|
| 20 | |
---|
| 21 | #if [ ! -h /etc/tinydns ]; then |
---|
| 22 | # if [ -d /etc/tinydns ]; then |
---|
| 23 | # mv /etc/tinydns /home/system || exit 1 |
---|
| 24 | # ln -s /home/system/tinydns /etc |
---|
| 25 | # else |
---|
| 26 | # ln -s /home/system/tinydns /etc |
---|
| 27 | # fi |
---|
| 28 | #fi |
---|
| 29 | |
---|
| 30 | if [ ! -d /etc/dnscache ]; then |
---|
| 31 | dnscache-conf gdnscache gdnslog /etc/dnscache 0.0.0.0 |
---|
| 32 | fi |
---|
| 33 | |
---|
| 34 | #add the tailorred start/stop scripts |
---|
| 35 | mv /var/dnscache/start /etc/dnscache |
---|
| 36 | mv /var/dnscache/stop /etc/dnscache |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | if [ ! -d /etc/tinydns ]; then |
---|
| 40 | tinydns-conf tinydns logacct /etc/tinydns 127.0.0.2 |
---|
| 41 | fi |
---|
| 42 | |
---|
| 43 | if [ -d /etc/dnscache/root ]; then |
---|
| 44 | mv /etc/dnscache/root/* /home/system/dnscache/ |
---|
| 45 | rmdir /etc/dnscache/root |
---|
| 46 | fi |
---|
| 47 | |
---|
| 48 | if [ -d /etc/tinydns/root ]; then |
---|
| 49 | mv /etc/tinydns/root/* /home/system/tinydns/ |
---|
| 50 | rmdir /etc/tinydns/root |
---|
| 51 | fi |
---|
| 52 | |
---|
| 53 | touch /home/system/dnscache/ip/{127,10,192.168} |
---|
| 54 | for I in `seq 16 31`; do |
---|
| 55 | touch /home/system/dnscache/ip/172.$I |
---|
| 56 | done |
---|
| 57 | |
---|
| 58 | echo "/home/system/tinydns" > /etc/tinydns/env/ROOT |
---|
| 59 | echo "/home/system/dnscache" > /etc/dnscache/env/ROOT |
---|
| 60 | |
---|
| 61 | pushd /home/system/tinydns |
---|
| 62 | make || exit 1 |
---|
| 63 | popd |
---|
| 64 | |
---|
| 65 | ln -sf /etc/tinydns /service |
---|
| 66 | ln -sf /etc/dnscache /service |
---|
| 67 | |
---|
| 68 | #always update our root ns list with a fresh version |
---|
| 69 | cp /etc/dnsroots.global /home/system/dnscache/servers/@ |
---|
| 70 | |
---|
| 71 | #lelijke hack, nodig om een oude buggy package te updaten |
---|
| 72 | pkill -f "supervise tinydns" |
---|
| 73 | pkill -f "supervise dnscache" |
---|
| 74 | |
---|
| 75 | #reset services naar orignele staat |
---|
| 76 | svcreset /service/dnscache || exit 1 |
---|
| 77 | svcreset /service/tinydns || exit 1 |
---|
| 78 | |
---|
| 79 | exit 0 |
---|