tags 686378 patch
thanks

Hi Marco,

I've prepared an NMU for udev to add the upstart support in, using the
attached patch.  The only difference from the previous diff I sent is to use
the init_is_upstart function consistently instead of accidentally
reimplementing it in one case; thanks to Julien Cristau for pointing out
this discrepancy.

I've uploaded the NMU to the DELAYED/7-day queue.

Thanks,
-- 
Steve Langasek                   Give me a lever long enough and a Free OS
Debian Developer                   to set it on, and I can move the world.
Ubuntu Developer                                    http://www.debian.org/
slanga...@ubuntu.com                                     vor...@debian.org
=== modified file 'debian/changelog'
--- a/debian/changelog	2012-08-17 12:20:39 +0000
+++ b/debian/changelog	2012-11-05 07:58:16 +0000
@@ -1,3 +1,10 @@
+udev (175-7.1) unstable; urgency=low
+
+  * Non-maintainer upload.
+  * Add upstart support.  Closes: #686378.
+
+ -- Steve Langasek <steve.langa...@ubuntu.com>  Sun, 04 Nov 2012 23:58:14 -0800
+
 udev (175-7) unstable; urgency=low
 
   * Clean up better /etc/udev/rules.d/ on purge. (Closes: #685065)

=== modified file 'debian/rules'
--- a/debian/rules	2012-08-12 16:29:38 +0000
+++ b/debian/rules	2012-11-05 07:55:06 +0000
@@ -179,6 +179,10 @@
 	dh_installinit --no-start --update-rcd-params='start 03 S .'
 	dh_installinit --no-start --update-rcd-params='start 36 S .' \
 		--name=udev-mtab
+	dh_installinit --name=udev-finish --no-start -- start 37 S .
+	dh_installinit --name=udevtrigger --no-start
+	dh_installinit --name=udevmonitor --no-start
+	dh_installinit --name=udev-fallback-graphics --no-start
 
 	dh_strip
 	dh_compress

=== modified file 'debian/udev.init'
--- a/debian/udev.init	2012-07-30 05:36:46 +0000
+++ b/debian/udev.init	2012-11-05 07:56:08 +0000
@@ -160,6 +160,9 @@
 
 case "$1" in
     start)
+    if init_is_upstart; then
+	exit 1
+    fi
     if mountpoint -q $udev_root/; then
 	log_failure_msg "$udev_root is already mounted"
 	log_end_msg 1
@@ -189,6 +192,11 @@
 
     ;;
     stop)
+    # make sure a manual invocation of the init script doesn't stop an
+    # upstart-controlled instance of udev
+    if init_is_upstart && status udev | grep start; then
+	exit 0
+    fi
     log_daemon_msg "Stopping the hotplug events dispatcher" "udevd"
     if start-stop-daemon --stop --name udevd --user root --quiet --oknodo --retry 5; then
 	log_end_msg $?
@@ -206,6 +214,9 @@
     ;;
 
     restart)
+    if init_is_upstart; then
+	exit 1
+    fi
     log_daemon_msg "Stopping the hotplug events dispatcher" "udevd"
     if start-stop-daemon --stop --name udevd --user root --quiet --oknodo --retry 5; then
 	log_end_msg $?
@@ -246,6 +257,9 @@
 
 case "$1" in
     start)
+    if init_is_upstart; then
+	exit 1
+    fi
     if mountpoint -q $udev_root/; then
 	TMPFS_MOUNTED=1
     elif [ -e "$udev_root/.udev/" ]; then
@@ -314,6 +328,9 @@
     ;;
 
     restart)
+    if init_is_upstart; then
+	exit 1
+    fi
     log_daemon_msg "Stopping the hotplug events dispatcher" "udevd"
     if start-stop-daemon --stop --name udevd --user root --quiet --oknodo --retry 5; then
 	log_end_msg $?

=== modified file 'debian/udev.preinst'
--- a/debian/udev.preinst	2011-11-18 03:05:39 +0000
+++ b/debian/udev.preinst	2012-11-05 07:57:40 +0000
@@ -198,10 +198,21 @@
   fi
 }
 
+stop_on_upstart_upgrade() {
+  if which initctl >/dev/null && initctl version | grep -q upstart
+  then
+    # We have to stop udev before we can restart it under upstart in the
+    # postinst.
+    invoke-rc.d udev stop
+  fi
+}
+
 check_version() {
   # $2 is non-empty when installing from the "config-files" state
   [ "$2" ] || return 0
 
+  if dpkg --compare-versions $2 lt 175-7.1; then
+
   if dpkg --compare-versions $2 lt 175-1; then
 
   if dpkg --compare-versions $2 lt 168-2; then
@@ -262,6 +273,9 @@
   rm_conffile /etc/modprobe.d/blacklist.conf
 
   fi # 175-1
+
+  stop_on_upstart_upgrade
+  fi # 175-7.1
 }
 
 case "$1" in

