summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup-alpine.in2
-rwxr-xr-xtests/setup_alpine_test26
2 files changed, 26 insertions, 2 deletions
diff --git a/setup-alpine.in b/setup-alpine.in
index c1634c1..952d7da 100644
--- a/setup-alpine.in
+++ b/setup-alpine.in
@@ -152,7 +152,7 @@ if [ "$rc_sys" != LXC ]; then
if is_virtual_console || [ -n "$KEYMAPOPTS" ]; then
setup-keymap ${KEYMAPOPTS}
fi
- setup-hostname ${HOSTNAMEOPTS} && rc-service hostname --quiet restart
+ setup-hostname ${HOSTNAMEOPTS} && [ -z "$SSH_CONNECTION" ] && rc-service hostname --quiet restart
setup-devd -C mdev # just to bootstrap
fi
diff --git a/tests/setup_alpine_test b/tests/setup_alpine_test
index 1bde901..903d220 100755
--- a/tests/setup_alpine_test
+++ b/tests/setup_alpine_test
@@ -5,7 +5,8 @@ init_tests \
setup_alpine_usage \
setup_alpine_quick \
setup_alpine_create_answerfile \
- setup_alpine_kvm_clock
+ setup_alpine_kvm_clock \
+ setup_alpine_restart_network
setup_alpine_usage_body() {
test_usage setup-alpine
@@ -23,6 +24,11 @@ setup_alpine_quick_body() {
-o match:"openrc default" \
-e empty \
setup-alpine -q
+
+ atf_check -s exit:0 \
+ rc-service --quiet hostname status
+ atf_check -s exit:0 \
+ rc-service --quiet networking status
}
setup_alpine_create_answerfile_body() {
@@ -84,3 +90,21 @@ setup_alpine_kvm_clock_body() {
-o not-match:"Which NTP client to run" \
setup-alpine -e < answers
}
+
+setup_alpine_restart_network_body() {
+ init_env
+ mkdir -p sys/class/net/lo sys/class/net/eth0
+ echo 1 >sys/class/net/lo/ifindex
+ echo 2 >sys/class/net/eth0/ifindex
+ echo down >sys/class/net/lo/operstate
+ echo down >sys/class/net/eth0/operstate
+
+ SSH_CONNECTION="::1 54984 ::1 22" atf_check -s exit:0 \
+ -o match:"openrc boot" \
+ -e empty \
+ setup-alpine -q
+ atf_check -s exit:3 \
+ rc-service --quiet hostname status
+ atf_check -s exit:3 \
+ rc-service --quiet networking status
+}