[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Upstart and sysvinit in packages - Policy needed



In data Saturday 12 February 2011 05:55:16, Joachim Breitner ha scritto:

>> I included some patches to have nodm gracefully uses the upstart job.

>> Since those patches permits to have both init scripts in the system, no
>> matter if upstart or sysvinit is used, a little more effort is required
>> to proper build this package.
 
> thanks for your patches. I applied them to the repo besides the patch
> 0005-Exit-from-the-sysvinit-script-to-use-the-upstart-job.patch. Is that
> code taken from some existing package?

I took the idea from discussion on bug #591791 and updated to work also with 
current sysvinit, that does currently not likes the syntax "--version".

I include again this patch to permits other people to follow the discussion 
there, but is just a matter of :

if [ -e "/etc/init/${NAME}.conf" ] && /sbin/telinit --version >/dev/null 2>&1 
| grep -qs upstart
then
	exit 0
fi

inside the sysvinit init script.

> I feel like the semantics of both
> upstart jobs and init scripts in one package should be the same across
> packages, so I’d rather see a common solution for that.

Yes, probably something better and simpler than my lines above should emerge 
from the discussion.

>> But I'm stuck as you are (in the git repo) because dh will refuse to add
>> an init.d script if an upstart job is available.
>> Any hints on how to neatly have both init script files on the binary
>> package?

> Maybe you could raise the issue on d-devel?

I CCed the bug in the policy that seems to be the best match for the 
discussion, anyway I'll CC also d-devel to have some help.

Even if all agrees that my code above is right (a thing that I cannot imagine 
to be true in any universe), if it vital that a policy is given for that 
issue.

I think it would be interesting for wheezy to easely permit an Admin to choose 
an alternate init system and to permit to package maintainer to carefully 
provide init script tailored for a particular system of interest.

Debhelper seems to not permit to have both, e.g., an upstart and a sysvinit 
script available in the package, although with a trick like the above 
mentioned one, the could happily live together in perfect armony, side by side 
on my wheezy.

-- 
ESC:wq

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

From f5f51aadd12c3053ad1bc7fee2253a3a5062aa5f Mon Sep 17 00:00:00 2001
From: Marco Amadori <amadorim@vdavda.com>
Date: Fri, 11 Feb 2011 15:45:27 +0100
Subject: [PATCH 5/6] Exit from the sysvinit script to use the upstart job.

---
 debian/changelog |    3 ++-
 debian/nodm.init |    6 ++++++
 2 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index faa6817..c9711ab 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,8 +6,9 @@ nodm (0.7-2) UNRELEASED; urgency=low
 
   [ Marco Amadori ]
   * Update Standards-Version to 3.9.1 (no changes required).
+  * Exit from the sysvinit script to use the upstart job.
 
- -- Marco Amadori <marco.amadori@vdavda.com>  Fri, 11 Feb 2011 15:36:30 +0100
+ -- Marco Amadori <marco.amadori@vdavda.com>  Fri, 11 Feb 2011 15:45:07 +0100
 
 nodm (0.7-1.1) unstable; urgency=low
 
diff --git a/debian/nodm.init b/debian/nodm.init
index 1b8bb6e..15ca887 100644
--- a/debian/nodm.init
+++ b/debian/nodm.init
@@ -18,6 +18,12 @@ NAME=nodm
 PIDDIR=/var/run/
 PIDFILE=${PIDDIR}/${NAME}.pid
 
+if [ -e "/etc/init/${NAME}.conf" ] && /sbin/telinit --version >/dev/null 2>&1 | grep -qs upstart
+then
+	# An upstart job exists and upstart is in use, exit gracefully
+	exit 0
+fi
+
 NODM_ENABLED=no
 NODM_XINIT=/usr/bin/xinit
 NODM_FIRST_VT=7
-- 
1.7.2.3


Reply to: