#!/bin/sh PREFIX=@PREFIX@ . "$PREFIX/lib/libalpine.sh" usage() { cat <<-__EOF__ usage: setup-ntp [-h] [-c choice of NTP daemon] Setup NTP time synchronization options: -h Show this help -c Choice of NTP daemon: busybox openntpd chrony none __EOF__ exit 1 } while getopts "hc:" opt; do case $opt in c) resp="$OPTARG";; h) usage;; esac done while ! isin "$resp" busybox openntpd chrony none abort; do ask "Which NTP client to run? ('busybox', 'openntpd', 'chrony' or 'none')" chrony done pkgs="$resp" case "$resp" in none|abort) exit 0 ;; busybox) pkgs='' svc=ntpd ;; chrony) if apk info --installed --quiet acf-core; then pkgs="$pkgs acf-chrony" fi svc=chronyd ;; openntpd) svc=openntpd ;; esac [ -z "$pkgs" ] || apk add --quiet $pkgs rc-update add $svc default rc-service $svc start