=== added file 'debian/udev.udev-fallback-graphics.upstart'
--- a/debian/udev.udev-fallback-graphics.upstart	1970-01-01 00:00:00 +0000
+++ b/debian/udev.udev-fallback-graphics.upstart	2012-11-05 07:55:06 +0000
@@ -0,0 +1,21 @@
+# fallback-graphics - take actions to initiate fallback graphics
+#
+# if we have cold plugged everything and not yet seen a valid graphics
+# device,
+# shove a fallback framebuffer into the mix and hope for the best.
+
+description	"load fallback graphics devices"
+
+# We only want this job to happen once per boot, hence 'startup and ...'.
+start on (startup and 
+	  (graphics-device-added PRIMARY_DEVICE_FOR_DISPLAY=1
+           or drm-device-added PRIMARY_DEVICE_FOR_DISPLAY=1
+           or stopped udevtrigger or container))
+
+task
+
+script
+    if [ "$PRIMARY_DEVICE_FOR_DISPLAY" = "" ]; then
+        modprobe -q -b vesafb
+    fi
+end script

=== added file 'debian/udev.udev-finish.upstart'
--- a/debian/udev.udev-finish.upstart	1970-01-01 00:00:00 +0000
+++ b/debian/udev.udev-finish.upstart	2012-11-05 07:55:06 +0000
@@ -0,0 +1,30 @@
+# udev-finish - save udev log and update rules
+#
+# While udev runs we not only create the log file of initial device
+# creation but udev rules may be generated, we need to copy both of
+# these out of /dev and onto the root filesystem.
+
+description	"save udev log and update rules"
+
+start on (startup
+	  and filesystem
+	  and started udev
+	  and stopped udevtrigger
+	  and stopped udevmonitor)
+
+task
+script
+    # Save udev log in /var/log/udev
+    if [ -e /dev/.udev.log ]
+    then
+	mv -f /dev/.udev.log /var/log/udev || :
+    fi
+
+    # Copy any rules generated while the root filesystem was read-only
+    for file in /dev/.udev/tmp-rules--*
+    do
+	[ -e "$file" ] || continue
+	cat "$file" >> "/etc/udev/rules.d/${file##*tmp-rules--}"
+	rm -f "$file"
+    done
+end script

=== added file 'debian/udev.udevmonitor.upstart'
--- a/debian/udev.udevmonitor.upstart	1970-01-01 00:00:00 +0000
+++ b/debian/udev.udevmonitor.upstart	2012-11-05 07:55:06 +0000
@@ -0,0 +1,13 @@
+# udevmonitor - log initial device creation
+#
+# The set of devices created in the "cold plug" pass is generally
+# useful for debugging, so we monitor this and create a log file
+# from that.
+
+description	"log initial device creation"
+
+start on (startup
+	  and starting udevtrigger)
+stop on stopped udevtrigger
+
+exec /sbin/udevadm monitor -e >/dev/.udev.log

=== added file 'debian/udev.udevtrigger.upstart'
--- a/debian/udev.udevtrigger.upstart	1970-01-01 00:00:00 +0000
+++ b/debian/udev.udevtrigger.upstart	2012-11-05 07:55:06 +0000
@@ -0,0 +1,16 @@
+# udevtrigger - cold plug devices
+#
+# By the time udevd starts, we've already missed all of the events for
+# the devices populated in /sys.  This task causes the kernel to resend
+# them.
+
+description	"cold plug devices"
+
+start on (startup
+	  and started udev
+	  and not-container)
+
+task
+
+exec udevadm trigger --action=add
+post-stop exec udevadm settle

=== added file 'debian/udev.upstart'
--- a/debian/udev.upstart	1970-01-01 00:00:00 +0000
+++ b/debian/udev.upstart	2012-11-05 07:55:06 +0000
@@ -0,0 +1,14 @@
+# udev - device node and kernel event manager
+#
+# The udev daemon receives events from the kernel about changes in the
+# /sys filesystem and manages the /dev filesystem.
+
+description	"device node and kernel event manager"
+
+start on virtual-filesystems
+stop on runlevel [06]
+
+expect fork
+respawn
+
+exec /sbin/udevd --daemon

Attachment: signature.asc
Description: Digital signature

Reply via email to