1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

debian: sync debian files with from upstream debian repo

These include changes that were done to move ifupdown2
to use pybuild and some debian policy fixes

Signed-off-by: Roopa Prabhu <roopa@cumulusnetworks.com>
This commit is contained in:
Roopa Prabhu
2015-12-14 16:26:31 -08:00
parent bd7d8f4a0e
commit 59dad2ca80
23 changed files with 310 additions and 143 deletions

5
debian/changelog vendored Normal file
View File

@@ -0,0 +1,5 @@
ifupdown2 (1.1) unstable; urgency=low
* Initial release.
-- Roopa Prabhu <roopa@cumulusnetworks.com> Thu, 20 Aug 2015 06:14:24 -0700

4
debian/clean vendored Normal file
View File

@@ -0,0 +1,4 @@
man/ifquery.8
man/ifreload.8
man/ifup.8
man/ifupdown-addons-interfaces.5

1
debian/compat vendored Normal file
View File

@@ -0,0 +1 @@
9

31
debian/control vendored Normal file
View File

@@ -0,0 +1,31 @@
Source: ifupdown2
Section: admin
Priority: optional
Maintainer: Roopa Prabhu <roopa@cumulusnetworks.com>
Standards-Version: 3.9.6
Build-Depends: python-setuptools, dh-python, python-all (>= 2.6.6-3), debhelper (>= 9~), python-docutils, dh-systemd
Homepage: https://github.com/CumulusNetworks/ifupdown2
X-Python-Version: >= 2.6
Package: ifupdown2
Architecture: all
Suggests: python-gvgen, python-mako
Replaces: ifupdown
Conflicts: ifupdown
Provides: ifupdown
Depends: ${python:Depends}, ${misc:Depends}, python-argcomplete, python-ipaddr
Description: Network Interface Management tool similar to ifupdown
ifupdown2 is ifupdown re-written in Python. It replaces ifupdown and provides
the same user interface as ifupdown for network interface configuration.
Like ifupdown, ifupdown2 is a high level tool to configure (or, respectively
deconfigure) network interfaces based on interface definitions in
/etc/network/interfaces. It is capable of detecting network interface
dependencies and comes with several new features which are available as
new command options to ifup/ifdown/ifquery commands. It also comes with a new
command ifreload to reload interface configuration with minimum
disruption. Most commands are also capable of input and output in JSON format.
It is backward compatible with ifupdown /etc/network/interfaces format and
supports newer simplified format. It also supports interface templates with
python-mako for large scale interface deployments. See
/usr/share/doc/ifupdown2/README.rst for details about ifupdown2. Examples
are available under /usr/share/doc/ifupdown2/examples.

12
debian/copyright vendored
View File

