frr: Add initscript
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Oct 2018 17:24:34 +0000 (17:24 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Oct 2018 17:27:28 +0000 (17:27 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
config/rootfiles/packages/frr
lfs/frr
src/initscripts/packages/frr [new file with mode: 0755]
src/paks/frr/install.sh

index 845fea3..5db055d 100644 (file)
@@ -7,6 +7,7 @@ etc/frr/ripngd.conf.sample
 etc/frr/staticd.conf.sample
 etc/frr/vtysh.conf.sample
 etc/frr/zebra.conf.sample
+etc/rc.d/init.d/frr
 usr/bin/bgp_btoa
 usr/bin/vtysh
 #usr/include/frr
diff --git a/lfs/frr b/lfs/frr
index 756b877..c90340f 100644 (file)
--- a/lfs/frr
+++ b/lfs/frr
@@ -101,6 +101,10 @@ $(TARGET) : $(patsubst %,$(DIR_DL)/%,$(objects))
                --disable-ripngd
        cd $(DIR_APP) && make $(MAKETUNING)
        cd $(DIR_APP) && make install
+
+       # Install initscript
+       $(call INSTALL_INITSCRIPT,frr)
+
        @rm -rf $(DIR_APP)
        @$(POSTBUILD)
 
diff --git a/src/initscripts/packages/frr b/src/initscripts/packages/frr
new file mode 100755 (executable)
index 0000000..9ebb5f8
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+########################################################################
+# Begin $rc_base/init.d/frr
+#
+# Description : FRRouting Suite
+#
+########################################################################
+
+. /etc/sysconfig/rc
+. ${rc_functions}
+
+DAEMONS="zebra bgpd ospfd staticd"
+
+case "${1}" in
+       start)
+               for daemon in ${DAEMONS}; do
+                       if [ -f "/etc/frr/${daemon}.conf" ]; then
+                               boot_mesg "Starting FRRouting ${daemon}..."
+                               loadproc "/usr/sbin/${daemon}" --daemon
+                       fi
+               done
+               ;;
+
+       stop)
+               for daemon in ${DAEMONS}; do
+                       boot_mesg "Stopping FRRouting ${daemon}..."
+                       killproc "/usr/sbin/${daemon}"
+               done
+               ;;
+
+       reload)
+               boot_mesg "Reloading FRRouting..."
+               reloadproc /usr/sbin/frr-reload
+               ;;
+
+       restart)
+               ${0} stop
+               sleep 1
+               ${0} start
+               ;;
+
+       status)
+               for daemon in ${DAEMONS}; do
+                       statusproc "/usr/sbin/${daemon}"
+               done
+               ;;
+
+       *)
+               echo "Usage: ${0} {start|stop|reload|restart|status}"
+               exit 1
+               ;;
+esac
+
+# End $rc_base/init.d/frr
index 60d77a0..7e02222 100644 (file)
@@ -43,3 +43,10 @@ restore_backup "${NAME}"
 
 # Start services
 start_service "${NAME}"
+
+# Enable autostart
+ln -svf ../init.d/frr /etc/rc.d/rc0.d/K40frr
+ln -svf ../init.d/frr /etc/rc.d/rc3.d/S50frr
+ln -svf ../init.d/frr /etc/rc.d/rc6.d/K40frr
+
+exit 0