summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-07-05 17:44:21 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-07-05 17:50:29 +0200
commit970db2474f94f73b5c5a5ede89c6310df21ef758 (patch)
tree46ee404b5a81415f56f621691aa9e5de69e83abc
parent8ffc2ca8735b2d670614dea9bcccb1211ad7d213 (diff)
downloadalpine-conf-970db2474f94f73b5c5a5ede89c6310df21ef758.zip
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
-rw-r--r--setup-interfaces.in6
-rwxr-xr-xtests/setup_interfaces_test51
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
}
+
+setup_interfaces_interactive_vlan_ng_body() {
+ init_env
+ create_fake_ifaces lo eth0
+
+ mkdir -p usr/libexec/ifupdown-ng
+ touch usr/libexec/ifupdown-ng/link
+
+ (
+ # Which one do you want to initialize? (or '?' or 'done') [eth0]
+ echo eth0.5
+ # Ip address for eth0.5? (or 'dhcp', 'none', '?') [dhcp]
+ echo dhcp
+ # Which one do you want to initialize? (or '?' or 'done') [eth0]
+ echo done
+ # Do you want to do any manual network configuration? (y/n) [n]
+ echo n
+ )>answers
+ atf_check -s exit:0 \
+ -o not-match:"apk add.*vlan" \
+ setup-interfaces <answers
+}
+
+setup_interfaces_interactive_vlan0_ng_body() {
+ init_env
+ create_fake_ifaces lo eth0
+
+ mkdir -p usr/libexec/ifupdown-ng
+ touch usr/libexec/ifupdown-ng/link
+
+ (
+ # Which one do you want to initialize? (or '?' or 'done') [eth0]
+ echo vlan0
+ # Which one do you want use for vlan0? (or 'done') [eth0]
+ echo eth0
+ # Ip address for vlan0? (or 'dhcp', 'none', '?') [dhcp]
+ echo dhcp
+ # Which one do you want to initialize? (or '?' or 'done') [eth0]
+ echo done
+ # Do you want to do any manual network configuration? (y/n) [n]
+ echo n
+ )>answers
+ atf_check -s exit:0 \
+ -o match:"Available raw devices are: eth0" \
+ -o not-match:"apk add.*vlan" \
+ setup-interfaces <answers
+}