Add /usr/pkg/etc/rc.d to the rcNG search list.
[dragonfly.git] / etc / namedb / getroot
1 #!/bin/tcsh -f
2 #
3 # If you are running named and using root.zone as a master, the root.zone
4 # file should be updated periodicly from ftp.rs.internic.net.
5 #
6 # $DragonFly: src/etc/namedb/getroot,v 1.2 2005/02/24 21:58:20 dillon Exp $
7
8 cd /etc/namedb
9 umask 027
10
11 set hostname = 'ftp.rs.internic.net'
12 set remfile = domain/root.zone.gz
13 set locfile = root.zone.gz
14 set path = ( /bin /usr/bin /sbin /usr/sbin )
15
16 fetch ftp://${hostname}:/${remfile}
17 if ( $status != 0) then
18     rm -f ${locfile}
19     echo "Download failed"
20 else
21     gunzip < ${locfile} > root.zone.new
22     if ( $status == 0 ) then
23         rm -f ${locfile}
24         if ( -f root.zone ) then
25             mv -f root.zone root.zone.bak
26         endif
27         chmod 644 root.zone.new
28         mv -f root.zone.new root.zone
29         echo "Download succeeded, restarting named"
30         rndc reload
31         sleep 1
32         rndc status
33     else
34         echo "Download failed: gunzip returned an error"
35         rm -f ${locfile}
36     endif
37 endif
38