Mail archive
alpine-devel

[alpine-devel] [PATCH] main/openntpd: mv {init.d,conf.d}/ntpd -> openntpd

From: Eivind Uggedal <eivind_at_uggedal.com>
Date: Mon, 17 Mar 2014 12:37:24 +0000

In preparation for ntpd init and conf script in
main/busybox-initscripts.

Handles migration of user edited /etc/conf.d/ntpd
and runlevel enablement.
---
 main/openntpd/APKBUILD              | 8 ++++----
 main/openntpd/openntpd.post-upgrade | 7 +++++++
 main/openntpd/openntpd.pre-upgrade  | 5 +++++
 3 files changed, 16 insertions(+), 4 deletions(-)
 create mode 100644 main/openntpd/openntpd.post-upgrade
 create mode 100644 main/openntpd/openntpd.pre-upgrade
diff --git a/main/openntpd/APKBUILD b/main/openntpd/APKBUILD
index 0b88c5660875..2f1675ba3ebc 100644
--- a/main/openntpd/APKBUILD
+++ b/main/openntpd/APKBUILD
_at_@ -2,10 +2,10 @@
 pkgname=openntpd
 pkgver=3.9_p1
 _myver=3.9p1
-pkgrel=10
+pkgrel=11
 pkgdesc="Lightweight NTP server ported from OpenBSD"
 url=http://www.openntpd.org/
-install=openntpd.pre-install
+install="$pkgname.pre-install $pkgname.pre-upgrade $pkgname.post-upgrade"
 
 subpackages="openntpd-doc"
 depends=
_at_@ -41,8 +41,8 @@ build() {
 package() {
 	cd "$srcdir/$pkgname-$_myver"
 	make install DESTDIR="$pkgdir"
-	install -Dm755 ../openntpd.initd "$pkgdir/etc/init.d/ntpd"
-	install -Dm644 ../openntpd.confd "$pkgdir/etc/conf.d/ntpd"
+	install -Dm755 ../openntpd.initd "$pkgdir/etc/init.d/$pkgname"
+	install -Dm644 ../openntpd.confd "$pkgdir/etc/conf.d/$pkgname"
 }
 
 md5sums="afc34175f38d08867c1403d9008600b3  openntpd-3.9p1.tar.gz
diff --git a/main/openntpd/openntpd.post-upgrade b/main/openntpd/openntpd.post-upgrade
new file mode 100644
index 000000000000..88f0fa97e2f4
--- /dev/null
+++ b/main/openntpd/openntpd.post-upgrade
_at_@ -0,0 +1,7 @@
+#!/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-upgrade b/main/openntpd/openntpd.pre-upgrade
new file mode 100644
index 000000000000..3b052db3fff7
--- /dev/null
+++ b/main/openntpd/openntpd.pre-upgrade
_at_@ -0,0 +1,5 @@
+#!/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
-- 
1.9.0
---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Mon Mar 17 2014 - 12:37:24 GMT