This should do it

On Wed, Jul 23, 2014, at 09:00, Michael Stapelberg wrote:
> Hi Ondřej,
> 
> Ondřej Surý <ond...@debian.org> writes:
> > That's fair and I do commit to maintain this in the future as I intend
> > to
> > use this script in all my packages.
> Okay. I have merged this with
> http://anonscm.debian.org/gitweb/?p=collab-maint/init-system-helpers.git;a=commitdiff;h=04b58bebecb4867fe11b9bdda5283ab401e9437c
> 
> Note that systemd2init fails in its current form, though, because it
> assumes that the skeleton files are in $PWD. Can you send me a patch
> against the init-system-helpers git for that please?
> 
> -- 
> Best regards,
> Michael


-- 
Ondřej Surý <ond...@sury.org>
Knot DNS (https://www.knot-dns.cz/) – a high-performance DNS server
From 5930072e9d846d69739c72fc622421d1d9ebf26d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Sur=C3=BD?= <ond...@sury.org>
Date: Wed, 23 Jul 2014 07:21:48 -0400
Subject: [PATCH] Pull init script skeleton from debian/$NAME.init.skeleton or
 from /usr/share/dh-systemd

---
 systemd2init/systemd2init | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/systemd2init/systemd2init b/systemd2init/systemd2init
index c0b47f6..06c83f8 100755
--- a/systemd2init/systemd2init
+++ b/systemd2init/systemd2init
@@ -66,16 +66,20 @@ getenvironment() {
 [ -z "$1" ] && echo "usage: $0 <name>" && exit 1
 
 NAME=$1
+
 SYSTEMD_SERVICE="${NAME}.service"
 
 if [ -f /etc/redhat-release ]; then
 	WORKINGDIR="$(pwd)"
-	SKELETON=skeleton.redhat
+	SKELETON=/usr/share/dh-systemd/skeleton.redhat
 	OUTPUT=$WORKINGDIR/${NAME}.init
 	DEFAULT_PIDFILE="/var/run/\$NAME.pid"
 else
 	WORKINGDIR="$(pwd)/debian"
-	SKELETON=skeleton.debian
+	SKELETON=$WORKINGDIR/${NAME}.init.skeleton
+	if [ ! -f $SKELETON ]; then
+		SKELETON=/usr/share/dh-systemd/skeleton.debian
+	fi
 	OUTPUT=$WORKINGDIR/${NAME}.init
 	DEFAULT_PIDFILE="/run/\$NAME.pid"
 fi
-- 
2.0.1

Reply via email to