Package: udev
Version: 175-7
Severity: wishlist
User: ubuntu-de...@lists.ubuntu.com
Usertags: quantal origin-ubuntu ubuntu-patch

Hi Marco,

Please find attached a patch for the udev package that adds upstart
integration.

Along with corresponding ifupdown integration, this is a blocker for getting
a recent version of upstart (with sensible boot events) into Debian.  I
spoke with the release team at DebConf in Managua, and this has been
tentatively approved for inclusion in wheezy, so I would appreciate it if
you could upload this to unstable.  I'm also happy to do an NMU if you
prefer; and in either case I'll be happy to manage the unblock requests with
the release team.

Note that the change to the preinst includes a new version number check, so
that should probably be made to match the actual version of the package that
introduces this change (NMU or MU).

Also, note that there are changes to the init script, to guard against users
manually starting a second copy of udev on upstart-based systems.  These
changes use a new function from /lib/lsb/init-functions, init_is_upstart,
which is only available in version 4.1+Debian3 or later of the lsb-base
package; but I have not added a versioned dependency on lsb-base because the
init script should fail gracefully when the function is not available.

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
diff -Nru udev-175/debian/changelog udev-175/debian/changelog
--- udev-175/debian/changelog	2012-08-17 10:24:27.000000000 +0000
+++ udev-175/debian/changelog	2012-08-28 19:08:49.000000000 +0000
@@ -1,3 +1,10 @@
+udev (175-7.1) UNRELEASED; urgency=low
+
+  * Non-maintainer upload.
+  * Add upstart support.
+
+ -- Steve Langasek <vor...@debian.org>  Tue, 28 Aug 2012 12:08:43 -0700
+
 udev (175-7) unstable; urgency=low
 
   * Clean up better /etc/udev/rules.d/ on purge. (Closes: #685065)
diff -Nru udev-175/debian/rules udev-175/debian/rules
--- udev-175/debian/rules	2012-08-12 15:49:52.000000000 +0000
+++ udev-175/debian/rules	2012-08-31 05:30:55.000000000 +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
diff -Nru udev-175/debian/udev.init udev-175/debian/udev.init
--- udev-175/debian/udev.init	2012-07-30 03:04:05.000000000 +0000
+++ udev-175/debian/udev.init	2012-08-31 15:54:48.000000000 +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,13 @@
 
     ;;
     stop)
+    # make sure a manual invocation of the init script doesn't stop an
+    # upstart-controlled instance of udev
+    if [ -x /sbin/initctl ] && initctl version | grep -q 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 +216,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 +259,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 +330,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 $?
diff -Nru udev-175/debian/udev.preinst udev-175/debian/udev.preinst
--- udev-175/debian/udev.preinst	2011-11-14 02:18:40.000000000 +0000
+++ udev-175/debian/udev.preinst	2012-08-31 05:14:53.000000000 +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
diff -Nru udev-175/debian/udev.udev-fallback-graphics.upstart udev-175/debian/udev.udev-fallback-graphics.upstart
--- udev-175/debian/udev.udev-fallback-graphics.upstart	1970-01-01 00:00:00.000000000 +0000
+++ udev-175/debian/udev.udev-fallback-graphics.upstart	2012-08-22 21:36:41.000000000 +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
diff -Nru udev-175/debian/udev.udev-finish.upstart udev-175/debian/udev.udev-finish.upstart
--- udev-175/debian/udev.udev-finish.upstart	1970-01-01 00:00:00.000000000 +0000
+++ udev-175/debian/udev.udev-finish.upstart	2012-08-22 21:36:41.000000000 +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
diff -Nru udev-175/debian/udev.udevmonitor.upstart udev-175/debian/udev.udevmonitor.upstart
--- udev-175/debian/udev.udevmonitor.upstart	1970-01-01 00:00:00.000000000 +0000
+++ udev-175/debian/udev.udevmonitor.upstart	2012-08-22 21:36:41.000000000 +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
diff -Nru udev-175/debian/udev.udevtrigger.upstart udev-175/debian/udev.udevtrigger.upstart
--- udev-175/debian/udev.udevtrigger.upstart	1970-01-01 00:00:00.000000000 +0000
+++ udev-175/debian/udev.udevtrigger.upstart	2012-08-22 21:36:41.000000000 +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
diff -Nru udev-175/debian/udev.upstart udev-175/debian/udev.upstart
--- udev-175/debian/udev.upstart	1970-01-01 00:00:00.000000000 +0000
+++ udev-175/debian/udev.upstart	2012-08-22 21:36:41.000000000 +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