]>
git.proxmox.com Git - ifupdown-pve.git/blob - debian/tests/hotplug
2 # check behaviour of "allow-hotplug" interface
7 if [ -e /sys
/class
/net
/$IFACE ]; then
8 echo "SKIP: network interface $IFACE already exists"
12 # different kinds of installs/images have different conventions; e. g.
13 # cloud-init sources *.cfg, a Debian desktop sources only prefix-less files
14 if grep -q 'source-directory .*interfaces.d' /etc
/network
/interfaces
; then
15 IFACE_CFG
=/etc
/network
/interfaces.d
/${IFACE}
16 elif grep -q 'source .*interfaces.d.*cfg' /etc
/network
/interfaces
; then
17 IFACE_CFG
=/etc
/network
/interfaces.d
/${IFACE}.cfg
19 echo "SKIP: /etc/network/interfaces does not include interfaces.d/"
23 cat <<EOF > $IFACE_CFG
25 iface $IFACE inet static
26 address 192.168.234.129
30 # these should trigger uevents and ifup@.service
31 ip link add name
$IFACE type veth peer name v
$IFACE
32 trap "ip link del dev $IFACE; rm $IFACE_CFG" EXIT INT QUIT PIPE
36 # $IFACE is configured in ifupdown, should succeed and be up
37 ifquery
--state $IFACE
38 if [ -d /run
/systemd
/system
]; then
39 systemctl status
-l ifup@
${IFACE}.service
42 OUT
=$
(ip a show dev
$IFACE)
43 if ! echo "$OUT" |
grep -q 'inet 192.168.234.129/24'; then
44 echo "interface $IFACE not configured" >&2
49 # v$IFACE is not configured in ifupdown, should be down
50 ! ifquery
--state v
$IFACE
51 if [ -d /run
/systemd
/system
]; then
52 ! systemctl status
-l ifup@v
${IFACE}.service
55 OUT
=$
(ip a show dev v
$IFACE)
56 if echo "$OUT" |
grep -q 'inet'; then
57 echo "interface $IFACE unexpectedly configured" >&2