]> granicus.if.org Git - pdns/commitdiff
add init.d script, install it
authorBert Hubert <bert.hubert@netherlabs.nl>
Wed, 19 Apr 2006 19:47:38 +0000 (19:47 +0000)
committerBert Hubert <bert.hubert@netherlabs.nl>
Wed, 19 Apr 2006 19:47:38 +0000 (19:47 +0000)
add manpages to .deb, .rpm and tar.bz2
make rec_control exit with a meaningful error

git-svn-id: svn://svn.powerdns.com/pdns/trunk/pdns@745 d19b8d6e-7fed-0310-83ef-9ca221ded41b

pdns/Makefile-recursor
pdns/dist-recursor
pdns/docs/Makefile
pdns/pdns-recursor.init.d [new file with mode: 0755]
pdns/pdns-recursor.spec
pdns/rec_control.cc
pdns/sysdeps-recursor/Linux.inc

index b775a20a626fa2c8996ee005d18d79990c444b01..ea7bc12e5ff99b5d4750da157e5a317704957443 100644 (file)
@@ -47,7 +47,9 @@ install: all
        install -s rec_control $(DESTDIR)/$(BINDIR)
        -mkdirhier $(DESTDIR)/$(CONFIGDIR)
        ./pdns_recursor --config > $(DESTDIR)/$(CONFIGDIR)/recursor.conf
