summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-05-23 12:09:05 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-05-23 12:09:05 +0200
commitec89c47bbb546ff5a69048f89af91245ec92dad3 (patch)
tree7de7df0e08acc7f82598a910ba8b724c25b1aee3
parentd9589b96528270488eaa02b601e868d11ff6d882 (diff)
downloadalpine-conf-ec89c47bbb546ff5a69048f89af91245ec92dad3.zip
setup-alpine: add simple test for quick install
-rw-r--r--setup-alpine.in11
-rwxr-xr-xtests/setup_alpine_test11
2 files changed, 16 insertions, 6 deletions
diff --git a/setup-alpine.in b/setup-alpine.in
index 1c41a5c..21a989b 100644
--- a/setup-alpine.in
+++ b/setup-alpine.in
@@ -179,8 +179,8 @@ for svc in $svc_list; do
done
# start up the services
-openrc boot
-openrc default
+$MOCK openrc boot
+$MOCK openrc default
# update /etc/hosts - after we have got dhcp address
# Get default fully qualified domain name from *first* domain
@@ -188,12 +188,13 @@ openrc default
_dn=$(sed -n \
-e '/^domain[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}' \
-e '/^search[[:space:]][[:space:]]*/{s///;s/\([^[:space:]]*\).*$/\1/;h;}' \
--e '${g;p;}' /etc/resolv.conf 2>/dev/null)
+-e '${g;p;}' "$ROOT"/etc/resolv.conf 2>/dev/null)
_hn=$(hostname)
_hn=${_hn%%.*}
-sed -i -e "s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/" /etc/hosts
+sed -i -e "s/^127\.0\.0\.1.*/127.0.0.1\t${_hn}.${_dn:-$(get_fqdn my.domain)} ${_hn} localhost.localdomain localhost/" \
+ "$ROOT"/etc/hosts 2>/dev/null
if [ -z "$quick" ]; then
setup-proxy -q ${PROXYOPTS}
@@ -240,6 +241,6 @@ if [ "$diskmode" != "sys" ]; then
setup-lbu ${LBUOPTS}
setup-apkcache ${APKCACHEOPTS}
if [ -L /etc/apk/cache ]; then
- apk cache sync
+ $MOCK apk cache sync
fi
fi
diff --git a/tests/setup_alpine_test b/tests/setup_alpine_test
index fc6f68d..4699df9 100755
--- a/tests/setup_alpine_test
+++ b/tests/setup_alpine_test
@@ -2,9 +2,18 @@
. $(atf_get_srcdir)/test_env.sh
init_tests \
- setup_alpine_usage
+ setup_alpine_usage \
+ setup_alpine_quick
setup_alpine_usage_body() {
test_usage setup-alpine
}
+setup_alpine_quick_body() {
+ init_env
+ atf_check -s exit:0 \
+ -o match:"openrc boot" \
+ -o match:"openrc default" \
+ -e empty \
+ setup-alpine -q
+}