Package: at
Version: 3.1.13-2
Severity: normal
Tags: patch
User: upst...@packages.deban.org
Usertags: upstart-job

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

Dear Maintainer,

please consider applying the following patch that adds upstart
integration for the atd daemon.

The patch below follows debian policy on alternative init systems [1]
and recommended practices in making upstart compatible init scripts
[2]. The rules file is changed slightly and now uses dh_installinit to
install both upstart and init scripts.

I have tested proposed changes on debian sid, with both sysvinit and
upstart.

[1] http://www.debian.org/doc/debian-policy/ch-opersys.html#s-alternateinit
[2] https://wiki.ubuntu.com/UpstartCompatibleInitScripts

Regards,

Dmitrijs.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)

iQIcBAEBCAAGBQJRulOFAAoJEIh7YGGLPBauOMoP/3h+Xj/M5NPgag+jKpGFkIFt
LrfsyuscjsgIMXLyipXWA+ZP8DyK8vDokzC+6lGLd6ORNF1f0+/8uhNjB7CiKza+
Y5dhizIU5KbDl95S1T37ndXv/MYsKaC5cjIywW2+gZD+x6mt90uEtVbDCMozzx6S
QOIqE0edPTSu64RvACyrgFi5t10I+rVkYTXb6BGpQOSy0kKRAJXkz6jxpZrdfTPr
QJEfeAIdPzqkO5hJ9CgHCnz2p1T1SjOB9F0YMLlb7J92D6Q2RvJtVYyZAOPIx4yo
w9Xyfrd6TwKJdxoBhj5823Jc/iMjN7shuliVWm2HdEB0NT9eAykvn5LwRHwJgC4h
o7oBn4UZzz2+gdMeIj+v0yVYb0YL47ogYqU/wICcF9bPD2psRt8Qr6oh0Kvd1FY0
vfrNotqD8T1TtmR2UJVpK14qjHC0WPbAzpzfiBLMDQHM4u03WZVRnapKj+YNvoSB
zj5o12a0ej7WQpSVX4MY54FqW3xbQRKo/ljezyUdi3nRgynwEmnpr+8liN8fBcMr
p8zQGfKUoGvd4tOWZ262Ky+83q+jFQisB/6VluK8jk69v+GsmMFTtGH/GmrXX8yV
awQCJq7/NFRfZfL8b1oTEAUgbZI8Tg5KREjWX2/oU7xMqq2bo1G172g6ohr0c0dM
tLrBpkbv/HSPDcQRYDlx
=WEaY
-----END PGP SIGNATURE-----
diff -u at-3.1.13/debian/rules at-3.1.13/debian/rules
--- at-3.1.13/debian/rules
+++ at-3.1.13/debian/rules
@@ -27,7 +27,7 @@
 	[ ! -f Makefile ] || $(MAKE) distclean
 	[ ! -f config.sub.ori ] || mv -f config.sub.ori config.sub
 	[ ! -f config.guess.ori ] || mv -f config.guess.ori config.guess
-	dh_clean
+	dh_clean debian/at.atd.init
 
 binary-indep:
 # Nothing to be done here
@@ -54,11 +54,8 @@
 	mv debian/at/etc/pam.d/pam.conf \
 		debian/at/etc/pam.d/atd
 	# Install/rename init script:
-	dh_install rc etc/init.d
-	mv debian/at/etc/init.d/rc \
-		debian/at/etc/init.d/atd
-	chmod a+x debian/at/etc/init.d/atd
-	dh_installinit --name=atd --onlyscripts -- defaults 89 11
+	cp rc debian/at.atd.init
+	dh_installinit --name=atd -- defaults 89 11
 	# Needed to keep in line with the previous upload:
 	chown root:daemon debian/at/etc/at.deny
 	dh_compress
diff -u at-3.1.13/debian/changelog at-3.1.13/debian/changelog
--- at-3.1.13/debian/changelog
+++ at-3.1.13/debian/changelog
@@ -1,3 +1,14 @@
+at (3.1.13-2.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Add upstart integration:
+    - Check if init is upstart in the init.d script and exit appropriately.
+    - Add upstart job
+    - Use dh_installinit to install both
+    - Depend on lsb-base that provides init_is_upstart function.
+
+ -- Dmitrijs Ledkovs <dmitrij.led...@ubuntu.com>  Thu, 13 Jun 2013 23:11:23 +0100
+
 at (3.1.13-2) unstable; urgency=low
 
   * Use debhelper compat level 9 (to enable hardening by default).
diff -u at-3.1.13/debian/control at-3.1.13/debian/control
--- at-3.1.13/debian/control
+++ at-3.1.13/debian/control
@@ -12,7 +12,7 @@
 Architecture: any
 Multi-Arch: foreign
 Depends: ${shlibs:Depends}, ${misc:Depends},
- lsb-base (>= 3.2-14), libpam-runtime (>= 1.0.1-11)
+ lsb-base (>= 4.1+Debian3), libpam-runtime (>= 1.0.1-11)
 Recommends: default-mta | mail-transport-agent
 Description: Delayed job execution and batch processing
  At and batch read shell commands from standard input
only in patch2:
unchanged:
--- at-3.1.13.orig/rc
+++ at-3.1.13/rc
@@ -21,6 +21,17 @@
 
 . /lib/lsb/init-functions
 
+if init_is_upstart; then
+    case "$1" in
+	stop)
+	    exit 0
+	    ;;
+	*)
+	    exit 1
+	    ;;
+    esac
+fi
+
 case "$1" in
   start)
 	log_daemon_msg "Starting deferred execution scheduler" "atd"
only in patch2:
unchanged:
--- at-3.1.13.orig/debian/at.atd.upstart
+++ at-3.1.13/debian/at.atd.upstart
@@ -0,0 +1,14 @@
+# atd - deferred execution scheduler
+#
+# at is a standard UNIX program that runs user-specified programs at
+# scheduled deferred times
+
+description	"deferred execution scheduler"
+
+start on runlevel [2345]
+stop on runlevel [!2345]
+
+expect fork
+respawn
+
+exec atd

Reply via email to