-       
+       -mkdirhier $(DESTDIR)/usr/share/man/man1
+       cp pdns_recursor.1 rec_control.1 $(DESTDIR)/usr/share/man/man1
+       $(OS_SPECIFIC_INSTALL)  
 
 clean:
        -rm -f *.o *~ pdns_recursor rec_control optional/*.o
index 72a121551dd2504e0c25ddcac2c8a3a4eb397bf8..f5cce9121e28441ed87f845f49e3ed3be307563e 100755 (executable)
@@ -12,6 +12,10 @@ recursor_cache.cc  dnsparser.cc dnswriter.cc  dnsrecords.cc  rcpgenerator.cc  \
 base64.cc  zoneparser-tng.cc  rec_channel.cc rec_channel_rec.cc rec_control.cc \
 selectmplexer.cc epollmplexer.cc kqueuemplexer.cc portsmplexer.cc"
 
+cd docs
+make pdns_recursor.1 rec_control.1
+cd ..
+
 DIRNAME=pdns-recursor-$VERSION
 rm -rf $DIRNAME
 mkdir  $DIRNAME
@@ -23,6 +27,8 @@ cp config-recursor.h $DIRNAME/config.h
 mkdir $DIRNAME/rrd
 cp tools/rrd/{create,update,makegraphs,index.html} $DIRNAME/rrd
 cp ext/nedmalloc/malloc.c $DIRNAME
+cp pdns-recursor.init.d $DIRNAME
+cp docs/pdns_recursor.1 docs/rec_control.1 $DIRNAME
 
 mkdir -p $DIRNAME/sysdeps
 cp  sysdeps-recursor/* $DIRNAME/sysdeps
index b32e6957bb4e8771da00ca2d694a738dcc187c57..0c5ee6a3aa33a2dc9f305586f71b1e1b749ca462 100644 (file)
@@ -6,7 +6,7 @@ pdns-expanded.sgml: pdns.sgml
        ./expand < $< > $@
        
 clean:
-       rm -rf *.dvi *.pdf *.tex *.toc *.aux *.txt *.ps *.bak *.tmp *~ *.log html.tar.gz html pdns
+       rm -rf *.xml *.dvi *.pdf *.tex *.toc *.aux *.ps *.bak *.tmp *~ *.log html.tar.gz html pdns
 
 html/index.html: pdns-expanded.sgml
        db2html -V %use-id-as-filename% -o html $<
@@ -22,6 +22,15 @@ html.tar.gz: html/index.html
        docbook2pdf $<
        mv pdns-expanded.pdf pdns.pdf
 
+%.xml: %.txt
+       asciidoc -b docbook -d manpage  $<
+        
+%: %.xml
+       xmlto man $<
+                
+%.html: %.txt
+       asciidoc -b xhtml11 -d manpage  $<
+                        
 publish:
        rsync --copy-links --delete -avrze ssh ./html pdns.txt pdns.pdf \
        exit.powerdns.com:/opt/websites/downloads.powerdns.com/www/documentation/
diff --git a/pdns/pdns-recursor.init.d b/pdns/pdns-recursor.init.d
new file mode 100755 (executable)
index 0000000..31c93b8
--- /dev/null
@@ -0,0 +1,89 @@
+#!/bin/sh
+# chkconfig: - 80 75
+# description: pdns_recursor is a versatile high performance recursing nameserver
+
+prefix=/usr/
+BINARYPATH=/usr/bin/
+SBINARYPATH=/usr/sbin/
+SOCKETPATH=/var/run
+
+pdns_server=$SBINARYPATH/pdns_recursor
+
+[ -f "$pdns_server" ] || exit 0
+
+doPC()
+{
+       ret=$($BINARYPATH/rec_control $EXTRAOPTS $1 $2 2> /dev/null)
+}
+
+
+doPC ping
+NOTRUNNING=$?
+
+case "$1" in
+       status)
+               if test "$NOTRUNNING" = "0" 
+               then 
+                       echo "running"
+               else
+                       echo "not running"
+               fi 
+       ;;      
+
+       stop)
+               echo -n "Stopping PowerDNS recursing nameserver: "
+               if test "$NOTRUNNING" = "0" 
+               then 
+                       doPC quit
+                       echo $ret
+               else
+                       echo "not running"
+               fi 
+       ;;              
+
+
+       force-stop)
+               echo -n "Stopping PowerDNS recursing nameserver: "
+               killall -v -9 pdns_server
+               echo "killed"
+       ;;
+
+       start)
+               echo -n "Starting PowerDNS recursing nameserver: "
+               if test "$NOTRUNNING" = "0" 
+               then 
+                       echo "already running"
+               else
+                       $pdns_server --daemon 
+                       if test "$?" = "0"
+                       then
+                               echo "started"  
+                       fi
+               fi 
+       ;;              
+
+       force-reload | restart)
+               echo -n "Restarting PowerDNS authoritative nameserver: "
+               echo -n stopping and waiting.. 
+               doPC quit
+               sleep 3
+               echo done
+               $0 start
+       ;;
+
+       monitor)
+               if test "$NOTRUNNING" = "0" 
+               then 
+                       echo "already running"
+               else
+                       $pdns_server --daemon=no --quiet=no --control-console --loglevel=9
+               fi 
+       ;;              
+
+       *)
+       echo pdns [start\|stop\|force-reload\|restart\|status\|monitor]
+
+       ;;
+esac
+
+
index 5a0813a83473d07752eb80fde1192e8f0c08313a..e74eb78322583484d2b55bceaeddf38c3264a41c 100644 (file)
@@ -2,7 +2,7 @@
 
 Buildroot: /tmp/pdns/
 Name: pdns-recursor
-Version: 3.0_pre3
+Version: 3.0_pre4
 Release: 1
 Summary: extremely powerful and versatile recursing nameserver
 Copyright: see /usr/doc/pdns/copyright
@@ -34,6 +34,9 @@ This RPM is semi-statically compiled and should work on all Linux distributions.
 %defattr(-,root,root)
 "/usr/sbin/pdns_recursor"
 "/usr/bin/rec_control"
+"/etc/init.d/pdns-recursor"
+"/usr/share/man/man1/pdns_recursor.1.gz"
+"/usr/share/man/man1/rec_control.1.gz"
 %dir "/etc/powerdns/"
 %config(noreplace) "/etc/powerdns/recursor.conf"
 
index 903b273207b661af30aec256da2c0d9fc6175ac4..6f9c71974e78e0430e333e43036ea8a602e785b3 100644 (file)
@@ -68,8 +68,10 @@ try
   rccS.send(command);
   string receive=rccS.recv();
   cout<<receive;
+  exit(0);
 }
 catch(AhuException& ae)
 {
   cerr<<"Fatal: "<<ae.reason<<"\n";
+  exit(1);
 }
index 4e7a6fb9852b979967b4b5574211296c436a5384..049df00d6fbf05fd50cb849719f270b73a69ac12 100644 (file)
@@ -1,4 +1,5 @@
 OPTIONALS:=optional/epollmplexer.o
+OS_SPECIFIC_INSTALL=mkdirhier $(DESTDIR)/etc/init.d ; cp pdns-recursor.init.d $(DESTDIR)/etc/init.d/pdns-recursor
        
 optional/epollmplexer.o: epollmplexer.cc
        $(CXX) $(CXXFLAGS) -c $< -o $@ ; true