summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2022-07-07 15:21:17 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2022-07-07 15:25:27 +0200
commit43f40624b4a74161e9bbca6fac2a17f24462230f (patch)
tree00be13cd759f4e8d988fc1c5605a768d02cebdd4 /tests
parenta6a50d89f9c01de6560aeecd4149c5c676c47361 (diff)
downloadalpine-conf-43f40624b4a74161e9bbca6fac2a17f24462230f.zip
setup-alpine: add ROOTSSHKEY to set ssh key for root
Allow setting root's ssh key from answer file Also add a test to verify that it gets included in lbu for disk install. ref commit 619f3a2d4de9 (setup-alpine: persist root authorized_keys)
Diffstat (limited to 'tests')
-rwxr-xr-xtests/setup_alpine_test10
1 files changed, 7 insertions, 3 deletions
diff --git a/tests/setup_alpine_test b/tests/setup_alpine_test
index 4b26a5d..7d008e0 100755
--- a/tests/setup_alpine_test
+++ b/tests/setup_alpine_test
@@ -34,20 +34,24 @@ setup_alpine_create_answerfile_body() {
mkdir -p usr/share/zoneinfo/
touch usr/share/zoneinfo/UTC
- sed -i -e 's/^USERSSHKEY=.*/USERSSHKEY="ssh-rsa blahbla user@example.com"/' \
- answers
+ echo 'USERSSHKEY="ssh-rsa blahbla user@example.com"/' >> answers
+ echo 'ROOTSSHKEY="ssh-rsa blahbla user@example.com"' >> answers
atf_check -s exit:0 \
-o match:"Starting hostname" \
-o match:"Starting mdev" \
-o match:"Added mirror" \
-o match:"adduser" \
- -o match:"apk add" \
+ -o match:"apk add.*openssh" \
setup-alpine -f answers
grep "ssh-rsa blahbla user@example.com" home/juser/.ssh/authorized_keys \
|| atf_fail "ssh key not set for juser"
+ grep "ssh-rsa blahbla user@example.com" root/.ssh/authorized_keys \
+ || atf_fail "ssh key not set for root"
grep home/juser etc/apk/protected_paths.d/lbu.list \
|| atf_fail "home/juser was not added to lbu.list"
+ grep root/.ssh etc/apk/protected_paths.d/lbu.list \
+ || atf_fail "root/.ssh was not added to lbu.list"
}
setup_alpine_kvm_clock_body() {