[hal] Start HAL by bus activation

Lennart Poettering lennart at fedoraproject.org
Sun Sep 12 19:34:28 UTC 2010


commit 74d20ad2203634b47929a08df4af46c42fb7c62d
Author: Lennart Poettering <lennart at poettering.net>
Date:   Sun Sep 12 21:33:17 2010 +0200

    Start HAL by bus activation

 do_not_check_hal_on_bus.patch |   27 ++++++++++++++++
 hal.spec                      |   70 ++++++++++++++++++++++++++++-------------
 haldaemon.service             |    8 +++++
 org.freedesktop.Hal.service   |    5 +++
 4 files changed, 88 insertions(+), 22 deletions(-)
---
diff --git a/do_not_check_hal_on_bus.patch b/do_not_check_hal_on_bus.patch
new file mode 100644
index 0000000..098ec75
--- /dev/null
+++ b/do_not_check_hal_on_bus.patch
@@ -0,0 +1,27 @@
+--- hal-0.5.14.orig/libhal/libhal.c
++++ hal-0.5.14/libhal/libhal.c
+@@ -3376,7 +3376,6 @@
+ libhal_ctx_init (LibHalContext *ctx, DBusError *error)
+ {
+ 	DBusError _error;
+-	dbus_bool_t hald_exists;
+ 
+ 	LIBHAL_CHECK_LIBHALCONTEXT(ctx, FALSE);
+ 
+@@ -3384,16 +3383,6 @@
+ 		return FALSE;
+ 
+ 	dbus_error_init (&_error);
+-	hald_exists = dbus_bus_name_has_owner (ctx->connection, "org.freedesktop.Hal", &_error);
+-	dbus_move_error (&_error, error);
+-	if (error != NULL && dbus_error_is_set (error)) {
+-		return FALSE;
+-	}
+-
+-	if (!hald_exists) {
+-		return FALSE;
+-	}
+-
+ 	
+ 	if (!dbus_connection_add_filter (ctx->connection, filter_func, ctx, NULL)) {
+ 		return FALSE;
diff --git a/hal.spec b/hal.spec
index 92109da..885d788 100644
--- a/hal.spec
+++ b/hal.spec
@@ -26,7 +26,7 @@
 Summary: Hardware Abstraction Layer
 Name: hal
 Version: 0.5.14
-Release: 4%{?dist}
+Release: 5%{?dist}
 #Release: 1.%{?alphatag}%{?dist}
 URL: http://www.freedesktop.org/Software/hal
 Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.bz2
@@ -35,6 +35,10 @@ Source0: http://hal.freedesktop.org/releases/%{name}-%{version}.tar.bz2
 # OLPC specific, not upstream as is a hack until OFW lands
 Source1: 05-olpc-detect.fdi
 
+# systemd bus activation hookup
+Source2: org.freedesktop.Hal.service
+Source3: haldaemon.service
+
 Patch2: hal-change-priority.patch
 
 # https://bugzilla.redhat.com/show_bug.cgi?id=488177
@@ -52,6 +56,9 @@ Patch13: hal-xen-unignore-axes.patch
 # https://bugzilla.redhat.com/show_bug.cgi?id=630859
 Patch14: probe-input-segfault.patch
 
+# https://bugs.launchpad.net/ubuntu/+source/hal/+bug/546992
+Patch15: do_not_check_hal_on_bus.patch
+
 Patch100: hal-use-at-console.patch
 
 License: AFL or GPLv2
@@ -82,14 +89,14 @@ BuildRequires: libusb-devel >= %{libusb_version}
 Requires: dbus >= %{dbus_version}
 Requires: dbus-glib >= %{dbus_glib_version}
 Requires: glib2 >= %{glib2_version}
-Requires: udev >= %{udev_version} 
-Requires: util-linux >= %{util_linux_version} 
+Requires: udev >= %{udev_version}
+Requires: util-linux >= %{util_linux_version}
 Requires: initscripts >= %{initscripts_version}
 Requires: cryptsetup-luks >= %{cryptsetup_luks_version}
 Requires: %{name}-filesystem = %{version}-%{release}
 %ifnarch s390 s390x
 Requires: pm-utils >= %{pm_utils_version}
-%endif 
+%endif
 Conflicts: kernel < %{kernel_version}
 %ifnarch s390 s390x
 Requires: libusb >= %{libusb_version}
@@ -160,6 +167,7 @@ Storage polling support for HAL
 %patch11 -p1 -b .hdaps-blacklist
 %patch13 -p1 -b .xen-unignore
 %patch14 -p1 -b .probe-input-segfault
+%patch15 -p1 -b .do_not_check_hal_on_bus.patch
 %patch100 -p1 -b .drop-polkit
 
 autoreconf -i -f
@@ -205,6 +213,12 @@ rm -f $RPM_BUILD_ROOT%{_libdir}/*.a
 # So that this can be %ghost-ed
 touch $RPM_BUILD_ROOT%{_localstatedir}/run/hald/acl-list
 
+mkdir -p $RPM_BUILD_ROOT%{_datadir}/dbus-1/system-services/
+cp %{SOURCE2} $RPM_BUILD_ROOT%{_datadir}/dbus-1/system-services/
+
+mkdir -p $RPM_BUILD_ROOT/lib/systemd/system/
+cp %{SOURCE3} $RPM_BUILD_ROOT/lib/systemd/system/
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -216,15 +230,20 @@ rm -rf $RPM_BUILD_ROOT
 %post
 /sbin/ldconfig
 /sbin/chkconfig --add haldaemon
+if [ $1 -eq 1 ]; then
+        /bin/systemctl daemon-reload >/dev/null 2>&1 || :
+fi
 
 %preun
-if [ $1 = 0 ]; then
-    service haldaemon stop > /dev/null 2>&1
-    /sbin/chkconfig --del haldaemon
+if [ $1 -eq 0 ]; then
+        service haldaemon stop > /dev/null 2>&1
+        /sbin/chkconfig --del haldaemon
+        /bin/systemctl stop haldaemon.service >/dev/null 2>&1 || :
 fi
 
 %postun
 /sbin/ldconfig
+/bin/systemctl daemon-reload >/dev/null 2>&1 || :
 #if [ "$1" -ge "1" ]; then
 #  service haldaemon condrestart > /dev/null 2>&1
 #fi
@@ -277,6 +296,9 @@ fi
 
 /etc/udev/rules.d/90-hal.rules
 
+%{_datadir}/dbus-1/system-services/org.freedesktop.Hal.service
+/lib/systemd/system/haldaemon.service
+
 %attr(0700,haldaemon,haldaemon) %dir %{_localstatedir}/cache/hald
 %attr(0700,haldaemon,haldaemon) %dir %{_localstatedir}/run/hald
 %ghost %{_localstatedir}/run/hald/acl-list
@@ -313,6 +335,10 @@ fi
 %{_libexecdir}/hald-addon-storage
 
 %changelog
+* Sat Sep 11 2010 Lennart Poettering <lpoetter at redhat.com> - 0.5.14-5
+- Start HAL by bus activation
+- https://bugzilla.redhat.com/show_bug.cgi?id=631620
+
 * Tue Sep  7 2010 Matthias Clasen <mclasen at redhat.com> 0.5.14-4
 - Fix a segfault in probe-input (#630859)
 
@@ -496,7 +522,7 @@ fi
 - Avoid using at_console since that breaks g-p-m running under gdm
 
 * Tue Mar 18 2008 Jeremy Katz <katzj at redhat.com> - 0.5.11-0.2.rc2
-- Fix build errors 
+- Fix build errors
 
 * Tue Mar 18 2008 Jeremy Katz <katzj at redhat.com> - 0.5.11-0.1.rc2
 - Update to 0.5.11rc2
@@ -640,7 +666,7 @@ fi
 * Tue Feb  6 2007 David Zeuthen <davidz at redhat.com> - 0.5.9-0.git20070206%{?dist}
 - Update to git snapshot
 - Drop upstreamed patches
-- Include hal-info snapshot in this SRPM for now (will be moved to it's 
+- Include hal-info snapshot in this SRPM for now (will be moved to it's
   own SRPM eventually)
 - Require ConsoleKit as this release denies some service to callers
   not originating from an active desktop session (f-u-s requirement)
@@ -804,7 +830,7 @@ fi
 * Tue Nov 08 2005 John (J5) Palmieri <johnp at redhat.com> - 0.5.4-4
 - Add patch to fix storage policy fdi to match on the storage
   capability and not category.
-  
+
 * Mon Oct  3 2005 Matthias Clasen <mclasen at redhat.com>
 - Fix a typo in description
 
@@ -886,7 +912,7 @@ fi
 - Should close #145921, #145750, #145293, #145256
 
 * Mon Jan 24 2005 John (J5) Palmieri <johnp at redhat.com> 0.4.6-3
-- Update required dbus version to 0.23 
+- Update required dbus version to 0.23
 
 * Thu Jan 20 2005 David Zeuthen <davidz at redhat.com> 0.4.6-2
 - Fix parameters to configure
@@ -909,7 +935,7 @@ fi
 - Change default policy such that non-hotpluggable fixed disks are not
   added to the /etc/fstab file because a) ATARAID detection in hal is
   incomplete (e.g. RAID members from ATARAID controllers might be added
-  to /etc/fstab); and b) default install wont corrupt multiboot 
+  to /etc/fstab); and b) default install wont corrupt multiboot
   systems on fixed drives (#137072)
 
 * Tue Oct 26 2004 David Zeuthen <davidz at redhat.com> 0.4.0-6
@@ -937,7 +963,7 @@ fi
 
 * Fri Oct 15 2004 David Zeuthen <davidz at redhat.com> 0.4.0-3
 - Fix bad use of O_NONBLOCK as the 2.6.8-1.624 kernel exposes this (#135886)
-- Never use the UUID as mount point candidate in the default policy 
+- Never use the UUID as mount point candidate in the default policy
   as it is unfriendly (#135907)
 - Fix a trivial bug in fstab-sync so the syslog messages actually expose
   the device name instead of just the word foo
@@ -978,7 +1004,7 @@ fi
 - Temporarily disable explicit requirement for libselinux
 
 * Mon Sep 20 2004 David Zeuthen <davidz at redhat.com> 0.2.98-1
-- Update to upstream release 0.2.98. 
+- Update to upstream release 0.2.98.
 - Use --with-pid-file so we don't depend on /etc/redhat-release
 
 * Wed Sep 01 2004 David Zeuthen <davidz at redhat.com> 0.2.97.cvs20040901-1
@@ -998,7 +1024,7 @@ fi
 - Closes RH Bug #130971
 
 * Fri Aug 27 2004 David Zeuthen <davidz at redhat.com> 0.2.97.cvs20040827-1
-- Update to upstream CVS HEAD. 
+- Update to upstream CVS HEAD.
 - Should close RH Bug #130588
 
 * Wed Aug 25 2004 David Zeuthen <davidz at redhat.com> 0.2.97.cvs20040823-3
@@ -1052,10 +1078,10 @@ fi
 * Fri Jun 25 2004 John (J5) Palmieri <johnp at redhat.com> 0.2.92.cvs.20040611-2
 - take out fstab-update.sh from install
 - add to rawhide
- 
-* Fri Jun 11 2004 John (J5) Palmieri <johnp at redhat.com> 0.2.92.cvs.20040611-1 
-- update to CVS head as of 6-11-2004 which contains dcbw's 
-  network link status fix 
+
+* Fri Jun 11 2004 John (J5) Palmieri <johnp at redhat.com> 0.2.92.cvs.20040611-1
+- update to CVS head as of 6-11-2004 which contains dcbw's
+  network link status fix
 
 * Wed Jun 9 2004 Ray Strode <rstrode at redhat.com> 0.2.91.cvs20040527-2
 - added dependency on udev
@@ -1065,11 +1091,11 @@ fi
   and wireless network devices.
 
 * Wed May 12 2004 John (J5) Palmieri <johnp at redhat.com> 0.2.90.cvs20040511-3
-- added hal-0.2.90.cvs20040511.callbackscripts.patch which installs 
+- added hal-0.2.90.cvs20040511.callbackscripts.patch which installs
   the file system mounting script in /etc/hal/device.d
 
 * Wed May 12 2004 John (J5) Palmieri <johnp at redhat.com> 0.2.90.cvs20040511-2
-- added the %%{_sysconfigdir}/hal directory tree to %files 
+- added the %%{_sysconfigdir}/hal directory tree to %files
 
 * Tue May 11 2004 John (J5) Palmieri <johnp at redhat.com> 0.2.90.cvs20040511-1
 - update to CVS head as of 5-11-2004
@@ -1080,7 +1106,7 @@ fi
 * Mon Apr 19 2004 John (J5) Palmieri <johnp at redhat.com> 0.2.90-1
 - upstream update
 
-* Mon Apr 19 2004 John (J5) Palmieri <johnp at redhat.com> 0.2-1 
+* Mon Apr 19 2004 John (J5) Palmieri <johnp at redhat.com> 0.2-1
 - initial checkin to package repository
 - added dependency to the dbus-python package
 - added %%{_libexecdir}/hal.dev to teh %%files section
diff --git a/haldaemon.service b/haldaemon.service
new file mode 100644
index 0000000..c4b6714
--- /dev/null
+++ b/haldaemon.service
@@ -0,0 +1,8 @@
+[Unit]
+Description=HAL Hardware Manager
+After=syslog.target
+
+[Service]
+ExecStart=/usr/sbin/hald --daemon=no --use-syslog
+Type=dbus
+BusName=org.freedesktop.Hal
diff --git a/org.freedesktop.Hal.service b/org.freedesktop.Hal.service
new file mode 100644
index 0000000..e79da60
--- /dev/null
+++ b/org.freedesktop.Hal.service
@@ -0,0 +1,5 @@
+[D-BUS Service]
+Name=org.freedesktop.Hal
+Exec=/usr/sbin/hald
+User=root
+SystemdService=haldaemon.service


More information about the scm-commits mailing list