]> git.proxmox.com Git - mirror_frr.git/commitdiff
debian: Add Systemd integration to control files
authorDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 10 Feb 2016 12:30:56 +0000 (07:30 -0500)
committerDonald Sharp <sharpd@cumulusnetworks.com>
Wed, 10 Feb 2016 20:11:15 +0000 (15:11 -0500)
Ticket:
Reviewed By: inprogress
Testing Done: minimal.  Built, installed, started a few services.

This is in progress testing.  quagga.service tries to start and stop
all the routing daemons.  There is no check for whether they are enabled
via /etc/quagga/daemons (yet).

As installed, nothing is enabled (won't start on system boot or install).

The -A 127.0.0.1 is now in /etc/default/quagga, and picked up from there
by all routing daemons.

MAX_FDS is in all the service files for now as LimitNOFILE.  Users who
need to modified the number of fd's will use e.g.
the file /etc/systemd/system/bgpd.service.d/maxfds.conf to override
bgpd.service contents
    [Service]
    LimitNOFILE=2048

MAX_INSTANCES isn't implemented yet.

reload isn't implemented yet (it should be possible via ExecReload
in the services, just not done yet).

The init.d file is removed.

All of the daemons are started without the -d/--daemonize option, and
use Type=simple rather than forking in the services file, to use the
systemd daemonizing.

All the daemons were set to have a 1m start time, and restart up to 3
times in 3 minutes, and for now, are only restart on-abnormal, not always
(we'll likely want the latter, but testing is easier with abnormal).

Also use tmpfiles.d to create /run/quagga

For now, we leave dh_installinit, even though it creates unneeded
update-rc.d calls, and causes lintian complaints about init.d files
that aren't present, so that it installs files like etc/default/quagga.
It also runs the tmpfiles.d commands for us, so we need to add those to
postinst if we dummy it out to fix the update-rc.d lines being added
(and lintian complaints).

Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
15 files changed:
debian/babeld.service [new file with mode: 0644]
debian/bgpd.service [new file with mode: 0644]
debian/control
debian/isisd.service [new file with mode: 0644]
debian/ospf6d.service [new file with mode: 0644]
debian/ospfd.service [new file with mode: 0644]
debian/quagga.conf [new file with mode: 0644]
debian/quagga.default
debian/quagga.init.d [deleted file]
debian/quagga.install
debian/quagga.service [new file with mode: 0644]
debian/ripd.service [new file with mode: 0644]
debian/ripngd.service [new file with mode: 0644]
debian/rules
debian/zebra.service [new file with mode: 0644]

diff --git a/debian/babeld.service b/debian/babeld.service
new file mode 100644 (file)
index 0000000..740173c
--- /dev/null
@@ -0,0 +1,20 @@
+[Unit]
+Description=Babel routing daemon
+After=syslog.target networking.service zebra.service
+OnFailure=heartbeat-failed@%n.service
+
+[Service]
+Nice=-5
+Type=notify
+EnvironmentFile=/etc/default/quagga
+StartLimitInterval=3m
+StartLimitBurst=3
+TimeoutSec=1m
+WatchdogSec=60s
+RestartSec=5
+Restart=on-abnormal
+LimitNOFILE=1024
+ExecStart=/usr/lib/quagga/babeld $BABEL_OPTIONS
+ExecStartPost=/usr/bin/vtysh -b -n
+[Install]
+WantedBy=network.target
diff --git a/debian/bgpd.service b/debian/bgpd.service
new file mode 100644 (file)
index 0000000..329dc08
--- /dev/null
@@ -0,0 +1,19 @@
+[Unit]
+Description=Cumulus Linux Quagga BGP Daemon
+After=syslog.target networking.service zebra.service
+OnFailure=heartbeat-failed@%n.service
+
+[Service]
+Nice=-5
+EnvironmentFile=/etc/default/quagga
+Type=notify
+StartLimitInterval=3m
+StartLimitBurst=3
+TimeoutSec=1m
+WatchdogSec=60s
+RestartSec=5
+LimitNOFILE=1024
+ExecStart=/usr/lib/quagga/bgpd $BGPD_OPTIONS
+ExecStartPost=/usr/bin/vtysh -b -n
+[Install]
+WantedBy=network.target
index dacc3400860d5e513464dc317c029ffc2a7f4053..ac0078aec9394a5750b2778e07beee46aa774e4c 100644 (file)
@@ -3,8 +3,8 @@ Section: net
 Priority: optional
 Maintainer: Christian Hammers <ch@debian.org>
 Uploaders: Florian Weimer <fw@debian.org>
-Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), imagemagick, ghostscript, groff, po-debconf, autotools-dev, hardening-wrapper, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson0, libjson0-dev
-Standards-Version: 3.9.4
+Build-Depends: debhelper (>= 7.0.50~), libncurses5-dev, libreadline-dev, texlive-latex-base, texlive-generic-recommended, libpam0g-dev | libpam-dev, libcap-dev, texinfo (>= 4.7), imagemagick, ghostscript, groff, po-debconf, autotools-dev, hardening-wrapper, libpcre3-dev, gawk, chrpath, libsnmp-dev, git, dh-autoreconf, libjson0, libjson0-dev, dh-systemd, libsystemd-dev
+Standards-Version: 3.9.6
 Homepage: http://www.quagga.net/
 XS-Testsuite: autopkgtest
 
