From 970db2474f94f73b5c5a5ede89c6310df21ef758 Mon Sep 17 00:00:00 2001 From: Natanael Copa Date: Tue, 5 Jul 2022 17:44:21 +0200 Subject: setup-interfaces: don't install legacy vlan package Don't install vlan package if ifupdown-ng package is used. Add tests for this. fixes https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10495 --- setup-interfaces.in | 6 +++++- tests/setup_interfaces_test | 51 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 55 insertions(+), 2 deletions(-) diff --git a/setup-interfaces.in b/setup-interfaces.in index f1e98eb..fe4dac3 100644 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -504,7 +504,11 @@ prompt_for_interfaces() { echo -e "\tvlan-raw-device $raw_device" >> interfaces fi case "$iface" in - *.[0-9]*|vlan[0-9]*) PKGS="$PKGS vlan";; + *.[0-9]*|vlan[0-9]*) + if ! [ -f "$ROOT"usr/libexec/ifupdown-ng/link ]; then + PKGS="$PKGS vlan" + fi + ;; esac case $type in manual) diff --git a/tests/setup_interfaces_test b/tests/setup_interfaces_test index c09968c..a2e03d6 100755 --- a/tests/setup_interfaces_test +++ b/tests/setup_interfaces_test @@ -4,7 +4,9 @@ init_tests \ setup_interfaces_usage \ setup_interfaces_interactive_dhcp \ - setup_interfaces_interactive_vlan + setup_interfaces_interactive_vlan \ + setup_interfaces_interactive_vlan_ng \ + setup_interfaces_interactive_vlan0_ng setup_interfaces_usage_body() { test_usage setup-interfaces @@ -53,3 +55,50 @@ setup_interfaces_interactive_vlan_body() { -o match:"apk add.*vlan" \ setup-interfaces answers + atf_check -s exit:0 \ + -o not-match:"apk add.*vlan" \ + setup-interfaces answers + atf_check -s exit:0 \ + -o match:"Available raw devices are: eth0" \ + -o not-match:"apk add.*vlan" \ + setup-interfaces