~alpine/devel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[alpine-devel] [PATCH] main/tinc: fixed init scripts

Details
Message ID
<1402136467-23144-1-git-send-email-developer@it-offshore.co.uk>
Sender timestamp
1402136467
DKIM signature
missing
Download raw message
Patch: +17 -14
This patch fixes an init script bug which caused 'restart' to fail
& which sometimes could only be cleared by a reboot (--localstatedir
was set as /usr/var so the pid was never found).

I changed 'stop' to use the start-stop-daemon as in tinc 1.1pre10 there
is no longer an option to --kill. Message for an already stopped daemon
corrected.

For the same reason I also changed 'reload' to use kill -1 $pid.
---
 main/tinc/APKBUILD       | 15 ++++++++-------
 main/tinc/tincd.initd    |  7 ++++---
 main/tinc/tincd.lo.initd |  9 +++++----
 3 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/main/tinc/APKBUILD b/main/tinc/APKBUILD
index ff98ecc..97674b3 100644
--- a/main/tinc/APKBUILD
+++ b/main/tinc/APKBUILD
@@ -1,7 +1,7 @@
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=tinc
pkgver=1.0.24
pkgrel=0
pkgrel=1
pkgdesc="tinc is a Virtual Private Network (VPN) daemon"
url="http://www.tinc-vpn.org/"
arch="all"
@@ -35,6 +35,7 @@ build() {
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--enable-jumbograms \
		--enable-lzo \
		--enable-zlib \
@@ -56,16 +57,16 @@ package() {

md5sums="14a91eb2e85bdc0451a815612521b708  tinc-1.0.24.tar.gz
f2c913659191a0c81ed13dde305ca8bc  musl.patch
411a260ed9bb1fc441444c3efbeafd7b  tincd.initd
b95471eab010c0ed002cf3d16a009ced  tincd.lo.initd
91eef72fcab95d91bf7fdebe9f1b8156  tincd.initd
db453729063ce9fe435dd31fdc7cd3af  tincd.lo.initd
475d64d9aa410ec7e91f5b079800abc9  tinc.networks"
sha256sums="498e58f9f39e3922030a63cf62baf4b46a40fbda8d90b23ec0f084f4a9f9b687  tinc-1.0.24.tar.gz
a394327605fa38e1b7bbbb49eda6461c96553d31370107e337482934ea8b042c  musl.patch
0e8a18f9af03d967b30eac2c1de5d233449fae8a97342cdb88bf60e6b3867e73  tincd.initd
bd0909202c2f5b6fb0d97cac4f7f02a392393acd4b300a04db3a5416f4345035  tincd.lo.initd
a3892d88164e9113adb7bbe917994946df058364b797f9f6e3ae8692ef7ca1fd  tincd.initd
0ac4ca95e17a81a6275a5d9504883394eaf65045ab0c8f2b69d17ffdd30d3359  tincd.lo.initd
7165721abd3706c95973118fbb503e18f9a008da6bdbf21a4ce35ecf7818d5ad  tinc.networks"
sha512sums="a59d4f996892b9aa4ce6adaf3f40c06dfb37c2546edb6b3858af15df7f4e6f7738dc186969df1676ad1dab7fcc081bec262bd9df4efc7620e00ca9be9121bc7d  tinc-1.0.24.tar.gz
2a631b82e2d24139e8bf07057578d3f8e7f566829492cbbb82d030505ba00fe63943c57778156bca6985ab216e7b0d5ad8aeb25f7d7affa3189b7b3a005d0312  musl.patch
4a5da677d030dd24d347a86e7e892ea9aab57c2b4de8c9fa6ef576e239e4169f3ee6934162edc004a00678405f199606f05c173dd1ff94ee2f711536b1dfc072  tincd.initd
63df032f815b4a1e84c972e4cbfe115eda9fb80419b21d72811a947a8c9742f51442b5a06b0dbd220eb9a673b115fe62972019bdd4bac5855a36908c68bf5638  tincd.lo.initd
6ae745adee3208c269a95f5e54e8b362f6ace6424757c1c2ce67af9396be0f1719c611e941038778b6dc0611464922c8b3173cb26fdc772d9be28646589f7907  tincd.initd
affdc60fb45e33e0fa994ceed813a3a1f3a2cf087cf87d30da8ca6184c8a9215680c598bdfbb0a5669993a4f165440479d2e97bd10029f318f44264c4e5998a0  tincd.lo.initd
f7cb459c170898e51176bd92c642335386db90b7bca2abb3f6eb2514546efbd74e5fd2c8845060111dd48a0dd2cc1890717a03315c9b86185047c259cdc27135  tinc.networks"
diff --git a/main/tinc/tincd.initd b/main/tinc/tincd.initd
index 6ed1bef..c302f4f 100644
--- a/main/tinc/tincd.initd
+++ b/main/tinc/tincd.initd
@@ -4,6 +4,7 @@
# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd,v 1.5 2008/04/01 14:08:45 dragonheart Exp $

extra_started_commands="reload"
daemon=/usr/sbin/tincd

depend() {
	use logger dns
@@ -29,7 +30,7 @@ start() {
			eerror "Cannot start network $TINCNET, /etc/tinc/$TINCNET/tinc.conf does not exist !"
		else
			ebegin "Starting tinc network $TINCNET"
			/usr/sbin/tincd --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid
			$daemon --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid
			eend $?
		fi
	done
@@ -43,7 +44,7 @@ stop() {
		if [ -f /var/run/tinc."$TINCNET".pid ]
		then
			ebegin "Stopping tinc network $TINCNET"
			/usr/sbin/tincd --kill --pidfile=/var/run/tinc."$TINCNET".pid
			start-stop-daemon --stop --quiet --pidfile=/var/run/tinc.$TINCNET.pid --exec ${daemon}
			eend $?
		fi
	done
@@ -57,7 +58,7 @@ reload() {
		if [ -f /var/run/tinc."$TINCNET".pid ]
		then
			ebegin "Reloading tinc network $TINCNET"
			/usr/sbin/tincd --kill HUP  --pidfile=/var/run/tinc."$TINCNET".pid
			kill -1 $(awk '{ print $1 }' /var/run/tinc."$TINCNET".pid)
			eend $?
		fi
	done
diff --git a/main/tinc/tincd.lo.initd b/main/tinc/tincd.lo.initd
index afa0156..7ba43fd 100644
--- a/main/tinc/tincd.lo.initd
+++ b/main/tinc/tincd.lo.initd
@@ -4,6 +4,7 @@
# $Header: /var/cvsroot/gentoo-x86/net-misc/tinc/files/tincd.lo,v 1.1 2010/07/18 10:04:56 dragonheart Exp $

extra_started_commands="reload"
daemon=/usr/sbin/tincd

depend()
{
@@ -16,7 +17,7 @@ start()
	TINCNET=${RC_SVCNAME#*.}
	if [ -f /etc/tinc/"$TINCNET"/tinc.conf ] ; then
		ebegin "Starting tinc network $TINCNET"
		/usr/sbin/tincd --debug=1 --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid
		$daemon --debug=1 --net="$TINCNET" --logfile=/var/log/tinc.$TINCNET.log --pidfile=/var/run/tinc.$TINCNET.pid
		eend $?
	else
		eerror "Cannot start network $TINCNET, /etc/tinc/$TINCNET/tinc.conf does not exist !"
@@ -28,10 +29,10 @@ stop()
	TINCNET=${RC_SVCNAME#*.}
	if [ -f /var/run/tinc."$TINCNET".pid ] ; then
		ebegin "Stopping tinc network $TINCNET"
		/usr/sbin/tincd --kill --pidfile=/var/run/tinc."$TINCNET".pid
		start-stop-daemon --stop --quiet --pidfile=/var/run/tinc.$TINCNET.pid --exec ${daemon}
		eend $?
	else
		eerror "Cannot start network $TINCNET, /etc/tinc/$TINCNET/tinc.conf does not exist !"
		eindent "network $TINCNET has already been stopped"
	fi
}

@@ -40,7 +41,7 @@ reload()
	TINCNET=${RC_SVCNAME#*.}
	if [ -f /var/run/tinc."$TINCNET".pid ] ; then
		ebegin "Reloading configuration for tinc network $TINCNET"
		/usr/sbin/tincd --kill HUP --pidfile=/var/run/tinc."$TINCNET".pid
		kill -1 $(awk '{ print $1 }' /var/run/tinc."$TINCNET".pid)
		eend $?
	fi
}
-- 
1.9.1



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Natanael Copa <ncopa@alpinelinux.org>
Details
Message ID
<20140609105541.61993a48@ncopa-desktop.alpinelinux.org>
In-Reply-To
<1402136467-23144-1-git-send-email-developer@it-offshore.co.uk> (view parent)
Sender timestamp
1402304141
DKIM signature
missing
Download raw message
On Sat,  7 Jun 2014 10:21:07 +0000
Stuart Cardall <developer@it-offshore.co.uk> wrote:

> This patch fixes an init script bug which caused 'restart' to fail
> & which sometimes could only be cleared by a reboot (--localstatedir
> was set as /usr/var so the pid was never found).

ugh. good catch!

 
> I changed 'stop' to use the start-stop-daemon as in tinc 1.1pre10 there
> is no longer an option to --kill. Message for an already stopped daemon
> corrected.

Why are we not using start-stop-daemon for start?

Can we reuse the gentoo init.d scripts?

http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/tinc/files/tincd?revision=1.9
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/net-misc/tinc/files/tincd.lo?revision=1.5&view=markup


> For the same reason I also changed 'reload' to use kill -1 $pid.
> ---
>  main/tinc/APKBUILD       | 15 ++++++++-------
>  main/tinc/tincd.initd    |  7 ++++---
>  main/tinc/tincd.lo.initd |  9 +++++----
>  3 files changed, 17 insertions(+), 14 deletions(-)
> 
> diff --git a/main/tinc/APKBUILD b/main/tinc/APKBUILD
> index ff98ecc..97674b3 100644
> --- a/main/tinc/APKBUILD
> +++ b/main/tinc/APKBUILD
> @@ -1,7 +1,7 @@
>  # Maintainer: Natanael Copa <ncopa@alpinelinux.org>
>  pkgname=tinc
>  pkgver=1.0.24
> -pkgrel=0
> +pkgrel=1
>  pkgdesc="tinc is a Virtual Private Network (VPN) daemon"
>  url="http://www.tinc-vpn.org/"
>  arch="all"
> @@ -35,6 +35,7 @@ build() {
>  		--sysconfdir=/etc \
>  		--mandir=/usr/share/man \
>  		--infodir=/usr/share/info \
> +		--localstatedir=/var \
>  		--enable-jumbograms \
>  		--enable-lzo \
>  		--enable-zlib \

I applied the patch due to the above hunk and copied new version of init.d from gentoo.

Thanks!

-nc



---
Unsubscribe:  alpine-devel+unsubscribe@lists.alpinelinux.org
Help:         alpine-devel+help@lists.alpinelinux.org
---
Reply to thread Export thread (mbox)