#!/usr/bin/env /lib/runit/invoke-run
#Copyright: 2026 Aitor <aitor@genuen.org>
#License: CC0-1.0
#Comment: ported for runit-services testing (htpdate)

exec 2>&1
[ -f /etc/default/htpdate ] || exit 161
. /etc/default/htpdate
[ "${HTP_DAEMON:-}" = "no" ] && exit 161
command=/usr/sbin/htpdate
[ -x "$command" ] || exit 162
# Prefer -F for runit; drop -D from HTP_OPTIONS if present
opts=$(echo "${HTP_OPTIONS:--s}" | sed 's/-D//g')
exec $command -F $opts ${HTP_PROXY:-} ${HTP_SERVERS:-}
