#!/bin/sh

. /etc/control.d/functions

CONFIG=/etc/chrony.conf
EXE=/etc/init.d/chrony

new_subst server \
	'^[[:space:]]*allow[[:space:]]' \
	's,^#\([[:space:]]*allow[[:space:]].*\),allow all,'
new_subst client \
	'^[[:space:]]*#allow[[:space:]]' \
	's,^\([[:space:]]*allow[[:space:]]\),#\1,'

new_help client "Comment out \"allow\" directive, see chrony.txt in docs"
new_help server "Uncomment or add \"allow all\" directive, see chrony.txt in docs"

new_summary "Network Time Protocol daemon Chrony"

is_builtin_mode "$*" ||
	[ "$*" != "`control_subst "$CONFIG" status`" ] || exit 0

control_subst "$CONFIG" "$*" || exit 1

is_builtin_mode "$*" ||
	[ ! -x "$EXE" ] || "$EXE" condrestart || exit 0