diff --git a/debian/isisd.service b/debian/isisd.service
new file mode 100644 (file)
index 0000000..61a13ae
--- /dev/null
@@ -0,0 +1,20 @@
+[Unit]
+Description=IS-IS routing daemon
+After=syslog.target networking.service zebra.service
+OnFailure=heartbeat-failed@%n.service
+
+[Service]
+Nice=-5
+Type=notify
+EnvironmentFile=/etc/default/quagga
+StartLimitInterval=3m
+StartLimitBurst=3
+TimeoutSec=1m
+WatchdogSec=60s
+RestartSec=5
+Restart=on-abnormal
+LimitNOFILE=1024
+ExecStart=/usr/lib/quagga/isisd $ISISD_OPTIONS
+ExecStartPost=/usr/bin/vtysh -b -n
+[Install]
+WantedBy=network.target
diff --git a/debian/ospf6d.service b/debian/ospf6d.service
new file mode 100644 (file)
index 0000000..8ceeb86
--- /dev/null
@@ -0,0 +1,19 @@
+[Unit]
+Description=OSPF routing daemon for IPv6
+After=syslog.target networking.service zebra.service
+OnFailure=heartbeat-failed@%n.service
+
+[Service]
+Nice=-5
+Type=notify
+EnvironmentFile=/etc/default/quagga
+StartLimitInterval=3m
+StartLimitBurst=3
+TimeoutSec=1m
+WatchdogSec=60s
+RestartSec=5
+Restart=on-abnormal
+ExecStart=/usr/lib/quagga/ospf6d $OSPF6D_OPTIONS
+ExecStartPost=/usr/bin/vtysh -b  -n
+[Install]
+WantedBy=network.target
diff --git a/debian/ospfd.service b/debian/ospfd.service
new file mode 100644 (file)
index 0000000..36bbab4
--- /dev/null
@@ -0,0 +1,20 @@
+[Unit]
+Description=OSPF routing daemon
+After=syslog.target networking.service zebra.service
+OnFailure=heartbeat-failed@%n.service
+
+[Service]
+Type=notify
+Nice=-5
+EnvironmentFile=/etc/default/quagga
+StartLimitInterval=3m
+StartLimitBurst=3
+TimeoutSec=1m
+WatchdogSec=60s
+RestartSec=5
+Restart=on-abnormal
+LimitNOFILE=1024
+ExecStart=/usr/lib/quagga/ospfd $OSPFD_OPTIONS
+ExecStartPost=/usr/bin/vtysh -b  -n
+[Install]
+WantedBy=network.target
diff --git a/debian/quagga.conf b/debian/quagga.conf
new file mode 100644 (file)
index 0000000..04d8eea
--- /dev/null
@@ -0,0 +1,2 @@
+# Create the /run/quagga directory at boot or from systemd-tmpfiles on install
+d /run/quagga 0755 quagga quagga
index 687ead4f0f33c7455247c1c9eb6eb7da7bdc564a..8b494be7942a41be581999e93991fc97916c507f 100644 (file)
@@ -1,2 +1,10 @@
 MAX_INSTANCES=5
 MAX_FDS=1024
