systemd/debian/tests/ifupdown-hotplug
Martin Pitt 77fca23cb9 ifupdown-hotplug autopkgtest: Put back alternative *.cfg suffix
Older ifupdown versions apparently require a suffix, so provide a symlink for
it. Follow-up fix for 775ec4755.
2015-06-16 17:46:56 +02:00

48 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# check ifupdown integration for "allow-hotplug" interface
set -e
IFACE=sdtest42
if [ -e /sys/class/net/$IFACE ]; then
echo "SKIP: network interface $IFACE already exists"
exit 0
fi
cat <<EOF > /etc/network/interfaces.d/$IFACE
allow-hotplug $IFACE
iface $IFACE inet static
address 192.168.234.129
netmask 255.255.255.0
EOF
# older ifupdown versions expect a .cfg suffix
ln -s $IFACE /etc/network/interfaces.d/${IFACE}.cfg
# these should trigger uevents and ifup@.service
ip link add name $IFACE type veth peer name v$IFACE
trap "ip link del dev $IFACE; rm /etc/network/interfaces.d/$IFACE /etc/network/interfaces.d/${IFACE}.cfg" EXIT INT QUIT PIPE
sleep 3
# $IFACE is configured in ifupdown, should succeed and be up
systemctl status -l ifup@${IFACE}.service
ifquery --state $IFACE
OUT=$(ip a show dev $IFACE)
if ! echo "$OUT" | grep -q 'inet 192.168.234.129/24'; then
echo "interface $IFACE not configured" >&2
echo "$OUT" >&2
exit 1
fi
# v$IFACE is not configured in ifupdown, should be down
! ifquery --state v$IFACE
! systemctl status -l ifup@v${IFACE}.service
OUT=$(ip a show dev v$IFACE)
if echo "$OUT" | grep -q 'inet'; then
echo "interface $IFACE unexpectedly configured" >&2
echo "$OUT" >&2
exit 1
fi