Commit 8730da8a authored by Natanael Copa's avatar Natanael Copa
Browse files

setup-ntp: fix non-interactive -c option

We should not prompt user when -c is specified, in which case $1 is
empty.

fixes https://gitlab.alpinelinux.org/alpine/alpine-conf/-/issues/10522
parent 5e817570
......@@ -27,7 +27,7 @@ while getopts "hc:" opt; do
done
shift $(( $OPTIND - 1 ))
resp=$1
: ${resp:=$1}
while [ $# -eq 0 ] && ! isin "$resp" busybox openntpd chrony none abort; do
ask "Which NTP client to run? ('busybox', 'openntpd', 'chrony' or 'none')" chrony
......
......@@ -6,7 +6,9 @@ init_tests \
setup_ntp_invalid \
setup_ntp_busybox \
setup_ntp_chrony \
setup_ntp_openntpd
setup_ntp_openntpd \
setup_ntp_none \
setup_ntp_none_backwards_compat
setup_ntp_usage_body() {
test_usage setup-ntp
......@@ -43,3 +45,16 @@ setup_ntp_openntpd_body() {
-o match:"Starting openntpd" \
setup-ntp openntpd
}
setup_ntp_none_body() {
init_env
atf_check -s exit:0 \
setup-ntp none
}
setup_ntp_none_backwards_compat_body() {
init_env
atf_check -s exit:0 \
setup-ntp -c none
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment