Mail archive
alpine-aports

[alpine-aports] [PATCH] main/openntpd: remove legacy stuff, cleanups

From: Valery Kartel <valery.kartel_at_gmail.com>
Date: Mon, 24 Apr 2017 15:58:55 +0300

cleanups in APKBUILD
remove legacy rc-scripts renaming
remove legacy ntp-user checks and creation.
make init-script like in opensmtpd
---
 main/openntpd/APKBUILD              | 34 +++++++++++-------------------
 main/openntpd/openntpd.confd        |  6 +-----
 main/openntpd/openntpd.initd        | 41 +++++++------------------------------
 main/openntpd/openntpd.post-upgrade |  7 -------
 main/openntpd/openntpd.pre-install  |  8 --------
 main/openntpd/openntpd.pre-upgrade  |  5 -----
 6 files changed, 20 insertions(+), 81 deletions(-)
 delete mode 100644 main/openntpd/openntpd.post-upgrade
 delete mode 100644 main/openntpd/openntpd.pre-install
 delete mode 100644 main/openntpd/openntpd.pre-upgrade
diff --git a/main/openntpd/APKBUILD b/main/openntpd/APKBUILD
index c964c5e581..7681d911ed 100644
--- a/main/openntpd/APKBUILD
+++ b/main/openntpd/APKBUILD
_at_@ -1,35 +1,24 @@
 # Maintainer: Natanael Copa <ncopa_at_alpinelinux.org>
 pkgname=openntpd
 pkgver=6.0_p1
-_myver=${pkgver/_/}
-pkgrel=3
+_pkgver=${pkgver/_/}
+pkgrel=4
 pkgdesc="Lightweight NTP server ported from OpenBSD"
 url="http://www.openntpd.org/"
 subpackages="openntpd-doc"
-depends=""
 makedepends="libressl-dev linux-headers bsd-compat-headers"
 arch="all"
 license="BSD"
-install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade"
-source="http://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/openntpd-$_myver.tar.gz
+options="!check"
+source="http://ftp.openbsd.org/pub/OpenBSD/OpenNTPD/$pkgname-$_pkgver.tar.gz
 	ntp-user.patch
-	openntpd.confd
-	openntpd.initd
+	$pkgname.confd
+	$pkgname.initd
 	"
-
-_builddir="$srcdir"/$pkgname-$_myver
-prepare() {
-	local i
-	cd "$_builddir"
-	for i in $source; do
-		case $i in
-		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
-		esac
-	done
-}
+builddir="$srcdir/$pkgname-$_pkgver"
 
 build() {
-	cd "$_builddir"
+	cd "$builddir"
 	./configure \
 		--build=$CBUILD \
 		--host=$CHOST \
_at_@ -43,14 +32,15 @@ build() {
 }
 
 package() {
-	cd "$_builddir"
+	cd "$builddir"
 	make install DESTDIR="$pkgdir" || return 1
 
 	mkdir -p "$pkgdir"/var/empty || return 1
-	install -Dm755 "$srcdir"/openntpd.initd \
+	install -Dm755 "$srcdir"/$pkgname.initd \
 		"$pkgdir"/etc/init.d/"$pkgname" || return 1
-	install -Dm644 "$srcdir"/openntpd.confd \
+	install -Dm644 "$srcdir"/$pkgname.confd \
 		"$pkgdir"/etc/conf.d/"$pkgname" || return 1
+	rmdir "$pkgdir"/var/run
 }
 
 md5sums="9388979cc2713551bfbdfb3864291abe  openntpd-6.0p1.tar.gz
diff --git a/main/openntpd/openntpd.confd b/main/openntpd/openntpd.confd
index 6b938dc766..ec002b74f5 100644
--- a/main/openntpd/openntpd.confd
+++ b/main/openntpd/openntpd.confd
_at_@ -1,7 +1,3 @@
-# /etc/conf.d/ntpd: config file for openntpd's ntpd
-
-NTPD_HOME=/var/empty
-
 # See ntpd(8) man page ... some popular options:
 #  -s   Set the time immediately at startup
-NTPD_OPTS=""
+#NTPD_OPTS=
diff --git a/main/openntpd/openntpd.initd b/main/openntpd/openntpd.initd
index e29beda628..dc9a9ae2bb 100644
--- a/main/openntpd/openntpd.initd
+++ b/main/openntpd/openntpd.initd
_at_@ -1,41 +1,14 @@
 #!/sbin/openrc-run
-# Copyright 1999-2004 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/net-misc/openntpd/files/openntpd.rc,v 1.7 2008/10/10 09:40:10 bangert Exp $
+
+name="NTP Server"
+command=/usr/sbin/ntpd
+command_args="-d $NTPD_OPTS"
+command_background=yes
+pidfile=/run/$RC_SVCNAME.pid
+required_files=/etc/ntpd.conf
 
 depend() {
 	need net
 	provide ntp-client
 	use dns logger
 }
-
-checkconfig() {
-	if [ ! -f /etc/ntpd.conf ] ; then
-		eerror "Could not find /etc/ntpd.conf!"
-		return 1
-	fi
-
-	if [ -x /usr/bin/getent ] ; then
-		if [ "`getent passwd ntp | cut -d: -f 6`" != "${NTPD_HOME}" ] ; then
-			eerror "Home directory of ntp needs to be ${NTPD_HOME}"
-			eerror "Please run 'usermod -d ${NTPD_HOME} ntp'"
-			return 1
-		fi
-	fi
-
-	return 0
-}
-
-start() {
-	checkconfig || return $?
-
-	ebegin "Starting ntpd"
-	start-stop-daemon --start --exec /usr/sbin/ntpd --name ntpd -- ${NTPD_OPTS}
-	eend $? "Failed to start ntpd"
-}
-
-stop() {
-	ebegin "Stopping ntpd"
-	start-stop-daemon --stop --exec /usr/sbin/ntpd --name ntpd --user root
-	eend $? "Failed to stop openntpd"
-}
diff --git a/main/openntpd/openntpd.post-upgrade b/main/openntpd/openntpd.post-upgrade
deleted file mode 100644
index 88f0fa97e2..0000000000
--- a/main/openntpd/openntpd.post-upgrade
+++ /dev/null
_at_@ -1,7 +0,0 @@
-#!/bin/sh
-
-for i in /run/openrc/started/ntpd /etc/runlevels/*/ntpd; do
-	if [ -L "$i" ]; then
-		mv "$i" "${i%/*}"/openntpd
-	fi
-done
diff --git a/main/openntpd/openntpd.pre-install b/main/openntpd/openntpd.pre-install
deleted file mode 100644
index 975bf543f0..0000000000
--- a/main/openntpd/openntpd.pre-install
+++ /dev/null
_at_@ -1,8 +0,0 @@
-#!/bin/sh
-
-# this user should be included in alpine-baselayout-1.2.
-# included here for backward compability.
-addgroup -S ntp 2>/dev/null
-adduser -S -D -H -h /var/empty -s /sbin/nologin -G ntp -g ntp ntp 2>/dev/null
-
-exit 0
diff --git a/main/openntpd/openntpd.pre-upgrade b/main/openntpd/openntpd.pre-upgrade
deleted file mode 100644
index 3b052db3ff..0000000000
--- a/main/openntpd/openntpd.pre-upgrade
+++ /dev/null
_at_@ -1,5 +0,0 @@
-#!/bin/sh
-
-if grep -q '^NTPD_HOME=' /etc/conf.d/ntpd 2>/dev/null; then
-	mv /etc/conf.d/ntpd /etc/conf.d/openntpd
-fi
-- 
2.12.2
---
Unsubscribe:  alpine-aports+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-aports+help_at_lists.alpinelinux.org
---
Received on Mon Apr 24 2017 - 15:58:55 GMT