mirror of
https://github.com/CumulusNetworks/ifupdown2.git
synced 2024-05-06 15:54:50 +00:00
Remove /etc/init.d/networking after all - causes loops during image builds
Ticket: none Reviewed By: trivial Testing Done: installed, Alex tried for image creations. apparently with some of our packages like mstpd still using init.d for a while longer, just having the init.d/networking file causes the original complaints about loops between services. So I'm purging it completely. Also clean up the comments a bit in start-networking
This commit is contained in:
186
debian/networking.init
vendored
186
debian/networking.init
vendored
@@ -1,186 +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 1 6
|
||||
# Short-Description: Raise network interfaces.
|
||||
# Description: Prepare /run/network directory, ifstate file and raise network interfaces, or take them down.
|
||||
### END INIT INFO
|
||||
|
||||
PATH="/sbin:/bin"
|
||||
RUN_DIR="/run/network"
|
||||
IFSTATE="$RUN_DIR/ifstate"
|
||||
|
||||
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"
|
||||
|
||||
perf_options() {
|
||||
# At bootup lets set perfmode
|
||||
[ -f /var/tmp/network/ifstatenew ] && 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() {
|
||||
[ ! -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)
|
||||
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)
|
||||
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
|
4
debian/rules
vendored
4
debian/rules
vendored
@@ -17,7 +17,3 @@ override_dh_systemd_start:
|
||||
override_dh_systemd_enable:
|
||||
dh_systemd_enable --name=networking
|
||||
|
||||
# init.d/networking is installed, but we don't want any symlinks; it's
|
||||
# never used by anything, so avoid the confusion of the symlinks.
|
||||
override_dh_installinit:
|
||||
dh_installinit --name=networking --no-start -uremove networking.init
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
|
||||
# This overrides /etc/init.d/networking
|
||||
# This replaces the old init.d script, and is run from the networking.service
|
||||
# Only has start, stop, reload, because that's all systemd has.
|
||||
# restart is implemented in systemd by stop then start.
|
||||
|
||||
|
Reference in New Issue
Block a user