]> git.proxmox.com Git - mirror_ifupdown2.git/commitdiff
debian: install sysvinit script (Fixes: #26)
authorJulien Fortin <julien@cumulusnetworks.com>
Thu, 17 Jan 2019 03:22:26 +0000 (11:22 +0800)
committerJulien Fortin <julien@cumulusnetworks.com>
Thu, 17 Jan 2019 04:26:47 +0000 (12:26 +0800)
Fixes github issue #26 and debian bug #918775

Reported-by: Joerg Dorchain <joerg@dorchain.net>
Signed-off-by: Julien Fortin <julien@cumulusnetworks.com>
Co-authored-by: Joerg Dorchain <joerg@dorchain.net>
Co-authored-by: Julien Fortin <julien@cumulusnetworks.com>
debian/changelog
debian/networking.init [new file with mode: 0644]
debian/rules
etc/init.d/networking [deleted file]

index 44b69854103c8a0e3e7c8aa31a848abb85124662..0dfc055b24db076c90e257c17e9dd3cdc34e860e 100644 (file)
@@ -1,5 +1,6 @@
 ifupdown2 (1.2.5-1) unstable; urgency=medium
 
+  * Fix: debian: install sysvinit script (closes: #918775)
   * Fix: debian: postinst: remove diversion after upgrade from stretch
          (closes: #919443)
 
diff --git a/debian/networking.init b/debian/networking.init
new file mode 100644 (file)
index 0000000..b52bfdc
--- /dev/null
@@ -0,0 +1,222 @@
+#!/bin/bash
+### BEGIN INIT INFO
+# Provides:          networking ifupdown
+# Required-Start:    mountkernfs $local_fs urandom
+# Required-Stop:     $local_fs
+# Default-Start:     S
+# Default-Stop:      0 6
+# Short-Description: Raise network interfaces.
+# Description:       Prepare /run/network directory, ifstate file and raise network interfaces, or take them down.
+### END INIT INFO
+
+RUN_DIR="/run/network"
+IFSTATE_LOCKFILE="${RUN_DIR}/ifstatelock"
+
+STATE_DIR="/var/tmp/network"
+IFSTATE_FILE="${STATE_DIR}/ifstatenew"
+
+NAME=networking
+SCRIPTNAME=/etc/init.d/$NAME
+
+[ -x /sbin/ifup ] || exit 0
+[ -x /sbin/ifdown ] || exit 0
+
+. /lib/lsb/init-functions
+
+CONFIGURE_INTERFACES=yes
+
+EXTRA_ARGS=
+
+[ -f /etc/default/networking ] && . /etc/default/networking
+
+[ "$VERBOSE" = yes ] && EXTRA_ARGS=-v
+[ "$DEBUG" = yes ] && EXTRA_ARGS="$EXTRA_ARGS -d"
+[ "$SYSLOG" = yes ] && EXTRA_ARGS="$EXTRA_ARGS --syslog"
+
+gen_examples() {
+    # Generate sample interfaces file. The interfaces files are
+    # generated under /usr/share/doc/ifupdown2/examples/
+    #
+
+    # generate files only at boot
+    [ -f ${IFSTATE_LOCKFILE} ] && return
+
+    python_ifupdown2_docdir="/usr/share/doc/ifupdown2"
+    swpfile=${python_ifupdown2_docdir}"/examples/swp_defaults"
+    bridgedefaultfile=${python_ifupdown2_docdir}"/examples/bridge_untagged_default"
+    interfaces_gen_script=${python_ifupdown2_docdir}"/examples/generate_interfaces.py"
+
+    [ ! -e $interfaces_gen_script ] && return
+    ret=$($interfaces_gen_script -s 2>&1 >$swpfile)
+    ret=$($interfaces_gen_script -b 2>&1 >$bridgedefaultfile)
+    return
+}
+
+perf_options() {
+    # At bootup lets set perfmode
+    [ -f ${IFSTATE_LOCKFILE} ] && echo -n "" && return
+
+    echo -n "--perfmode"
+}
+
+process_exclusions() {
+    set -- $EXCLUDE_INTERFACES
+    exclusions=""
+    for d
+    do
+       exclusions="-X $d $exclusions"
+    done
+    echo $exclusions
+}
+
+check_network_file_systems() {
+    [ -e /proc/mounts ] || return 0
+
+    if [ -e /etc/iscsi/iscsi.initramfs ]; then
+       log_warning_msg "not deconfiguring network interfaces: iSCSI root is mounted."
+       exit 0
+    fi
+
+    while read DEV MTPT FSTYPE REST; do
+       case $DEV in
+       /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
+           log_warning_msg "not deconfiguring network interfaces: network devices still mounted."
+           exit 0
+           ;;
+       esac
+       case $FSTYPE in
+       nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
+           log_warning_msg "not deconfiguring network interfaces: network file systems still mounted."
+           exit 0
+           ;;
+       esac
+    done < /proc/mounts
+}
+
+check_network_swap() {
+    [ -e /proc/swaps ] || return 0
+
+    while read DEV MTPT FSTYPE REST; do
+       case $DEV in
+       /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
+           log_warning_msg "not deconfiguring network interfaces: network swap still mounted."
+           exit 0
+           ;;
+       esac
+    done < /proc/swaps
+}
+
+ifup_hotplug () {
+    if [ -d /sys/class/net ]
+    then
+           ifaces=$(for iface in $(ifquery --list --allow=hotplug 2>/dev/null)
+                           do
+                                   link=${iface##:*}
+                                   link=${link##.*}
+                                   if [ -e "/sys/class/net/$link" ] && [ "$(cat /sys/class/net/$link/operstate)" = up ]
+                                   then
+                                           echo "$iface"
+                                   fi
+                           done)
+           if [ -n "$ifaces" ]
+           then
+               ifup $ifaces "$@" || true
+           fi
+    fi
+}
+
+ifupdown_init() {
+       # remove state file at boot
+       [ ! -e ${IFSTATE_LOCKFILE} ] && rm -f ${IFSTATE_FILE}
+       [ ! -e /run/network ] && mkdir -p /run/network &>/dev/null
+       [ ! -e /etc/network/run ] && \
+               ln -sf /run/network /etc/network/run &>/dev/null
+}
+
+case "$1" in
+start)
+       gen_examples
+       ifupdown_init
+       if [ "$CONFIGURE_INTERFACES" = no ]
+       then
+           log_action_msg "Not configuring network interfaces, see /etc/default/networking"
+           exit 0
+       fi
+       set -f
+       exclusions=$(process_exclusions)
+       perfoptions=$(perf_options)
+       log_action_begin_msg "Configuring network interfaces"
+       ifup -a $EXTRA_ARGS $exclusions $perfoptions
+       log_action_end_msg $?
+       ;;
+
+stop)
+       if [ "$SKIP_DOWN_AT_SYSRESET" = "yes" ]; then
+               shutdown_or_reboot=$(runlevel 2>/dev/null | \
+                                    /usr/bin/tr -s " " | \
+                                    /usr/bin/cut -d " " \
+                                    -f1- --output-delimiter=$'\n' | \
+                                    /bin/grep -e "0" -e "6")
+               if [ -n "$shutdown_or_reboot" ]; then
+                       log_action_begin_msg "Deconfiguring network interfaces..skip"
+                       log_action_end_msg 0
+                       exit 0
+               fi
+       fi
+       ifupdown_init
+       check_network_file_systems
+       check_network_swap
+       exclusions=$(process_exclusions)
+
+       log_action_begin_msg "Deconfiguring network interfaces"
+       ifdown -a $EXTRA_ARGS $exclusions
+       log_action_end_msg $?
+       ;;
+
+reload)
+
+       ifupdown_init
+       log_action_begin_msg "Reloading network interfaces configuration"
+
+       ifreload -a $EXTRA_ARGS
+       log_action_end_msg $?
+       ;;
+
+reload-currently-up)
+
+       ifupdown_init
+       log_action_begin_msg "Reloading currently up network interfaces configuration"
+
+       ifreload --currently-up $EXTRA_ARGS
+       log_action_end_msg $?
+       ;;
+
+force-reload)
+
+       ifupdown_init
+
+       log_action_begin_msg "Reloading network interfaces configuration"
+       ifreload -f -a $EXTRA_ARGS
+       log_action_end_msg $?
+       ;;
+
+restart)
+       ifupdown_init
+
+       set -f
+       exclusions=$(process_exclusions)
+       log_action_begin_msg "Reconfiguring network interfaces"
+       ifdown -a $EXTRA_ARGS $exclusions || true
+       ifup -a $EXTRA_ARGS $exclusions
+       log_action_end_msg $?
+       ;;
+
+*)
+       echo "Usage: /etc/init.d/networking {start|stop|reload|restart|force-reload}"
+       exit 1
+       ;;
+esac
+
+exit 0
+
+# vim: noet ts=8
index 9560f7fc7678e7944b9ace5c88cf60373549919e..363560029d4892b91126c1e137f3542e66fe91f6 100755 (executable)
@@ -17,5 +17,8 @@ override_dh_systemd_start:
 override_dh_systemd_enable:
        dh_systemd_enable --name=networking
 
