[usbmuxd] Use systemd to start usbmuxd instead of udev (#786853)

Bastien Nocera hadess at fedoraproject.org
Tue Jul 10 16:39:28 UTC 2012


commit 88c395a80f1565a1dab851a8d2c87f6414f67391
Author: Bastien Nocera <hadess at hadess.net>
Date:   Tue Jul 10 17:39:19 2012 +0100

    Use systemd to start usbmuxd instead of udev (#786853)

 0001-Use-systemd-to-start-usbmuxd.patch |   61 +++++++++++++++++++++++++++++++
 90-cve-2012-0065.patch                  |   21 -----------
 usbmuxd.spec                            |   10 ++++-
 3 files changed, 69 insertions(+), 23 deletions(-)
---
diff --git a/0001-Use-systemd-to-start-usbmuxd.patch b/0001-Use-systemd-to-start-usbmuxd.patch
new file mode 100644
index 0000000..3928a41
--- /dev/null
+++ b/0001-Use-systemd-to-start-usbmuxd.patch
@@ -0,0 +1,61 @@
+From c15d2f6f22a3d5013c8b1cd6ca9c8a31be3748d5 Mon Sep 17 00:00:00 2001
+From: Bastien Nocera <hadess at hadess.net>
+Date: Mon, 9 Jul 2012 16:30:33 +0100
+Subject: [PATCH] Use systemd to start usbmuxd
+
+Instead of using udev. udev should not be used to start
+long-running daemons. The started daemon will receive SIGKILL
+after all event handling has been done, as udev.service cleans
+up all the lingering processes.
+
+We instead ask udev to tell systemd to start us up through the
+usbmuxd.service file.
+
+See:
+https://bugzilla.redhat.com/show_bug.cgi?id=786853
+for more details.
+---
+ udev/85-usbmuxd.rules.in |    2 +-
+ udev/CMakeLists.txt      |    2 ++
+ udev/usbmuxd.service.in  |    7 +++++++
+ 3 files changed, 10 insertions(+), 1 deletion(-)
+ create mode 100644 udev/usbmuxd.service.in
+
+diff --git a/udev/85-usbmuxd.rules.in b/udev/85-usbmuxd.rules.in
+index 6f2186b..d9de100 100644
+--- a/udev/85-usbmuxd.rules.in
++++ b/udev/85-usbmuxd.rules.in
+@@ -1,7 +1,7 @@
+ # usbmuxd ("Apple Mobile Device" muxer listening on /var/run/usbmuxd)
+ 
+ # Forces iDevices to the last USB configuration and runs usbmuxd
+-ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="12[9a][0-9a-f]", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}!="$attr{bNumConfigurations}", ATTR{bConfigurationValue}="$attr{bNumConfigurations}", OWNER="usbmux", RUN+="@CMAKE_INSTALL_PREFIX@/sbin/usbmuxd -u -U usbmux"
++ACTION=="add", SUBSYSTEM=="usb", ATTR{idVendor}=="05ac", ATTR{idProduct}=="12[9a][0-9a-f]", ENV{USBMUX_SUPPORTED}="1", ATTR{bConfigurationValue}!="$attr{bNumConfigurations}", ATTR{bConfigurationValue}="$attr{bNumConfigurations}", OWNER="usbmux", TAG+="systemd", ENV{SYSTEMD_WANTS}="usbmuxd.service"
+ 
+ # Exit usbmuxd when the last device is removed
+ ACTION=="remove", SUBSYSTEM=="usb", ENV{PRODUCT}=="5ac/12[9a][0-9a-f]/*", ENV{INTERFACE}=="255/*", RUN+="@CMAKE_INSTALL_PREFIX@/sbin/usbmuxd -x"
+diff --git a/udev/CMakeLists.txt b/udev/CMakeLists.txt
+index 0f7042d..3067a75 100644
+--- a/udev/CMakeLists.txt
++++ b/udev/CMakeLists.txt
+@@ -1,2 +1,4 @@
+ CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/85-usbmuxd.rules.in ${CMAKE_CURRENT_BINARY_DIR}/85-usbmuxd.rules @ONLY)
++CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/usbmuxd.service.in ${CMAKE_CURRENT_BINARY_DIR}/usbmuxd.service @ONLY)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/85-usbmuxd.rules DESTINATION /lib/udev/rules.d/)
++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/usbmuxd.service DESTINATION /lib/systemd/system/)
+diff --git a/udev/usbmuxd.service.in b/udev/usbmuxd.service.in
+new file mode 100644
+index 0000000..bcfb347
+--- /dev/null
++++ b/udev/usbmuxd.service.in
+@@ -0,0 +1,7 @@
++[Unit]
++Description=iOS USB Muxer
++
++[Service]
++Type=simple
++ExecStart=/sbin/usbmuxd -u -U usbmux
++PIDFile=/var/run/usbmuxd.pid
+-- 
+1.7.10.2
+
diff --git a/usbmuxd.spec b/usbmuxd.spec
index f72319d..7fd8ed2 100644
--- a/usbmuxd.spec
+++ b/usbmuxd.spec
@@ -1,6 +1,6 @@
 Name:          usbmuxd
 Version:       1.0.8
-Release:       2%{?dist}
+Release:       3%{?dist}
 Summary:       Daemon for communicating with Apple's iPod Touch and iPhone
 
 Group:         Applications/System
@@ -8,6 +8,7 @@ Group:         Applications/System
 License:       GPLv3+ or GPLv2+ and LGPLv2+
 URL:           http://marcansoft.com/uploads/
 Source0:       http://marcansoft.com/uploads/usbmuxd/%{name}-%{version}.tar.bz2
+Patch0:        0001-Use-systemd-to-start-usbmuxd.patch
 
 BuildRequires: libplist-devel
 BuildRequires: libusb1-devel
@@ -31,10 +32,11 @@ Files for development with %{name}.
 
 %prep
 %setup -q
+%patch0 -p1 -b .systemd
 
 # Set the owner of the device node to be usbmuxd
 sed -i.owner 's/OWNER="usbmux"/OWNER="usbmuxd"/' udev/85-usbmuxd.rules.in
-sed -i.user 's/-U usbmux/-U usbmuxd/' udev/85-usbmuxd.rules.in
+sed -i.user 's/-U usbmux/-U usbmuxd/' udev/usbmuxd.service.in
 
 %build
 export CMAKE_PREFIX_PATH=/usr
@@ -61,6 +63,7 @@ exit 0
 %defattr(-,root,root,-)
 %doc AUTHORS README COPYING.GPLv2 COPYING.GPLv3 COPYING.LGPLv2.1 README.devel
 /lib/udev/rules.d/85-usbmuxd.rules
+/lib/systemd/system/usbmuxd.service
 %{_bindir}/iproxy
 %{_sbindir}/usbmuxd
 %{_libdir}/libusbmuxd.so.*
@@ -73,6 +76,9 @@ exit 0
 %{_libdir}/pkgconfig/libusbmuxd.pc
 
 %changelog
+* Mon Jul 09 2012 Bastien Nocera <bnocera at redhat.com> 1.0.8-3
+- Use systemd to start usbmuxd instead of udev (#786853)
+
 * Sat Apr 28 2012 Bastien Nocera <bnocera at redhat.com> 1.0.8-2
 - Fix usbmuxd not starting under udev
 


More information about the scm-commits mailing list