diff options
-rw-r--r-- | setup-interfaces.in | 6 | ||||
-rwxr-xr-x | 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 } + +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 +} |