+override_dh_installinit:
+       dh_installinit --name=networking --no-start
+
 override_dh_compress:
        dh_compress -X.py
diff --git a/etc/init.d/networking b/etc/init.d/networking
deleted file mode 100644 (file)
index b52bfdc..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-#!/bin/bash
-### BEGIN INIT INFO
-# Provides:          networking ifupdown
-# Required-Start:    mountkernfs $local_fs urandom
-# Required-Stop:     $local_fs
-# Default-Start:     S
-# Default-Stop:      0 6
-# Short-Description: Raise network interfaces.
-# Description:       Prepare /run/network directory, ifstate file and raise network interfaces, or take them down.
-### END INIT INFO
-
-RUN_DIR="/run/network"
-IFSTATE_LOCKFILE="${RUN_DIR}/ifstatelock"
-
-STATE_DIR="/var/tmp/network"
-IFSTATE_FILE="${STATE_DIR}/ifstatenew"
-
-NAME=networking
-SCRIPTNAME=/etc/init.d/$NAME
-
-[ -x /sbin/ifup ] || exit 0
-[ -x /sbin/ifdown ] || exit 0
-
-. /lib/lsb/init-functions
-
-CONFIGURE_INTERFACES=yes
-
-EXTRA_ARGS=
-
-[ -f /etc/default/networking ] && . /etc/default/networking
-
-[ "$VERBOSE" = yes ] && EXTRA_ARGS=-v
-[ "$DEBUG" = yes ] && EXTRA_ARGS="$EXTRA_ARGS -d"
-[ "$SYSLOG" = yes ] && EXTRA_ARGS="$EXTRA_ARGS --syslog"
-
-gen_examples() {
-    # Generate sample interfaces file. The interfaces files are
-    # generated under /usr/share/doc/ifupdown2/examples/
-    #
-
-    # generate files only at boot
-    [ -f ${IFSTATE_LOCKFILE} ] && return
-
-    python_ifupdown2_docdir="/usr/share/doc/ifupdown2"
-    swpfile=${python_ifupdown2_docdir}"/examples/swp_defaults"
-    bridgedefaultfile=${python_ifupdown2_docdir}"/examples/bridge_untagged_default"
-    interfaces_gen_script=${python_ifupdown2_docdir}"/examples/generate_interfaces.py"
-
-    [ ! -e $interfaces_gen_script ] && return
-    ret=$($interfaces_gen_script -s 2>&1 >$swpfile)
-    ret=$($interfaces_gen_script -b 2>&1 >$bridgedefaultfile)
-    return
-}
-
-perf_options() {
-    # At bootup lets set perfmode
-    [ -f ${IFSTATE_LOCKFILE} ] && echo -n "" && return
-
-    echo -n "--perfmode"
-}
-
-process_exclusions() {
-    set -- $EXCLUDE_INTERFACES
-    exclusions=""
-    for d
-    do
-       exclusions="-X $d $exclusions"
-    done
-    echo $exclusions
-}
-
-check_network_file_systems() {
-    [ -e /proc/mounts ] || return 0
-
-    if [ -e /etc/iscsi/iscsi.initramfs ]; then
-       log_warning_msg "not deconfiguring network interfaces: iSCSI root is mounted."
-       exit 0
-    fi
-
-    while read DEV MTPT FSTYPE REST; do
-       case $DEV in
-       /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
-           log_warning_msg "not deconfiguring network interfaces: network devices still mounted."
-           exit 0
-           ;;
-       esac
-       case $FSTYPE in
-       nfs|nfs4|smbfs|ncp|ncpfs|cifs|coda|ocfs2|gfs|pvfs|pvfs2|fuse.httpfs|fuse.curlftpfs)
-           log_warning_msg "not deconfiguring network interfaces: network file systems still mounted."
-           exit 0
-           ;;
-       esac
-    done < /proc/mounts
-}
-
-check_network_swap() {
-    [ -e /proc/swaps ] || return 0
-
-    while read DEV MTPT FSTYPE REST; do
-       case $DEV in
-       /dev/nbd*|/dev/nd[a-z]*|/dev/etherd/e*)
-           log_warning_msg "not deconfiguring network interfaces: network swap still mounted."
-           exit 0
-           ;;
-       esac
-    done < /proc/swaps
-}
-
-ifup_hotplug () {
-    if [ -d /sys/class/net ]
-    then
-           ifaces=$(for iface in $(ifquery --list --allow=hotplug 2>/dev/null)
-                           do
-                                   link=${iface##:*}
-                                   link=${link##.*}
-                                   if [ -e "/sys/class/net/$link" ] && [ "$(cat /sys/class/net/$link/operstate)" = up ]
-                                   then
-                                           echo "$iface"
-                                   fi
-                           done)
-           if [ -n "$ifaces" ]
-           then
-               ifup $ifaces "$@" || true
-           fi
-    fi
-}
-
-ifupdown_init() {
-       # remove state file at boot
-       [ ! -e ${IFSTATE_LOCKFILE} ] && rm -f ${IFSTATE_FILE}
-       [ ! -e /run/network ] && mkdir -p /run/network &>/dev/null
-       [ ! -e /etc/network/run ] && \
-               ln -sf /run/network /etc/network/run &>/dev/null
-}
-
-case "$1" in
-start)
-       gen_examples
-       ifupdown_init
-       if [ "$CONFIGURE_INTERFACES" = no ]
-       then
-           log_action_msg "Not configuring network interfaces, see /etc/default/networking"
-           exit 0
-       fi
-       set -f
-       exclusions=$(process_exclusions)
-       perfoptions=$(perf_options)
-       log_action_begin_msg "Configuring network interfaces"
-       ifup -a $EXTRA_ARGS $exclusions $perfoptions
-       log_action_end_msg $?
-       ;;
-
-stop)
-       if [ "$SKIP_DOWN_AT_SYSRESET" = "yes" ]; then
-               shutdown_or_reboot=$(runlevel 2>/dev/null | \
-                                    /usr/bin/tr -s " " | \
-                                    /usr/bin/cut -d " " \
-                                    -f1- --output-delimiter=$'\n' | \
-                                    /bin/grep -e "0" -e "6")
-               if [ -n "$shutdown_or_reboot" ]; then
-                       log_action_begin_msg "Deconfiguring network interfaces..skip"
-                       log_action_end_msg 0
-                       exit 0
-               fi
-       fi
-       ifupdown_init
-       check_network_file_systems
-       check_network_swap
-       exclusions=$(process_exclusions)
-
-       log_action_begin_msg "Deconfiguring network interfaces"
-       ifdown -a $EXTRA_ARGS $exclusions
-       log_action_end_msg $?
-       ;;
-
-reload)
-
-       ifupdown_init
-       log_action_begin_msg "Reloading network interfaces configuration"
-
-       ifreload -a $EXTRA_ARGS
-       log_action_end_msg $?
-       ;;
-
-reload-currently-up)
-
-       ifupdown_init
-       log_action_begin_msg "Reloading currently up network interfaces configuration"
-
-       ifreload --currently-up $EXTRA_ARGS
-       log_action_end_msg $?
-       ;;
-
-force-reload)
-
-       ifupdown_init
-
-       log_action_begin_msg "Reloading network interfaces configuration"
-       ifreload -f -a $EXTRA_ARGS
-       log_action_end_msg $?
-       ;;
-
-restart)
-       ifupdown_init
-
-       set -f
-       exclusions=$(process_exclusions)
-       log_action_begin_msg "Reconfiguring network interfaces"
-       ifdown -a $EXTRA_ARGS $exclusions || true
-       ifup -a $EXTRA_ARGS $exclusions
-       log_action_end_msg $?
-       ;;
-
-*)
-       echo "Usage: /etc/init.d/networking {start|stop|reload|restart|force-reload}"
-       exit 1
-       ;;
-esac
-
-exit 0
-
-# vim: noet ts=8