+ZEBRA_OPTIONS="-s 16777216 -A 127.0.0.1"
+BGPD_OPTIONS="-A 127.0.0.1"
+OSPFD_OPTIONS="-A 127.0.0.1"
+OSPF6D_OPTIONS="-A ::1"
+RIPD_OPTIONS="-A 127.0.0.1"
+RIPNGD_OPTIONS="-A ::1"
+ISISD_OPTIONS="-A 127.0.0.1"
+BABELD_OPTIONS="-A 127.0.0.1"
diff --git a/debian/quagga.init.d b/debian/quagga.init.d
deleted file mode 100755 (executable)
index 9e5cae8..0000000
+++ /dev/null
@@ -1,557 +0,0 @@
-#!/bin/bash
-#
-### BEGIN INIT INFO
-# Provides: quagga
-# Required-Start: $local_fs $network $remote_fs $syslog
-# Required-Stop: $local_fs $network $remote_fs $syslog
-# Default-Start:  2 3 4 5
-# Default-Stop: 0 1 6
-# Short-Description: start and stop the Quagga routing suite
-# Description: Quagga is a routing suite for IP routing protocols like 
-#              BGP, OSPF, RIP and others. This script contols the main 
-#              daemon "quagga" as well as the individual protocol daemons.
-### END INIT INFO
-#
-
-PATH=/bin:/usr/bin:/sbin:/usr/sbin
-D_PATH=/usr/lib/quagga
-C_PATH=/etc/quagga
-V_PATH=/var/run/quagga
-
-# Local Daemon selection may be done by using /etc/quagga/daemons.
-# See /usr/share/doc/quagga/README.Debian.gz for further information.
-# Keep zebra first and do not list watchquagga!
-DAEMONS="zebra bgpd ripd ripngd ospfd ospf6d isisd babeld"
-MAX_INSTANCES=5
-RELOAD_SCRIPT=/usr/lib/quagga/quagga-reload.py
-
-. /lib/lsb/init-functions
-
-# Print the name of the pidfile.
-pidfile()
-{
-    echo "$V_PATH/$1.pid"
-}
-
-# Print the name of the vtysh.
-vtyfile()
-{
-    echo "$V_PATH/$1.vty"
-}
-
-# Check if daemon is started by using the pidfile.
-started()
-{
-        [ ! -e `pidfile $1` ] && return 3
-       if [ -n "$2" ] && [ "$2" == "log" ]; then
-           status_of_proc -p `pidfile $1` $1 $1 && return 0 || return $?
-       else
-          kill -0 `cat \`pidfile $1\`` 2> /dev/null || return 1
-          return 0
-        fi
-}
-
-# Loads the config via vtysh -b if configured to do so.
-vtysh_b ()
-{
-        # Rember, that all variables have been incremented by 1 in convert_daemon_prios()
-        if [ "$vtysh_enable" = 2 -a -f $C_PATH/Quagga.conf ]; then
-                /usr/bin/vtysh -b
-        fi
-}
-
-# Check if the daemon is activated and if its executable and config files 
-# are in place.
-# params:       daemon name
-# returns:      0=ok, 1=error
-check_daemon()
-{
-        # If the integrated config file is used the others are not checked.
-        if [ -r "$C_PATH/Quagga.conf" ]; then
-          return 0
-        fi 
-
-        # vtysh_enable has no config file nor binary so skip check.
-        # (Not sure why vtysh_enable is in this list but does not hurt)
-        if [ $1 != "watchquagga" -a $1 != "vtysh_enable" ]; then
-          # check for daemon binary
-          if [ ! -x "$D_PATH/$1" ]; then return 1; fi
-                
-          # check for config file
-          if [ -n "$2" ]; then
-           if [ ! -r "$C_PATH/$1-$2.conf" ]; then
-                touch "$C_PATH/$1-$2.conf"
-                chown quagga:quagga "$C_PATH/$1-$2.conf"
-           fi
-          elif [ ! -r "$C_PATH/$1.conf" ]; then
-            touch "$C_PATH/$1.conf"
-            chown quagga:quagga "$C_PATH/$1.conf"
-          fi
-        fi
-        return 0
-}
-
-# Starts the server if it's not alrady running according to the pid file.
-# The Quagga daemons creates the pidfile when starting.
-start()
-{
-       ulimit -n $MAX_FDS
-        if [ "$1" = "watchquagga" ]; then
-
-           # We may need to restart watchquagga if new daemons are added and/or
-           # removed
-           if started "$1" ; then
-               stop watchquagga
-           else
-               # Echo only once. watchquagga is printed in the stop above
-               echo -n " $1"
-           fi
-
-            start-stop-daemon \
-                --start \
-                --pidfile=`pidfile $1` \
-                --exec "$D_PATH/$1" \
-                -- \
-                "${watchquagga_options[@]}"
-        elif [ -n "$2" ]; then
-          echo -n " $1-$2"
-           if ! check_daemon $1 $2 ; then
-              echo -n " (binary does not exist)"
-              return;
-          fi
-
-           start-stop-daemon \
-               --start \
-               --pidfile=`pidfile $1-$2` \
-               --exec "$D_PATH/$1" \
-               -- \
-               `eval echo "$""$1""_options"` -n "$2"
-        else
-           echo -n " $1"
-            if ! check_daemon $1; then
-               echo -n " (binary does not exist)"
-               return;
-           fi
-
-           start-stop-daemon \
-               --start \
-               --pidfile=`pidfile $1` \
-               --exec "$D_PATH/$1" \
-               -- \
-               `eval echo "$""$1""_options"`
-        fi
-}
-
-# Stop the daemon given in the parameter, printing its name to the terminal.
-stop()
-{
-    local inst
-
-    if [ -n "$2" ]; then
-       inst="$1-$2"
-    else
-       inst="$1"
-    fi
-
-    if ! started "$inst" ; then
-        echo -n " ($inst)"
-        return 0
-    else
-        PIDFILE=`pidfile $inst`
-        PID=`cat $PIDFILE 2>/dev/null`
-        start-stop-daemon --stop --quiet --retry=TERM/30/KILL/5 --oknodo --pidfile "$PIDFILE" --exec "$D_PATH/$1"
-        #
-        #       Now we have to wait until $DAEMON has _really_ stopped.
-        #
-        if test -n "$PID" && kill -0 $PID 2>/dev/null; then
-            echo -n " (waiting) ."
-            cnt=0
-            while kill -0 $PID 2>/dev/null; do
-                cnt=`expr $cnt + 1`
-                if [ $cnt -gt 60 ]; then
-                    # Waited 120 secs now, fail.
-                    echo -n "Failed.. "
-                    break
-                fi
-                sleep 2
-                echo -n "."
-                done
-            fi
-        echo -n " $inst"
-        rm -f `pidfile $inst`
-        rm -f `vtyfile $inst`
-    fi
-}
-
-# Converts values from /etc/quagga/daemons to all-numeric values.
-convert_daemon_prios()
-{
-        for name in $DAEMONS zebra vtysh_enable watchquagga_enable; do
-          # First, assign the value set by the user to $value 
-          eval value=\${${name}:0:3}
-
-          # Daemon not activated or entry missing?
-          if [ "$value" = "no" -o "$value" = "" ]; then value=0; fi
-
-          # These strings parsed for backwards compatibility.
-          if [ "$value" = "yes"  -o  "$value" = "true" ]; then
-            value=1;
-          fi
-
-          # Zebra is threatened special. It must be between 0=off and the first
-      # user assigned value "1" so we increase all other enabled daemons' values.
-          if [ "$name" != "zebra" -a "$value" -gt 0 ]; then value=`expr "$value" + 1`; fi
-
-          # If e.g. name is zebra then we set "zebra=yes".
-          eval $name=$value
-        done
-}
-
-# Starts watchquagga for all wanted daemons.
-start_watchquagga()
-{
-    local daemon_name
-    local daemon_prio
-    local found_one
-    local daemon_inst
-
-    # Start the monitor daemon only if desired.
-    if [ 0 -eq "$watchquagga_enable" ]; then
-        return
-    fi
-
-    # Check variable type
-    if ! declare -p watchquagga_options | grep -q '^declare \-a'; then
-      echo
-      echo "ERROR: The variable watchquagga_options from /etc/quagga/debian.cnf must be a BASH array!"
-      echo "ERROR: Please convert config file and restart!"
-      exit 1
-    fi
-
-    # Which daemons have been started?
-    found_one=0
-    for daemon_name in $DAEMONS; do
-        eval daemon_prio=\$$daemon_name
-        if [ "$daemon_prio" -gt 0 ]; then
-           eval "daemon_inst=\${${daemon_name}_instances//,/ }"
-          if [ -n "$daemon_inst" ]; then
-             for inst in ${daemon_inst}; do
-                 eval "inst_disable=\${${daemon_name}_${inst}}"
-                 if [ -z ${inst_disable} ] || [ ${inst_disable} != 0 ]; then
-                     if check_daemon $daemon_name $inst; then
-                         watchquagga_options+=("${daemon_name}-${inst}")
-                     fi
-                 fi
-             done
-          else
-              if check_daemon $daemon_name; then
-                  watchquagga_options+=($daemon_name)
-              fi
-           fi
-           found_one=1
-        fi
-    done
-
-    # Start if at least one daemon is activated.
-    if [ $found_one -eq 1 ]; then
-      echo -n "Starting Quagga monitor daemon:"
-      start watchquagga
-      echo "."
-    fi
-}
-
-# Stopps watchquagga.
-stop_watchquagga()
-{
-    echo -n "Stopping Quagga monitor daemon:"
-    stop watchquagga
-    echo "."
-}
-
-# Stops all daemons that have a lower level of priority than the given.
-# (technically if daemon_prio >= wanted_prio)
-stop_prio() 
-{
-        local wanted_prio
-        local daemon_prio
-        local daemon_list
-        local daemon_inst
-       local inst
-
-        if [ -n "$2" ] && [[ "$2" =~ (.*)-(.*) ]]; then
-          daemon=${BASH_REMATCH[1]}
-          inst=${BASH_REMATCH[2]}
-        else
-          daemon="$2"
-        fi
-
-        wanted_prio=$1
-        daemon_list=${daemon:-$DAEMONS}
-
-        echo -n "Stopping Quagga daemons (prio:$wanted_prio):"
-
-        for prio_i in `seq 10 -1 $wanted_prio`; do
-            for daemon_name in $daemon_list; do
-               eval daemon_prio=\${${daemon_name}:0:3}
-               daemon_inst=""
-                if [ $daemon_prio -eq $prio_i ]; then
-                  eval "daemon_inst=\${${daemon_name}_instances//,/ }"
-                  if [ -n "$daemon_inst" ]; then
-                          for i in ${daemon_inst}; do
-                               if [ -n "$inst" ] && [ "$i" == "$inst" ]; then
-                                   stop "$daemon_name" "$inst"
-                               elif [ x"$inst"  == x ]; then
-                                   stop "$daemon_name" "$i"
-                               fi
-                          done
-                   else
-                      stop "$daemon_name"
-                   fi
-                fi
-            done
-        done
-
-        echo "."
-       if [ -z "$inst" ]; then
-       # Now stop other daemons that're prowling, coz the daemons file changed
-           echo -n "Stopping other quagga daemons"
-            if [ -n "$daemon" ]; then
-               eval "file_list_suffix="$V_PATH"/"$daemon*""
-           else
-               eval "file_list_suffix="$V_PATH/*""
-           fi
-            for pidfile in $file_list_suffix.pid; do
-               PID=`cat $pidfile 2>/dev/null`
-               start-stop-daemon --stop --quiet --oknodo --pidfile "$pidfile"
-               echo -n "."
-               rm -rf "$pidfile"
-            done
-            echo "."
-
-           echo -n "Removing remaining .vty files"
-           for vtyfile in $file_list_suffix.vty; do
-               rm -rf "$vtyfile"
-           done
-            echo "."
-       fi
-}
-
-# Starts all daemons that have a higher level of priority than the given.
-# (technically if daemon_prio <= wanted_prio)
-start_prio()
-{
-        local wanted_prio
-        local daemon_prio
-        local daemon_list
-       local daemon_name
-       local daemon_inst
-       local inst
-
-        if [ -n "$2" ] && [[ "$2" =~ (.*)-(.*) ]]; then
-          daemon=${BASH_REMATCH[1]}
-          inst=${BASH_REMATCH[2]}
-        else
-          daemon="$2"
-        fi
-        
-        wanted_prio=$1
-        daemon_list=${daemon:-$DAEMONS}
-
-        echo -n "Starting Quagga daemons (prio:$wanted_prio):"
-
-        for prio_i in `seq 1 $wanted_prio`; do
-            for daemon_name in $daemon_list; do
-               eval daemon_prio=\$${daemon_name}
-               daemon_inst=""
-                if [ $daemon_prio -eq $prio_i ]; then
-                  eval "daemon_inst=\${${daemon_name}_instances//,/ }"
-                  if [ -n "$daemon_inst" ]; then
-                       if [ `echo "$daemon_inst" | wc -w` -gt ${MAX_INSTANCES} ]; then
-                           echo "Max instances supported is ${MAX_INSTANCES}. Aborting"
-                           exit 1
-                       fi
-                      # Check if we're starting again by switching from single instance
-                      # to MI version
-                      if started "$daemon_name"; then
-                          PIDFILE=`pidfile $daemon_name`
-                          start-stop-daemon \
-                              --stop --quiet --oknodo \
-                              --pidfile "$PIDFILE" \
-                              --exec "$D_PATH/$daemon_name"
-
-                          rm -f `pidfile $1`
-                          rm -f `vtyfile $1`
-                      fi
-
-                      for i in ${daemon_inst}; do
-                          if [ -n "$inst" ] && [ "$i" == "$inst" ]; then
-                              start "$daemon_name" "$inst"
-                          elif [ x"$inst" == x ]; then
-                              start "$daemon_name" "$i"
-                          fi
-                      done
-                  else
-                      # Check if we're starting again by switching from
-                      # single instance to MI version
-                      eval "file_list_suffix="$V_PATH"/"$daemon_name-*""
-                      for pidfile in $file_list_suffix.pid; do
-                          start-stop-daemon --stop --quiet --oknodo --pidfile "$pidfile"
-                          echo -n "."
-                          rm -rf "$pidfile"
-                      done
-                      for vtyfile in $file_list_suffix.vty; do
-                          rm -rf "$vtyfile"
-                      done
-
-                      start "$daemon_name"
-                  fi
-                fi
-            done
-        done
-        echo "."
-}
-
-check_status()
-{
-    local daemon_name
-    local daemon_prio
-    local daemon_inst
-    local failed_status=0
-
-    if [ -n "$1" ] && [[ "$1" =~ (.*)-(.*) ]]; then
-       daemon=${BASH_REMATCH[1]}
-       inst=${BASH_REMATCH[2]}
-    else
-       daemon="$1"
-    fi
-
-    daemon_list=${daemon:-$DAEMONS}
-
-    # Which daemons have been started?
-    for daemon_name in $daemon_list; do
-        eval daemon_prio=\$$daemon_name
-        if [ "$daemon_prio" -gt 0 ]; then
-           eval "daemon_inst=\${${daemon_name}_instances//,/ }"
-           if [ -n "$daemon_inst" ]; then
-              for i in ${daemon_inst}; do
-                 if [ -n "$inst" -a "$inst" = "$i" ]; then
-                      started "$1" "log" || failed_status=$?
-                 elif [ -z "$inst" ]; then
-                      started "$daemon_name-$i" "log" || failed_status=$?
-                 fi
-              done
-           else
-               started "$daemon_name" "log" || failed_status=$?
-           fi
-        fi
-    done
-
-    # All daemons that need to have been started are up and running
-    return $failed_status
-}
-
-#########################################################
-#               Main program                            #
-#########################################################
-
-# Config broken but script must exit silently.
-[ ! -r "$C_PATH/daemons" ] && exit 0
-
-# Load configuration
-. "$C_PATH/daemons"
-. "$C_PATH/debian.conf"
-
-# Read configuration variable file if it is present
-[ -r /etc/default/quagga ] && . /etc/default/quagga
-
-MAX_INSTANCES=${MAX_INSTANCES:=5}
-
-# Set priority of un-startable daemons to 'no' and substitute 'yes' to '0'
-convert_daemon_prios
-
-if [ ! -d $V_PATH ]; then
-    echo "Creating $V_PATH"
-    mkdir -p $V_PATH
-    chown quagga:quagga $V_PATH
-    chmod 755 /$V_PATH
-fi
-
-if [ -n "$3" ] && [ "$3" != "all" ]; then
-   dmn="$2"-"$3"
-elif [ -n "$2" ] && [ "$2" != "all" ]; then
-   dmn="$2"
-fi
-
-case "$1" in
-    start)
-        # Try to load this necessary (at least for 2.6) module.
-        if [ -d /lib/modules/`uname -r` ] ; then
-          echo "Loading capability module if not yet done."
-          set +e; LC_ALL=C modprobe -a capability 2>&1 | egrep -v "(not found|Can't locate)"; set -e
-        fi
-
-        # Start all daemons
-        cd $C_PATH/
-        if [ "$2" != "watchquagga" ]; then
-          start_prio 10 $dmn
-        fi
-        vtysh_b
-        start_watchquagga
-        ;;
-        
-    1|2|3|4|5|6|7|8|9|10)
-        # Stop/start daemons for the appropriate priority level
-        stop_prio $1
-        start_prio $1
-        vtysh_b
-        ;;
-
-    stop|0)
-        # Stop all daemons at level '0' or 'stop'
-        stop_watchquagga
-        if [ "$dmn" != "watchquagga" ]; then
-         [ -n "${dmn}" ] && eval "${dmn/-/_}=0"
-          stop_prio 0 $dmn
-        fi
-
-        if [ -z "$dmn" -o "$dmn" = "zebra" ]; then
-          echo "Removing all routes made by zebra."
-          ip route flush proto zebra
-       else
-         [ -n "$dmn" ] && eval "${dmn/-/_}=0"
-         start_watchquagga
-        fi
-        ;;
-
-    reload)
-       # Just apply the commands that have changed, no restart necessary
-       [ ! -x "$RELOAD_SCRIPT" ] && echo "quagga-reload script not available" && exit 0
-       NEW_CONFIG_FILE="${2:-$C_PATH/Quagga.conf}"
-       [ ! -r $NEW_CONFIG_FILE ] && echo "Unable to read new configuration file $NEW_CONFIG_FILE" && exit 1
-       echo "Applying only incremental changes to running configuration from Quagga.conf"
-       "$RELOAD_SCRIPT" --reload /etc/quagga/Quagga.conf
-       exit $?
-       ;;
-
-    status)
-        check_status $dmn
-        exit $?
-        ;;
-
-    restart|force-reload)
-        $0 stop $dmn
-        sleep 1
-        $0 start $dmn
-        ;;
-
-    *)
-        echo "Usage: /etc/init.d/quagga {start|stop|status|reload|restart|force-reload|<priority>} [daemon]"
-        echo "       E.g. '/etc/init.d/quagga 5' would start all daemons with a prio 1-5."
-       echo "       reload applies only modifications from the running config to all daemons."
-       echo "       reload neither restarts starts any daemon nor starts any new ones."
-        echo "       Read /usr/share/doc/quagga/README.Debian for details."
-        exit 1
-        ;;
-esac
-
-exit 0
index 5fd9e5c0fa684e1304135ddfd3d4ff2638900f43..24a579d7c06a98a297ea5b5446dc4340c7907f9c 100644 (file)
@@ -18,3 +18,5 @@ usr/share/man/man8/watchquagga.8
 usr/share/snmp/mibs/
 cumulus/etc/* etc/
 debian/watchquagga.rc   etc/cumulus/ssmonitor.d
+debian/*.service    lib/systemd/system
+debian/quagga.conf  usr/lib/tmpfiles.d
diff --git a/debian/quagga.service b/debian/quagga.service
new file mode 100644 (file)
index 0000000..6936666
--- /dev/null
@@ -0,0 +1,34 @@
+[Unit]
+Description=Cumulus Linux Quagga convenience service
+After=networking.service syslog.service
+
+[Service]
+EnvironmentFile=-/etc/default/quagga
+Type=simple
+RemainAfterExit=yes
+TimeoutSec=2m30s
+TimeoutStopSec=1m
+ExecStartPre=-/bin/systemctl start zebra.service
+ExecStartPre=-/bin/systemctl start babeld.service
+ExecStartPre=-/bin/systemctl start bgpd.service
+ExecStartPre=-/bin/systemctl start isisd.service
+ExecStartPre=-/bin/systemctl start ospfd.service
+ExecStartPre=-/bin/systemctl start ospf6d.service
+ExecStartPre=-/bin/systemctl start ripd.service
+ExecStartPre=-/bin/systemctl start ripngd.service
+ExecStartPost=-/usr/bin/vtysh -b -n
+#
+ExecStart=/bin/true
+ExecStop=/bin/true
+#
+ExecStopPost=-/bin/systemctl stop babeld.service
+ExecStopPost=-/bin/systemctl stop bgpd.service
+ExecStopPost=-/bin/systemctl stop isisd.service
+ExecStopPost=-/bin/systemctl stop ospfd.service
+ExecStopPost=-/bin/systemctl stop ospf6d.service
+ExecStopPost=-/bin/systemctl stop ripd.service
+ExecStopPost=-/bin/systemctl stop ripngd.service
+ExecStopPost=-/bin/systemctl stop zebra.service
+
+[Install]
+WantedBy=network.target
diff --git a/debian/ripd.service b/debian/ripd.service
new file mode 100644 (file)
index 0000000..eed5dbc
--- /dev/null
@@ -0,0 +1,20 @@
+[Unit]
+Description=RIP routing daemon
+After=syslog.target networking.service zebra.service
+OnFailure=heartbeat-failed@%n.service
+
+[Service]
+Nice=-5
+Type=notify
+EnvironmentFile=/etc/default/quagga
+StartLimitInterval=3m
+StartLimitBurst=3
+TimeoutSec=1m
+WatchdogSec=60s
+RestartSec=5
+Restart=on-abnormal
+LimitNOFILE=1024
+ExecStart=/usr/lib/quagga/ripd $RIPD_OPTIONS
+ExecStartPost=/usr/bin/vtysh -b -n
+[Install]
+WantedBy=network.target
diff --git a/debian/ripngd.service b/debian/ripngd.service
new file mode 100644 (file)
index 0000000..93413cd
--- /dev/null
@@ -0,0 +1,20 @@
+[Unit]
+Description=RIP routing daemon for IPv6
+After=syslog.target networking.service zebra.service
+OnFailure=heartbeat-failed@%n.service
+
+[Service]
+Nice=-5
+Type=notify
+EnvironmentFile=/etc/default/quagga
+StartLimitInterval=3m
+StartLimitBurst=3
+TimeoutSec=1m
+WatchdogSec=60s
+RestartSec=5
+Restart=on-abnormal
+LimitNOFILE=1024
+ExecStart=/usr/lib/quagga/ripngd $RIPNGD_OPTIONS
+ExecStartPost=/usr/bin/vtysh -b -n
+[Install]
+WantedBy=network.target
index 295b471416b63cdc9a73c7db0fb41181c0d9bc87..7b284f60d5390a45753378658171e6526dc17371 100755 (executable)
@@ -66,6 +66,7 @@ override_dh_auto_configure:
                --enable-werror \
                --enable-gcc-rdynamic \
                --with-libpam \
+               --enable-systemd \
                --enable-dependency-tracking; \
        fi
        if ! diff -b -IHAVE_SNMP -IHAVE_NETSNMP -IUCD_COMPAT -IGETIFADDR debian/my/config.h.reference config.h; then \
@@ -112,3 +113,25 @@ override_dh_auto_install:
        # cleaning .la files
        sed -i "/dependency_libs/ s/'.*'/''/" debian/tmp/usr/lib/*.la
 
+override_dh_systemd_start:
+       dh_systemd_start quagga.service
+       dh_systemd_start babeld.service
+       dh_systemd_start bgpd.service
+       dh_systemd_start isisd.service
+       dh_systemd_start ospfd.service
+       dh_systemd_start ospf6d.service
+       dh_systemd_start ripd.service
+       dh_systemd_start ripngd.service
+       dh_systemd_start zebra.service
+
+override_dh_systemd_enable:
+       dh_systemd_enable --no-enable quagga.service
+       dh_systemd_enable --no-enable babeld.service
+       dh_systemd_enable --no-enable bgpd.service
+       dh_systemd_enable --no-enable isisd.service
+       dh_systemd_enable --no-enable ospfd.service
+       dh_systemd_enable --no-enable ospf6d.service
+       dh_systemd_enable --no-enable ripd.service
+       dh_systemd_enable --no-enable ripngd.service
+       dh_systemd_enable --no-enable zebra.service
+
diff --git a/debian/zebra.service b/debian/zebra.service
new file mode 100644 (file)
index 0000000..3fa4043
--- /dev/null
@@ -0,0 +1,20 @@
+[Unit]
+Description=Cumulus Linux Quagga Zebra Daemon
+After=network.service syslog.service
+OnFailure=heartbeat-failed@%n.service
+
+[Service]
+Nice=-5
+EnvironmentFile=/etc/default/quagga
+Type=notify
+StartLimitInterval=3m
+StartLimitBurst=3
+TimeoutSec=1m
+WatchdogSec=60s
+RestartSec=5
+Restart=on-abnormal
+LimitNOFILE=1024
+ExecStart=/usr/lib/quagga/zebra $ZEBRA_OPTIONS
+ExecStartPost=/usr/bin/vtysh -b -n
+[Install]
+WantedBy=network.target