diff --git a/templates/ntp/files/ntpd.cron-hourly b/templates/ntp/files/ntpd.cron-hourly new file mode 100644 index 00000000000..ca0f46bbb2a --- /dev/null +++ b/templates/ntp/files/ntpd.cron-hourly @@ -0,0 +1,12 @@ +#!/bin/sh +# +# Restarts ntpd if no connected peers are found. +# +ntpq_cmd=/usr/bin/ntpq +ntpd_initd=/etc/init.d/ntpd + +if [ ! -x $ntpq_cmd -o ! -x $ntpd_initd ]; then + exit 0 +fi + +$ntpq_cmd -np | grep '^\*' >/dev/null || (/etc/init.d/ntpd restart) diff --git a/templates/ntp/template b/templates/ntp/template index 7f47e50288c..755c1ef7ff7 100644 --- a/templates/ntp/template +++ b/templates/ntp/template @@ -1,6 +1,7 @@ # Template file for 'ntp' pkgname=ntp version=4.2.4p7 +revision=1 distfiles="http://archive.ntp.org/ntp4/$pkgname-$version.tar.gz" build_style=gnu_configure configure_args="--enable-linuxcaps --enable-getifaddrs=glibc @@ -20,19 +21,21 @@ conf_files="/etc/ntp.conf" openrc_services="ntpd default" Add_dependency full glibc +Add_dependency full readline Add_dependency full openssl Add_dependency full libcap -Add_dependency run ncurses-libs post_install() { install -d ${DESTDIR}/var/chroot/ntpd install -d ${DESTDIR}/etc/init.d ${DESTDIR}/etc/conf.d - install -d ${DESTDIR}/usr/share/ntp + install -d ${DESTDIR}/usr/share/ntp ${DESTDIR}/etc/cron.hourly install -d ${DESTDIR}/usr/share/doc/ntp install -m 644 ${FILESDIR}/ntpd.confd ${DESTDIR}/etc/conf.d/ntpd install -m 755 ${FILESDIR}/ntpd.rc ${DESTDIR}/etc/init.d/ntpd install -m 644 ${FILESDIR}/ntp.conf ${DESTDIR}/etc/ntp.conf + install -m 744 ${FILESDIR}/ntpd.cron-hourly \ + ${DESTDIR}/etc/cron.hourly/ntpd_recheck cp -a ${wrksrc}/html ${DESTDIR}/usr/share/doc/ntp cp -a ${wrksrc}/conf ${DESTDIR}/usr/share/ntp }