Bring in some miscellaneous changes from OpenBSD and point to an
[dragonfly/port-amd64.git] / etc / namedb / getroot
blobd6c3c917bf63d26a9b42f0f1bd02b0c0e04bb020
1 #!/bin/tcsh -f
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.
6 # $DragonFly: src/etc/namedb/getroot,v 1.2 2005/02/24 21:58:20 dillon Exp $
8 cd /etc/namedb
9 umask 027
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 )
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