diff options
-rw-r--r-- | setup-interfaces.in | 8 | ||||
-rwxr-xr-x | tests/setup_interfaces_test | 52 |
2 files changed, 57 insertions, 3 deletions
diff --git a/setup-interfaces.in b/setup-interfaces.in index fe4dac3..c5c683f 100644 --- a/setup-interfaces.in +++ b/setup-interfaces.in @@ -493,11 +493,15 @@ prompt_for_interfaces() { echo "auto $iface" >> interfaces echo "iface $iface inet $type" >> interfaces if [ -n "$bridge_ports" ]; then - PKGS="$PKGS bridge" + if ! [ -f "$ROOT"usr/libexec/ifupdown-ng/bridge ]; then + PKGS="$PKGS bridge" + fi echo -e "\tbridge-ports $bridge_ports" >> interfaces fi if [ -n "$bond_slaves" ]; then - PKGS="$PKGS bonding" + if ! [ -f "$ROOT"usr/libexec/ifupdown-ng/bond ]; then + PKGS="$PKGS bonding" + fi echo -e "\tbond-slaves $bond_slaves" >> interfaces fi if [ -n "$raw_device" ]; then diff --git a/tests/setup_interfaces_test b/tests/setup_interfaces_test index a2e03d6..e69517e 100755 --- a/tests/setup_interfaces_test +++ b/tests/setup_interfaces_test @@ -6,7 +6,9 @@ init_tests \ setup_interfaces_interactive_dhcp \ setup_interfaces_interactive_vlan \ setup_interfaces_interactive_vlan_ng \ - setup_interfaces_interactive_vlan0_ng + setup_interfaces_interactive_vlan0_ng \ + setup_interfaces_interactive_br0_ng \ + setup_interfaces_interactive_bond0_ng setup_interfaces_usage_body() { test_usage setup-interfaces @@ -102,3 +104,51 @@ setup_interfaces_interactive_vlan0_ng_body() { -o not-match:"apk add.*vlan" \ setup-interfaces <answers } + +setup_interfaces_interactive_br0_ng_body() { + init_env + create_fake_ifaces lo eth0 + + mkdir -p usr/libexec/ifupdown-ng + touch usr/libexec/ifupdown-ng/bridge + + ( + # Which one do you want to initialize? (or '?' or 'done') [eth0] + echo br0 + # Which port(s) do you want add to bridge br0? (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 bridge ports are: eth0" \ + -o not-match:"apk add.*bridge" \ + setup-interfaces <answers +} + +setup_interfaces_interactive_bond0_ng_body() { + init_env + create_fake_ifaces lo eth0 + + mkdir -p usr/libexec/ifupdown-ng + touch usr/libexec/ifupdown-ng/bond + + ( + # Which one do you want to initialize? (or '?' or 'done') [eth0] + echo bond0 + # Which slave(s) do you want add to bond0? (or 'done') [eth0] + echo eth0 + # Ip address for bond0? (or 'dhcp', 'none', '?') [dhcp] + echo dhcp + # Do you want to do any manual network configuration? (y/n) [n] + echo n + )>answers + atf_check -s exit:0 \ + -o match:"Available interfaces are: eth0" \ + -o not-match:"apk add.*bonding" \ + setup-interfaces <answers +} |