@@ -1,13 +1,16 @@
Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Upstream-Name: ifupdown2
Upstream-Contact: Roopa Prabhu <roopa@cumulusnetworks.com>, Sam Tannous <stannous@cumulusnetworks.com>
Source: http://www.cumulusnetworks.com
Files: *
Copyright: 2013 Cumulus Networks
Copyright: 2014 Cumulus Networks
License: GPL-2
Files: debian/*
Copyright: 2013 Cumulus Networks
Copyright: 2014 Cumulus Networks
License: GPL-2
License: GPL-2
This package is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -23,8 +26,3 @@ License: GPL-2
.
On Debian systems, the complete text of the GNU General
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
# Please also look if there are files or directories which have a
# different copyright/license attached and list them here.
# Please avoid to pick license terms that are more restrictive than the
# packaged work, as it may make Debian's contributions unacceptable upstream.

1
debian/ifupdown2.bash-completion vendored Normal file
View File

@@ -0,0 +1 @@
completion/ifup

1
debian/ifupdown2.dirs vendored Normal file
View File

@@ -0,0 +1 @@
/etc/network/interfaces.d/

1
debian/ifupdown2.docs vendored Normal file
View File

@@ -0,0 +1 @@
docs/README.rst

1
debian/ifupdown2.examples vendored Normal file
View File

@@ -0,0 +1 @@
docs/examples/*

2
debian/ifupdown2.install vendored Normal file
View File

@@ -0,0 +1,2 @@
sbin/ifupdown2 /usr/share/ifupdown2/
debian/networking.default /etc/default/networking

6
debian/ifupdown2.links vendored Normal file
View File

@@ -0,0 +1,6 @@
usr/share/ifupdown2/ifupdown2 sbin/ifup
usr/share/ifupdown2/ifupdown2 sbin/ifdown
usr/share/ifupdown2/ifupdown2 sbin/ifquery
usr/share/ifupdown2/ifupdown2 sbin/ifreload
usr/share/man/man8/ifup.8.gz usr/share/man/man8/ifdown.8.gz

5
debian/ifupdown2.manpages vendored Normal file
View File

@@ -0,0 +1,5 @@
man/ifup.8
man/ifquery.8
man/ifreload.8
man/ifupdown-addons-interfaces.5
man/interfaces.5

10
debian/ifupdown2.networking.service vendored Normal file
View File

@@ -0,0 +1,10 @@
[Unit]
Description=ifupdown2 init script
[Service]
Type=oneshot
ExecStart=/sbin/ifup -a
ExecStop=/sbin/ifdown -a
[Install]
WantedBy=multi-user.target

View File

@@ -43,30 +43,9 @@ report_err() { report "Error: $*" >&2 ; }
case "$1" in
configure)
# Create /etc/network/run
[ -d /run/network ] || mkdir -p /run/network
# for backward compatibility
if [ ! -f /etc/network/run ]; then
ln -sf /run/network /etc/network/run
fi
ln -sf /usr/share/python-ifupdown2/generate_interfaces.py \
/usr/share/doc/python-ifupdown2/examples/generate_interfaces.py
[ -d /etc/network/if-pre-up.d ] || mkdir -p /etc/network/if-pre-up.d
[ -d /etc/network/if-up.d ] || mkdir -p /etc/network/if-up.d
[ -d /etc/network/if-post-up.d ] || mkdir -p /etc/network/if-post-up.d
[ -d /etc/network/if-pre-down.d ] || mkdir -p /etc/network/if-pre-down.d
[ -d /etc/network/if-down.d ] || mkdir -p /etc/network/if-down.d
[ -d /etc/network/if-post-down.d ] || mkdir -p /etc/network/if-post-down.d
# Generic stuff done on all configurations
if [ -f /etc/network/interfaces ] ; then
# TODO: This should be handled with debconf and the script
# could introduce the line there directly
if ! grep -q "^[[:space:]]*iface[[:space:]]\+lo0\?[[:space:]]\+inet[[:space:]]\+loopback\>" /etc/network/interfaces ; then
report_warn "No 'iface lo' definition found in /etc/network/interfaces"
fi
@@ -85,30 +64,13 @@ case "$1" in
fi
fi
[ -e /sbin/ifup ] || ln -sf /sbin/ifupdown /sbin/ifup
[ -e /sbin/ifdown ] || ln -sf /sbin/ifupdown /sbin/ifdown
[ -e /sbin/ifquery ] || ln -sf /sbin/ifupdown /sbin/ifquery
[ -e /sbin/ifreload ] || ln -sf /sbin/ifupdown /sbin/ifreload
(cd /usr/share/man/man8/ && ln -sf /usr/share/man/man8/ifup.8.gz ifdown.8.gz)
mkdir -p /etc/network/interfaces.d/
process_udev
update-rc.d networking start 40 S . start 35 0 6 . >/dev/null
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
purge)
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View File

@@ -20,28 +20,26 @@ set -e
process_udev()
{
udevlink=$(readlink /etc/udev/rules.d/80-networking.rules 2>/dev/null || true)
[ -n "$udevlink" -a "$udevlink" = "/dev/null" ] && rm -f /etc/udev/rules.d/80-networking.rules
udevlink=$(readlink /etc/udev/rules.d/60-bridge-network-interface.rules 2>/dev/null || true)
[ -n "$udevlink" -a "$udevlink" = "/dev/null" ] && rm -f /etc/udev/rules.d/60-bridge-network-interface.rules
if [ -e /etc/udev/rules.d/80-networking.rules ]; then
udevlink=$(readlink /etc/udev/rules.d/80-networking.rules 2>/dev/null || true)
[ -n "$udevlink" -a "$udevlink" = "/dev/null" ] && rm -f /etc/udev/rules.d/80-networking.rules
fi
if [ -e /etc/udev/rules.d/60-bridge-network-interface.rules ]; then
udevlink=$(readlink /etc/udev/rules.d/60-bridge-network-interface.rules 2>/dev/null || true)
[ -n "$udevlink" -a "$udevlink" = "/dev/null" ] && rm -f /etc/udev/rules.d/60-bridge-network-interface.rules
fi
}
postrm_remove()
{
rm -f /sbin/ifup /sbin/ifdown /sbin/ifquery
process_udev
update-rc.d networking remove >/dev/null
}
# Note: We don't remove /etc/network/interfaces
postrm_purge()
{
rm -f /var/tmp/network/ifstatenew
if [ -L /etc/network/run ] ; then
rm -f /etc/network/run
elif [ -d /etc/network/run ] ; then
rmdir --ignore-fail-on-non-empty /etc/network/run
fi
rm -f /run/network/ifstatenew
}
case "$1" in

17
debian/networking.default vendored Normal file
View File

@@ -0,0 +1,17 @@
#
#
# Parameters for the /etc/init.d/networking script
#
#
# Change the below to yes if you want verbose logging to be enabled
VERBOSE="no"
# Change the below to yes if you want debug logging to be enabled
DEBUG="no"
# Change the below to yes if you want logging to go to syslog
SYSLOG="no"
# Exclude interfaces
EXCLUDE_INTERFACES=

186
debian/networking.init vendored Normal file
View File

@@ -0,0 +1,186 @@
#!/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

View File

@@ -1,56 +0,0 @@
#!/bin/sh
# preinst script for newpkg
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <new-preinst> `install'
# * <new-preinst> `install' <old-version>
# * <new-preinst> `upgrade' <old-version>
# * <old-preinst> `abort-upgrade' <new-version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
preinst_upgrade()
{
local oldver="$1"
local udev_user_rulesdir="/etc/udev/rules.d"
# we have to fixup the filesystem here as previous packages of
# ifupdown2 introduced a bug in the postrm script that require
# these files to exist, otherwise the postrm script will always
# fail.
local badver="0.1-cl2.5+2"
if dpkg --compare-versions "${oldver}" "lt" "${badver}"; then
local files="${udev_user_rulesdir}/80-networking.rules
${udev_user_rulesdir}/60-bridge-network-interface.rules"
for f in ${files}; do
echo "touching udev rule: ${f}"
test ! -e "${f}" && ln -s /dev/null "${f}" || \
/bin/echo -e "\tudev rule exists leaving"
done
fi
}
case "$1" in
install|upgrade)
preinst_upgrade "$2"
;;
abort-upgrade)
;;
*)
echo "preinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

16
debian/rules vendored Executable file
View File

@@ -0,0 +1,16 @@
#!/usr/bin/make -f
#export DH_VERBOSE=1
export PYBUILD_NAME=ifupdown2
export PYBUILD_INSTALL_ARGS=--install-lib=/usr/share/ifupdown2 --install-scripts=/usr/share/ifupdown2
%:
dh $@ --with python2 --buildsystem=pybuild
override_dh_installman:
./scripts/genmanpages.sh ./man.rst ./man
dh_installman
override_dh_installinit:
dh_systemd_enable --name=networking
dh_installinit --name=networking --no-start

1
debian/source/format vendored Normal file
View File

@@ -0,0 +1 @@
3.0 (native)

View File

@@ -1,39 +1,16 @@
from distutils.core import setup
setup(name='ifupdown2',
version='0.1',
version='1.1',
description = "ifupdown 2",
author='Roopa Prabhu',
author_email='roopa@cumulusnetworks.com',
url='cumulusnetworks.com',
packages=['ifupdown', 'ifupdownaddons'],
scripts = ['sbin/ifupdown'],
install_requires = ['python-gvgen', 'python-argcomplete', 'python-ipaddr'],
data_files=[('share/man/man8/',
['man/ifup.8', 'man/ifquery.8', 'man/ifreload.8']),
('share/man/man5/',
['man/interfaces.5', 'man/ifupdown-addons-interfaces.5']),
('/etc/init.d/',
['init.d/networking']),
('/sbin/', ['sbin/ifupdown']),
('/etc/network/ifupdown2/',
data_files=[ ('/etc/network/ifupdown2/',
['config/ifupdown2.conf']),
('/etc/default/',
['config/networking']),
('/usr/share/python-ifupdown2/',
['docs/examples/generate_interfaces.py']),
('/usr/share/doc/python-ifupdown2/examples/',
['docs/examples/interfaces',
'docs/examples/interfaces_bridge_template_func',
'docs/examples/interfaces_with_template',
'docs/examples/interfaces_bridge_igmp_mstp']),
('/usr/share/doc/python-ifupdown2/examples/vlan_aware_bridges',
['docs/examples/vlan_aware_bridges/interfaces.basic',
'docs/examples/vlan_aware_bridges/interfaces.vlan_prune_and_access_ports',
'docs/examples/vlan_aware_bridges/interfaces.with_bonds',
'docs/examples/vlan_aware_bridges/interfaces.with_clag']),
('/etc/bash_completion.d/', ['completion/ifup']),
('/usr/share/ifupdownaddons/', ['addons/bridge.py',
('/usr/share/ifupdown2/addons/', ['addons/bridge.py',
'addons/bond.py', 'addons/vlan.py',
'addons/mstpctl.py', 'addons/address.py',
'addons/dhcp.py', 'addons/usercmds.py',
@@ -41,8 +18,8 @@ setup(name='ifupdown2',
'addons/addressvirtual.py', 'addons/vxlan.py',
'addons/link.py',
'addons/bridgevlan.py']),
('/var/lib/ifupdownaddons/', ['config/addons.conf']),
('/var/lib/ifupdownaddons/policy.d/', []),
('/etc/network/ifupdown2/', ['config/addons.conf']),
('/var/lib/ifupdown2/policy.d/', []),
('/etc/network/ifupdown2/policy.d/', [])
]
)