Browse Source

2003-12-30 Paul Jakma <paul@dishone.st>

        * redhat/isisd.init: new file, init script for isisd.
          redhat/quagga.sysconfig: new file, sysconfig file for quagga
          initscripts.
          redhat/quagga.spec.in: various cleanups, including sysconfig patch
          from RH, fixed UID/GID as per RH EL, shell changed to
          /sbin/nologin, daemon vty's listen to 127.1 only per default and
          isisd packaged.
          redhat/*.init: sysconfig support and runlevels specified.
paul 16 years ago
parent
commit
15d74e9340
10 changed files with 164 additions and 58 deletions
  1. 11 0
      ChangeLog
  2. 5 2
      redhat/bgpd.init
  3. 61 0
      redhat/isisd.init
  4. 5 2
      redhat/ospf6d.init
  5. 5 2
      redhat/ospfd.init
  6. 53 46
      redhat/quagga.spec.in
  7. 9 0
      redhat/quagga.sysconfig
  8. 5 2
      redhat/ripd.init
  9. 5 2
      redhat/ripngd.init
  10. 5 2
      redhat/zebra.init

+ 11 - 0
ChangeLog

@@ -1,5 +1,16 @@
 2003-12-30 Paul Jakma <paul@dishone.st>
 
+	* redhat/isisd.init: new file, init script for isisd.
+	  redhat/quagga.sysconfig: new file, sysconfig file for quagga
+	  initscripts. 
+	  redhat/quagga.spec.in: various cleanups, including sysconfig patch
+	  from RH, fixed UID/GID as per RH EL, shell changed to 
+	  /sbin/nologin, daemon vty's listen to 127.1 only per default and 
+	  isisd packaged.
+	  redhat/*.init: sysconfig support and runlevels specified.
+	  
+2003-12-30 Paul Jakma <paul@dishone.st>
+
 	* Makefile.am: put the redhat/ stuff into EXTRA_DIST rather than
 	  copying via dist-hook. Remove ~ files backup cruft from dists.
 	  isisd/Makefile.am: sysconf example should go via

+ 5 - 2
redhat/bgpd.init

@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# chkconfig: - 16 84
+# chkconfig: 2345 16 84
 # description: A BGPv4, BGPv4+, BGPv4- routing engine for use with Zebra
 #
 # processname: bgpd
@@ -12,6 +12,9 @@
 # Get network config
 . /etc/sysconfig/network
 
+# quagga command line options
+. /etc/sysconfig/quagga
+
 # Check that networking is up.
 [ "${NETWORKING}" = "no" ] && exit 0
 
@@ -24,7 +27,7 @@ prog="bgpd"
 case "$1" in
   start)
 	echo -n $"Starting $prog: "
-        daemon /usr/sbin/bgpd -d
+        daemon /usr/sbin/bgpd -d $BGPD_OPTS
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/bgpd
 	echo

+ 61 - 0
redhat/isisd.init

@@ -0,0 +1,61 @@
+#!/bin/bash
+#
+# chkconfig: 2345 16 84
+# description: An ISIS routing engine for use with Quagga
+#
+# processname: isisd
+# config: /etc/quagga/isisd.conf
+
+# source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+[ "${NETWORKING}" = "no" ] && exit 0
+
+# The process must be configured first.
+[ -f /etc/quagga/isisd.conf ] || exit 0
+
+RETVAL=0
+
+prog="isisd"
+
+case "$1" in
+  start)
+	echo -n $"Starting $prog: "
+        daemon /usr/sbin/isisd -d
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/isisd
+	echo
+	;;
+  stop)
+	echo -n $"Shutting down $prog: "
+	killproc isisd
+	RETVAL=$?
+	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/isisd
+	echo
+	;;
+  restart|reload)
+        $0 stop
+        $0 start
+	RETVAL=$?
+        ;;
+  condrestart)
+        if [ -f /var/lock/subsys/isisd ]; then
+                $0 stop
+		$0 start
+        fi
+	RETVAL=$?
+        ;;
+  status)
+        status isisd
+	RETVAL=$?
+        ;;
+  *)
+	echo $"Usage: $0 {start|stop|restart|reload|condrestart|status}"
+	exit 1
+esac
+
+exit $RETVAL

+ 5 - 2
redhat/ospf6d.init

@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# chkconfig: - 16 84
+# chkconfig: 2345 16 84
 # description: An OSPF routing engine for use with Zebra and IPv6
 #
 # processname: ospf6d
@@ -12,6 +12,9 @@
 # Get network config
 . /etc/sysconfig/network
 
+# quagga command line options
+. /etc/sysconfig/quagga
+
 # Check that networking is up.
 [ "${NETWORKING_IPV6}" = "no" ] && exit 0
 
@@ -24,7 +27,7 @@ prog="ospf6d"
 case "$1" in
   start)
 	echo -n $"Starting $prog: "
-        daemon /usr/sbin/ospf6d -d
+        daemon /usr/sbin/ospf6d -d $OSPF6D_OPTS
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ospf6d
 	echo

+ 5 - 2
redhat/ospfd.init

@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# chkconfig: - 16 84
+# chkconfig: 2345 16 84
 # description: An OSPF v2 routing engine for use with Zebra
 #
 # processname: ospfd
@@ -12,6 +12,9 @@
 # Get network config
 . /etc/sysconfig/network
 
+# quagga command line options
+. /etc/sysconfig/quagga
+
 # Check that networking is up.
 [ "${NETWORKING}" = "no" ] && exit 0
 
@@ -25,7 +28,7 @@ prog="ospfd"
 case "$1" in
   start)
 	echo -n $"Starting $prog: "
-        daemon /usr/sbin/ospfd -d
+        daemon /usr/sbin/ospfd -d $OSPFD_OPTS
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ospfd
 	echo

+ 53 - 46
redhat/quagga.spec.in

@@ -22,10 +22,19 @@
 
 # defines for configure
 %define		_libexecdir	%{_exec_prefix}/libexec/quagga
-%define		_includedir	%{_prefix}/include/quagga
 %define		_libdir		%{_exec_prefix}/%{_lib}/quagga
+%define		_includedir	%{_prefix}/include
 %define		_localstatedir	/var/run/quagga
 
+# misc internal defines
+%define         quagga_uid      92
+%define         quagga_gid      92
+%if %with_ipv6
+%define		daemon_list	zebra ripd isisd ospfd ripngd ospf6d bgpd
+%else
+%define		daemon_list	zebra ripd isisd ospfd bgpd
+%endif
+
 Summary: Routing daemon
 Name:		quagga
 Version:	@VERSION@
@@ -35,14 +44,14 @@ Group: System Environment/Daemons
 Source0:	http://www.quagga.net/snapshots/cvs/%{name}-%{version}.tar.gz
 URL:		http://www.quagga.net
 %if %with_snmp
-#BuildRequires:	ucd-snmp-devel
+BuildRequires:	ucd-snmp-devel
 Prereq:		ucd-snmp
 %endif
 %if %with_vtysh
 BuildRequires:	readline readline-devel ncurses ncurses-devel
 Prereq:		readline ncurses
 %endif
-BuildRequires:	texinfo tetex autoconf pam-devel patch
+BuildRequires:	texinfo tetex autoconf pam-devel patch libcap-devel
 # Initscripts > 5.60 is required for IPv6 support
 Prereq:		initscripts >= 5.60
 Prereq:		ncurses readline pam
@@ -148,16 +157,17 @@ make install \
 # Remove this file, as it is uninstalled and causes errors when building on RH9
 rm -rf $RPM_BUILD_ROOT/usr/share/info/dir
 
-install %{zeb_rh_src}/zebra.init $RPM_BUILD_ROOT/etc/rc.d/init.d/zebra
-install %{zeb_rh_src}/bgpd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/bgpd
-%if %with_ipv6
-install %{zeb_rh_src}/ospf6d.init $RPM_BUILD_ROOT/etc/rc.d/init.d/ospf6d
-install %{zeb_rh_src}/ripngd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/ripngd
-%endif
-install %{zeb_rh_src}/ospfd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/ospfd
-install %{zeb_rh_src}/ripd.init $RPM_BUILD_ROOT/etc/rc.d/init.d/ripd
-install -m644 %{zeb_rh_src}/quagga.pam $RPM_BUILD_ROOT/etc/pam.d/quagga
-install -m644 %{zeb_rh_src}/quagga.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/quagga
+# install etc sources
+for daemon in %daemon_list ; do
+	install %{zeb_rh_src}/${daemon}.init \
+		$RPM_BUILD_ROOT/etc/rc.d/init.d/${daemon}
+done
+install -m644 %{zeb_rh_src}/quagga.pam \
+	$RPM_BUILD_ROOT/etc/pam.d/quagga
+install -m644 %{zeb_rh_src}/quagga.logrotate \
+	$RPM_BUILD_ROOT/etc/logrotate.d/quagga
+install -m644 %{zeb_rh_src}/quagga.sysconfig \
+	$RPM_BUILD_ROOT/etc/sysconfig/quagga
 install -d -m750  $RPM_BUILD_ROOT/var/run/quagga
 
 %pre
@@ -167,7 +177,9 @@ groupadd -r %vty_group 2> /dev/null || :
 %endif
 # add quagga user and group
 %if %quagga_user
-/usr/sbin/useradd -M -r -s /bin/false -c "Quagga routing suite" \
+/usr/sbin/groupadd -g %quagga_gid quagga 2> /dev/null || :
+/usr/sbin/useradd  -u %quagga_uid -g %quagga_gid \
+ -M -r -s /sbin/nologin -c "Quagga routing suite" \
  -d %_localstatedir %quagga_user 2> /dev/null || :
 %endif
 
@@ -199,14 +211,9 @@ zebra_spec_add_service ospfapi  2607/tcp "OSPF-API"
 %endif
 zebra_spec_add_service isisd    2608/tcp "ISISd vty"
 
-/sbin/chkconfig --add zebra 
-/sbin/chkconfig --add ripd
-%if %with_ipv6
-/sbin/chkconfig --add ripngd
-/sbin/chkconfig --add ospf6d
-%endif
-/sbin/chkconfig --add ospfd
-/sbin/chkconfig --add bgpd
+for daemon in %daemon_list ; do
+	/sbin/chkconfig --add ${daemon}
+done
 
 /sbin/install-info %{_infodir}/quagga.info.gz %{_infodir}/dir
 
@@ -222,31 +229,18 @@ fi
 
 %postun
 if [ "$1" -ge  "1" ]; then
-	/etc/rc.d/init.d/zebra  condrestart >/dev/null 2>&1
-	/etc/rc.d/init.d/ripd   condrestart >/dev/null 2>&1
-%if %with_ipv6
-	/etc/rc.d/init.d/ripngd condrestart >/dev/null 2>&1
-%endif
-	/etc/rc.d/init.d/ospfd  condrestart >/dev/null 2>&1
-%if %with_ipv6
-	/etc/rc.d/init.d/ospf6d condrestart >/dev/null 2>&1
-%endif
-	/etc/rc.d/init.d/bgpd   condrestart >/dev/null 2>&1
+	for daemon in %daemon_list ; do
+		/etc/rc.d/init.d/${daemon} condrestart >/dev/null 2>&1
+	done
 fi
-/sbin/install-info --delete %{_infodir}/quagga.info.gz %{_infodir}/dir
 
 %preun
 if [ "$1" = "0" ]; then
-        /sbin/chkconfig --del zebra
-	/sbin/chkconfig --del ripd
-%if %with_ipv6
-	/sbin/chkconfig --del ripngd
-%endif
-	/sbin/chkconfig --del ospfd
-%if %with_ipv6
-	/sbin/chkconfig --del ospf6d
-%endif
-	/sbin/chkconfig --del bgpd
+	for daemon in %daemon_list ; do
+		/etc/rc.d/init.d/${daemon} stop  >/dev/null 2>&1
+		/sbin/chkconfig --del ${daemon}
+	done
+	/sbin/install-info --delete %{_infodir}/quagga.info.gz %{_infodir}/dir
 fi
 
 %clean
@@ -279,6 +273,7 @@ fi
 %endif
 %config /etc/quagga/[!v]*
 %config /etc/rc.d/init.d/*
+%config(noreplace) /etc/sysconfig/quagga
 %config(noreplace) /etc/pam.d/quagga
 %config(noreplace) %attr(640,root,root) /etc/logrotate.d/*
 
@@ -289,13 +284,25 @@ fi
 %files devel
 %defattr(-,root,root)
 %dir %{_libdir}/*
-%dir %{_includedir}/*.h
-%dir %{_includedir}/ospfd/*
+%dir %{_includedir}/%name/*.h
+%dir %{_includedir}/%name/ospfd/*.h
 %if %with_ospfapi
-%dir %{_includedir}/ospfapi/*
+%dir %{_includedir}/%name/ospfapi/*.h
 %endif
 
 %changelog
+%changelog
+* Tue Dec 30 2003 Paul Jakma <paul@dishone.st>
+- sync to CVS
+- integrate RH sysconfig patch to specify daemon options (RH)
+- default to have vty listen only to 127.1 (RH)
+- add user with fixed UID/GID (RH)
+- create user with shell /sbin/nologin rather than /bin/false (RH)
+- stop daemons on uninstall (RH)
+- delete info file on %preun, not %postun to avoid deletion on upgrade. (RH)
+- isisd added
+- cleanup tasks carried out for every daemon
+
 * Sun Nov 2 2003 Paul Jakma <paul@dishone.st>
 - Fix -devel package to include all files
 - Sync to 0.96.4

+ 9 - 0
redhat/quagga.sysconfig

@@ -0,0 +1,9 @@
+#
+# Default: Bind all daemon vtys to the loopback(s) only
+#
+BGPD_OPTS="-A 127.0.0.1"
+OSPF6D_OPTS="-A ::1"
+OSPFD_OPTS="-A 127.0.0.1"
+RIPD_OPTS="-A 127.0.0.1"
+RIPNGD_OPTS="-A ::1"
+ZEBRA_OPTS="-A 127.0.0.1"

+ 5 - 2
redhat/ripd.init

@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# chkconfig: - 16 84
+# chkconfig: 2345 16 84
 # description: A RIP routing engine for use with Zebra
 #
 # processname: ripd
@@ -12,6 +12,9 @@
 # Get network config
 . /etc/sysconfig/network
 
+# quagga command line options
+. /etc/sysconfig/quagga
+
 # Check that networking is up.
 [ "${NETWORKING}" = "no" ] && exit 0
 
@@ -24,7 +27,7 @@ prog="ripd"
 case "$1" in
   start)
 	echo -n $"Starting $prog: "
-        daemon /usr/sbin/ripd -d
+        daemon /usr/sbin/ripd -d $RIPD_OPTS
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ripd
 	echo

+ 5 - 2
redhat/ripngd.init

@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# chkconfig: - 16 84
+# chkconfig: 2345 16 84
 # description: A RIP routing engine for use with Zebra and IPv6
 #
 # processname: ripngd
@@ -12,6 +12,9 @@
 # Get network config
 . /etc/sysconfig/network
 
+# quagga command line options
+. /etc/sysconfig/quagga
+
 # Check that networking is up.
 [ "${NETWORKING_IPV6}" = "no" ] && exit 0
 
@@ -24,7 +27,7 @@ prog="ripngd"
 case "$1" in
   start)
 	echo -n $"Starting $prog: "
-        daemon /usr/sbin/ripngd -d
+        daemon /usr/sbin/ripngd -d $RIPNGD_OPTS
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/ripngd
 	echo

+ 5 - 2
redhat/zebra.init

@@ -1,6 +1,6 @@
 #!/bin/bash
 #
-# chkconfig: - 15 85
+# chkconfig: 2345 15 85
 # description: GNU Zebra routing manager
 #
 # processname: zebra
@@ -9,6 +9,9 @@
 # source function library
 . /etc/rc.d/init.d/functions
 
+# quagga command line options
+. /etc/sysconfig/quagga
+
 # Check that networking is up.
 [ "${NETWORKING}" = "no" ] && exit 0
 
@@ -25,7 +28,7 @@ case "$1" in
 
 	/sbin/ip route flush proto zebra
 			
-        daemon /usr/sbin/zebra -d
+        daemon /usr/sbin/zebra -d $ZEBRA_OPTS
 	RETVAL=$?
 	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/zebra
 	echo