summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--setup-alpine.in7
-rwxr-xr-xtests/setup_alpine_test32
2 files changed, 36 insertions, 3 deletions
diff --git a/setup-alpine.in b/setup-alpine.in
index 2308f88..aea9d3f 100644
--- a/setup-alpine.in
+++ b/setup-alpine.in
@@ -158,14 +158,17 @@ fi
[ -z "$SSH_CONNECTION" ] && rst_if=1
if [ -n "$INTERFACESOPTS" ]; then
- printf "$INTERFACESOPTS" | setup-interfaces -i ${rst_if:+-r}
+ if [ "$INTERFACESOPTS" != none ]; then
+ printf "$INTERFACESOPTS" | setup-interfaces -i ${rst_if:+-r}
+ fi
else
setup-interfaces ${quick:+-a} ${rst_if:+-r}
fi
# setup up dns if no dhcp was configured
-grep '^iface.*dhcp' $ROOT/etc/network/interfaces > /dev/null ||\
+if [ -f "$ROOT"/etc/network/interfaces ] && ! grep -q '^iface.*dhcp' "$ROOT"/etc/network/interfaces; then
setup-dns ${DNSOPTS}
+fi
# set root password
if [ -z "$empty_root_password" ]; then
diff --git a/tests/setup_alpine_test b/tests/setup_alpine_test
index d7fbd87..014dd7d 100755
--- a/tests/setup_alpine_test
+++ b/tests/setup_alpine_test
@@ -6,7 +6,8 @@ init_tests \
setup_alpine_quick \
setup_alpine_create_answerfile \
setup_alpine_kvm_clock \
- setup_alpine_restart_network
+ setup_alpine_restart_network \
+ setup_alpine_answerfile_none
export WGETCONTENT="https://mirror.example.com"
setup_alpine_usage_body() {
@@ -109,3 +110,32 @@ setup_alpine_restart_network_body() {
atf_check -s exit:3 \
rc-service --quiet networking status
}
+
+setup_alpine_answerfile_none_body() {
+ init_env
+
+ cat >opts<<-EOF
+ KEYMAPOPTS=none
+ HOSTNAMEOPTS=alpine
+ INTERFACESOPTS=none
+ DNSOPTS=none
+ TIMEZONEOPTS=none
+ PROXYOPTS=none
+ NTPOPTS=none
+ APKREPOSOPTS=none
+ USEROPTS=none
+ SSHDOPTS=none
+ DISKOPTS=none
+ LBUOPTS=none
+ APKCACHEOPTS=none
+ EOF
+ atf_check -s exit:0 \
+ -o match:"apk add" \
+ setup-alpine -e -f opts
+ for i in etc/network/interfaces etc/resolv.conf; do
+ if [ -e "$i" ]; then
+ atf_fail "$i should not been created"
+ fi
+ done
+}
+