summaryrefslogtreecommitdiff
path: root/community/openntpd
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-06-11 00:02:18 +0000
committerroot <root@rshg054.dnsready.net>2012-06-11 00:02:18 +0000
commit4714cec7e8367a7618b168d0db4bc085dbfaac8a (patch)
treeb1f3049ee78988b0db6ec69637a1ee37c8b63b3f /community/openntpd
parent7b2739f21a7ed0d52497fa381c9a2383e71ab7a8 (diff)
Mon Jun 11 00:02:18 UTC 2012
Diffstat (limited to 'community/openntpd')
-rw-r--r--community/openntpd/PKGBUILD20
-rwxr-xr-xcommunity/openntpd/openntpd21
-rw-r--r--community/openntpd/openntpd.install25
-rw-r--r--community/openntpd/openntpd.service10
-rw-r--r--community/openntpd/openntpd.tmpfiles1
5 files changed, 49 insertions, 28 deletions
diff --git a/community/openntpd/PKGBUILD b/community/openntpd/PKGBUILD
index 3d82658ca..5bddf7dca 100644
--- a/community/openntpd/PKGBUILD
+++ b/community/openntpd/PKGBUILD
@@ -1,4 +1,4 @@
-# $Id: PKGBUILD 68196 2012-03-18 22:40:01Z arodseth $
+# $Id: PKGBUILD 72171 2012-06-09 14:07:36Z dreisner $
# Maintainer: Vesa Kaihlavirta <vegai@iki.fi>
# Contributor: Mark Rosenstand <mark@borkware.net>
# Contributor: Giorgio Lando <patroclo7@gmail.com> (adjtimex patch)
@@ -6,7 +6,7 @@
pkgname=openntpd
pkgver=3.9p1
-pkgrel=14
+pkgrel=15
pkgdesc="Free, easy to use implementation of the Network Time Protocol."
url="http://www.openntpd.org/"
arch=('x86_64' 'i686')
@@ -15,11 +15,13 @@ depends=('openssl')
backup=('etc/ntpd.conf' 'etc/conf.d/openntpd')
install=$pkgname.install
source=(ftp://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/$pkgname-$pkgver.tar.gz
- 'openntpd' 'openntpd.conf' 'linux-adjtimex.patch')
+ 'openntpd' 'openntpd.conf' 'linux-adjtimex.patch' 'openntpd.tmpfiles' 'openntpd.service')
sha256sums=('83dd7c1e8ec8b4567afe49af539271b5a73562fb7a3ca51df73eccba89ec8c49'
- '14b08ad387b4e16293c43386f25758699461b8b57afe41a49cc795a5e517f71e'
+ 'b486b7034b8d3d790b6bc1793dd8a44c68b82c8dc833b617c60674b0a7c9d98f'
'77a0d1f3439d779c2ce259becf3fa583c21a16682a4f5327094da2e9837f6f96'
- '3abcec94c072b5913ef7156a22049d796ff04e19105befe1ea81a66522928fd2')
+ '3abcec94c072b5913ef7156a22049d796ff04e19105befe1ea81a66522928fd2'
+ 'fe12841110c3c080519e248988c4b6334f54bd9646b015753c7e15de2a9600c5'
+ 'b54b88cb0fe35636405e2b09744633cd815edb3e8c864035bcdb05f727858f53')
build() {
cd "$srcdir/$pkgname-$pkgver"
@@ -30,7 +32,7 @@ build() {
--prefix=/usr \
--sysconfdir=/etc \
--with-privsep-user=ntp \
- --with-privsep-path=/var/run/openntpd/ \
+ --with-privsep-path=/run/openntpd/ \
--with-adjtimex
make
}
@@ -44,6 +46,12 @@ package() {
install -Dm644 "$srcdir/$pkgname-$pkgver/LICENCE" \
"$pkgdir/usr/share/licenses/$pkgname/LICENCE"
sed -i 's/\*/0.0.0.0/' $pkgdir/etc/ntpd.conf
+
+ install -Dm644 "$srcdir/openntpd.tmpfiles" "$pkgdir/usr/lib/tmpfiles.d/openntpd.conf"
+ install -Dm644 "$srcdir/openntpd.service" "$pkgdir/usr/lib/systemd/system/openntpd.service"
+
+ # avoid conflict with filesystem>=2012.06
+ rm -r "$pkgdir/run"
}
# vim:set ts=2 sw=2 et:
diff --git a/community/openntpd/openntpd b/community/openntpd/openntpd
index 0e630736c..59fa8107d 100755
--- a/community/openntpd/openntpd
+++ b/community/openntpd/openntpd
@@ -1,32 +1,27 @@
#!/bin/bash
CONF=/etc/conf.d/openntpd
-RUNDIR=/var/run/openntpd
. /etc/rc.conf
. /etc/rc.d/functions
+[[ -f $CONF ]] && . "$CONF"
-[ -f $CONF ] && . $CONF
-
-PID=`pidof -o %PPID /usr/sbin/ntpd`
-case "$1" in
+PID=$(pidof -o %PPID /usr/sbin/ntpd)
+case $1 in
start)
stat_busy "Starting OpenNTPD"
- [ -d $RUNDIR ] || mkdir $RUNDIR
- [ -z "$PID" ] && /usr/sbin/ntpd $PARAMS
- if [ $? -gt 0 ]; then
+ [[ -d /run/openntpd ]] || mkdir /run/openntpd
+ if [[ $PID ]] || ! /usr/sbin/ntpd $PARAMS; then
stat_fail
else
- PID=`pidof -o %PPID /usr/sbin/ntpd`
- echo $PID >/var/run/openntpd.pid
+ pidof -o %PPID /usr/sbin/ntpd >/run/openntpd.pid
add_daemon openntpd
stat_done
fi
;;
stop)
stat_busy "Stopping OpenNTPD"
- [ ! -z "$PID" ] && kill $PID &>/dev/null
- if [ $? -gt 0 ]; then
+ if [[ -z $PID ]] || ! kill $PID &>/dev/null; then
stat_fail
else
rm_daemon openntpd
@@ -38,6 +33,6 @@ case "$1" in
$0 start
;;
*)
- echo "usage: $0 {start|stop|restart}"
+ echo "usage: $0 {start|stop|restart}"
esac
exit 0
diff --git a/community/openntpd/openntpd.install b/community/openntpd/openntpd.install
index 99223f355..42063ef21 100644
--- a/community/openntpd/openntpd.install
+++ b/community/openntpd/openntpd.install
@@ -1,17 +1,24 @@
-post_install() {
- if [ ! "`grep ^ntp /etc/group`" ]; then
- echo "adding new group: ntp"
- /usr/sbin/groupadd -g 87 ntp
+createuser() {
+ if ! getent group ntp >/dev/null; then
+ groupadd -g 87 ntp
fi
-
- if [ ! "`grep ^ntp /etc/passwd`" ]; then
- echo "adding new user: ntp"
- /usr/sbin/useradd -g ntp -u 87 -d /var/empty -s /bin/false -c 'Network Time Protocol' ntp
+
+ if ! getent passwd ntp >/dev/null; then
+ useradd -g ntp -u 87 -d /var/empty -s /bin/false -c 'Network Time Protocol' ntp
fi
}
+post_install() {
+ createuser
+ systemd-tmpfiles --create /usr/lib/tmpfiles.d/openntpd.conf
+}
+
post_upgrade() {
- post_install $1
+ createuser
+}
+
+post_remove() {
+ userdel ntp >/dev/null
}
# vim: ts=2 sw=2 et ft=sh
diff --git a/community/openntpd/openntpd.service b/community/openntpd/openntpd.service
new file mode 100644
index 000000000..db76531d1
--- /dev/null
+++ b/community/openntpd/openntpd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=OpenNTP Daemon
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/sbin/ntpd
+
+[Install]
+WantedBy=multi-user.target
diff --git a/community/openntpd/openntpd.tmpfiles b/community/openntpd/openntpd.tmpfiles
new file mode 100644
index 000000000..3a34146fc
--- /dev/null
+++ b/community/openntpd/openntpd.tmpfiles
@@ -0,0 +1 @@
+d /run/openntpd 0755 root root -