diff options
-rw-r--r-- | setup-alpine.in | 7 | ||||
-rwxr-xr-x | tests/setup_alpine_test | 32 |
2 files changed, 34 insertions, 5 deletions
diff --git a/setup-alpine.in b/setup-alpine.in index a49dd51..e1ab594 100644 --- a/setup-alpine.in +++ b/setup-alpine.in @@ -7,9 +7,8 @@ PREFIX=@PREFIX@ : ${LIBDIR=$PREFIX/lib} . "$LIBDIR/libalpine.sh" -is_qemu() { - grep -q "QEMU" /proc/cpuinfo \ - || strings /sys/firmware/dmi/tables/DMI 2>/dev/null | grep -q QEMU +is_kvm_clock() { + grep -q "kvm-clock" "$ROOT"sys/devices/system/clocksource/clocksource0/current_clocksource 2>/dev/null } is_virtual_console() { @@ -216,7 +215,7 @@ if [ -r "$ROOT/etc/profile" ]; then . "$ROOT/etc/profile" fi -if ! is_qemu && [ "$rc_sys" != "LXC" ] && [ "$quick" != 1 ]; then +if ! is_kvm_clock && [ "$rc_sys" != "LXC" ] && [ "$quick" != 1 ]; then setup-ntp ${NTPOPTS} fi diff --git a/tests/setup_alpine_test b/tests/setup_alpine_test index 826ea6e..4b26a5d 100755 --- a/tests/setup_alpine_test +++ b/tests/setup_alpine_test @@ -4,7 +4,8 @@ init_tests \ setup_alpine_usage \ setup_alpine_quick \ - setup_alpine_create_answerfile + setup_alpine_create_answerfile \ + setup_alpine_kvm_clock setup_alpine_usage_body() { test_usage setup-alpine @@ -49,4 +50,33 @@ setup_alpine_create_answerfile_body() { || atf_fail "home/juser was not added to lbu.list" } +setup_alpine_kvm_clock_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 + + mkdir -p sys/devices/system/clocksource/clocksource0 + echo kvm-clock > sys/devices/system/clocksource/clocksource0/current_clocksource + + echo "none" > answers + KEYMAPOPTS=none \ + HOSTNAMEOPTS=alpine \ + INTERFACESOPTS=done \ + DNSOPTS=none \ + TIMEZONEOPTS=none \ + PROXYOPTS=none \ + APKREPOSOPTS=none \ + USEROPTS=none \ + SSHDOPTS=none \ + DISKOPTS=none \ + LBUOPTS=none \ + APKCACHEOPTS=none \ + \ + atf_check -s exit:0 \ + -o not-match:"Which NTP client to run" \ + setup-alpine -e < answers +} |