# $Id$

PortSystem 1.0

name			openntpd
version			3.9p1
revision		1
categories		net
license			ISC BSD
platforms		darwin
maintainers		nomaintainer
description		free, easy to use implementation of the Network Time Protocol
long_description	OpenNTPD is a free, easy to use implementation of the \
				Network Time Protocol. It provides the ability to sync the \
				local clock to remote NTP servers and can act as NTP server \
				itself, redistributing the local clock.

homepage		http://www.openntpd.org/
master_sites		openbsd:OpenNTPD
checksums	rmd160	c348004116c78810daa9451f15abcc26788949a8 \
		sha256	83dd7c1e8ec8b4567afe49af539271b5a73562fb7a3ca51df73eccba89ec8c49

platforms		darwin

startupitem.create	yes
startupitem.netchange	yes
startupitem.executable	${prefix}/sbin/ntpd -d -s -f ${prefix}/etc/ntpd.conf

configure.args	--mandir=${prefix}/share/man

pre-destroot {
	addgroup _ntp gid=[nextgid] users="_ntp"
	set gid [existsgroup _ntp]
	adduser _ntp gid=${gid} password={\*} uid=[nextuid] \
		home=${prefix}/var/db/ntpd shell=/usr/bin/false \
		realname=OpenNTPD\ Server
}

post-destroot	{
	file rename ${destroot}${prefix}/etc/ntpd.conf \
		${destroot}${prefix}/etc/ntpd.conf.sample

	xinstall -m 755 -d ${destroot}${prefix}/var/db/ntpd

	destroot.keepdirs ${destroot}${prefix}/var/db/ntpd
}

post-activate	{
	if {![file exists ${prefix}/etc/ntpd.conf]} {
		file copy ${prefix}/etc/ntpd.conf.sample ${prefix}/etc/ntpd.conf
	}
}

livecheck.type	regex
livecheck.url	http://www.openntpd.org/portable.html
livecheck.regex	(\\d+\.\\d+p\\d+)