Add 01-upstart-lsb from the upstart package, and make executing rc.d scripts no-op...
authorStéphane Graber <stgraber@ubuntu.com>
Sun, 10 Jan 2016 11:31:15 +0000 (12:31 +0100)
committerDidier Raboud <odyx@debian.org>
Sat, 9 Jan 2016 21:20:31 +0000 (22:20 +0100)
Changed-By: Dimitri John Ledkov <xnox@ubuntu.com> Fri, 30 May 2014 11:38:47 +0200
debian/control
debian/lsb-base.install
init-functions.d/01-upstart-lsb [new file with mode: 0644]

index 85eb103e14051870809bf78c9e229646c88eaac6..5c2b65fd7a1001c41e3a9ec66c1e9565f8c01d37 100644 (file)
@@ -20,6 +20,8 @@ Architecture: all
 Multi-Arch: foreign
 Depends: ${misc:Depends}
 Pre-Depends: ${misc:Pre-Depends}
+Replaces: upstart (<< 1.12.1-0ubuntu8)
+Breaks: upstart (<< 1.12.1-0ubuntu8)
 Priority: required
 Description: Linux Standard Base init script functionality
  The Linux Standard Base (http://www.linuxbase.org/) is a standard
index 66dc0df74f6df0e469e7a179cd8451597e994e2e..a60c86d80d19ff7ac2d87b6c3e6a8633618663a1 100644 (file)
@@ -1,2 +1,3 @@
 init-functions /lib/lsb
+init-functions.d/01-upstart-lsb /lib/lsb/init-functions.d
 init-functions.d/20-left-info-blocks /lib/lsb/init-functions.d
diff --git a/init-functions.d/01-upstart-lsb b/init-functions.d/01-upstart-lsb
new file mode 100644 (file)
index 0000000..92205ce
--- /dev/null
@@ -0,0 +1,31 @@
+# Allow executing init.d scripts as upstart jobs
+
+# Operate against system upstart, not session
+unset UPSTART_SESSION
+
+# Bail if there is an upstart job, and called via RC
+_RC_SCRIPT=${0#/etc/rc?.d/[KS]??*}
+if [ -r "/etc/init/${_RC_SCRIPT}.conf" ] && which initctl >/dev/null \
+   && initctl version 2>/dev/null | grep -q upstart
+then
+   exit 0
+fi
+
+_UPSTART_JOB=${0#/etc/init.d/}
+if [ -r "/etc/init/${_UPSTART_JOB}.conf" ] && which initctl >/dev/null \
+   && initctl version 2>/dev/null | grep -q upstart \
+   && initctl status ${_UPSTART_JOB} 2>/dev/null 1>/dev/null
+then
+   # Upstart configuration exists for this job and we're running under upstart
+   case "${1:-}" in
+      start|stop|status|reload)
+         # Action is a valid upstart action
+         exec ${1} ${_UPSTART_JOB}
+      ;;
+      restart|force-reload)
+        # Map restart to the usual sysvinit behavior.
+         stop ${_UPSTART_JOB} || :
+         exec start ${_UPSTART_JOB}
+      ;;
+   esac
+fi