ntp: switch to systemd, drop openrc support.

This commit is contained in:
Juan RP 2011-10-11 03:04:44 +02:00
parent 2057dd4432
commit c1fa3c0138
8 changed files with 16 additions and 70 deletions

View file

@ -1,13 +0,0 @@
#
# This script creates required dirs for chroot initialization.
#
case "${ACTION}" in
post)
# Fix ntpd initialization with -i (chrooted).
if [ ! -d var/chroot/ntpd/var/db ]; then
mkdir -p var/chroot/ntpd/var/db
chown ntpd:ntpd /var/chroot/ntpd/var/db
fi
;;
esac

View file

@ -1,7 +1,6 @@
#
# This script removes dirs for chroot initialization.
#
case "${ACTION}" in
purge)
[ -d var/chroot/ntpd ] && rm -rf var/chroot/ntpd

View file

@ -1,6 +0,0 @@
# Configuration file for ntp.
#
# Comment the following line to NOT run ntpd(8) in a chroot
# as the ntpd user/group. NOT RECOMMENDED.
#
ntpd_chroot=/var/chroot/ntpd

View file

@ -1,12 +0,0 @@
#!/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)

View file

@ -2,6 +2,6 @@
missingok
sharedscripts
postrotate
/etc/init.d/ntpd reload >/dev/null 2>&1 || true
systemctl try-restart ntpd.service >/dev/null 2>&1 || true
endscript
}

View file

@ -1,26 +0,0 @@
#!/sbin/runscript
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
: ${ntpd_config:=/etc/ntp.conf}
: ${ntpd_drift:=/var/db/ntpd.drift}
command=/usr/bin/ntpd
required_files=$ntpd_config
pidfile=/var/run/ntpd.pid
command_args="$ntpd_args -c $ntpd_config -f $ntpd_drift -p $pidfile"
depend()
{
use dns
need localmount
after bootmisc ntp-client
}
start_pre()
{
if [ -n "$ntpd_chroot" ]; then
ln -fs "$ntpd_chroot$ntpd_drift" "$ntpd_drift"
command_args="$command_args -u ntpd:ntpd -i $ntpd_chroot"
fi
}

View file

@ -0,0 +1,9 @@
[Unit]
Description=Network Time Service
After=syslog.target
[Service]
ExecStart=/usr/bin/ntpd -n
[Install]
WantedBy=multi-user.target

View file

@ -1,7 +1,7 @@
# Template file for 'ntp'
pkgname=ntp
version=4.2.6p4
revision=1
revision=2
homepage="http://www.ntp.org/"
distfiles="http://www.eecis.udel.edu/~ntp/ntp_spool/ntp4/ntp-$version.tar.gz"
build_style=gnu_configure
@ -18,30 +18,25 @@ long_desc="
subpackages="$pkgname-perl"
conf_files="/etc/ntp.conf"
openrc_services="ntpd default true"
system_accounts="ntpd"
ntpd_homedir="/var/chroot/ntpd"
systemd_services="ntpd.service"
Add_dependency run glibc
Add_dependency run readline
Add_dependency run libssl
Add_dependency run libcap
Add_dependency build readline-devel
Add_dependency build openssl-devel
Add_dependency build libcap-devel
post_install()
{
vmkdir var/chroot/ntpd
vmkdir usr/share/ntp
vmkdir usr/share/doc/ntp
vinstall ${FILESDIR}/ntpd.confd 644 etc/conf.d ntpd
vinstall ${FILESDIR}/ntpd.rc 755 etc/init.d ntpd
vinstall ${FILESDIR}/ntpd.service 644 lib/systemd/system
vinstall ${FILESDIR}/ntp.conf 644 etc
vinstall ${FILESDIR}/ntpd.cron-hourly 744 etc/cron.hourly ntpd_recheck
vinstall ${FILESDIR}/ntpd.logrotate 644 etc/logrotate.d ntpd
vmkdir usr/share/ntp
vmkdir usr/share/doc/ntp
vcopy html usr/share/doc/ntp
vcopy conf usr/share/ntp
}