Bug 171568 - [patch] sysutils/hal: recreate hal direcories
Summary: [patch] sysutils/hal: recreate hal direcories
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-gnome (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-09-12 10:00 UTC by nkoch
Modified: 2012-09-29 19:20 UTC (History)
0 users

See Also:


Attachments
file.diff (1.44 KB, patch)
2012-09-12 10:00 UTC, nkoch
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description nkoch 2012-09-12 10:00:10 UTC
hald won't run with varmfs="YES" due to non-existent directories when talking to PolicyKit.

Fix: This is a quick hack as I do not know anything about hald's requirements/internals:

I just copied what I found in the package install scripts
of Policykit, polkit, ConsoleKit, hal into rc.d/hald.


Patch attached with submission follows:
How-To-Repeat: set varmfs="YES" and populate_var="YES" and reboot.
hald won't run.
Try hald --daemon=no --verbose=yes
hald reports an error with PolicyKit.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2012-09-12 10:00:39 UTC
Responsible Changed
From-To: freebsd-ports-bugs->gnome

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 dfilter service freebsd_committer freebsd_triage 2012-09-29 19:18:13 UTC
Author: kwm
Date: Sat Sep 29 18:17:59 2012
New Revision: 305045
URL: http://svn.freebsd.org/changeset/ports/305045

Log:
  Make sure /var is populated correctly before hal is started, like dbus does
  already in its rc.d script. [1]
  Don't list entries twice, set some more details about storage devices like
  the linux backend does. [2]
  
  PR:		ports/171568 [1]
  PR:		ports/171727 [2]
  Submitted by:	Norbert Koch <nkoch@demig.de> [1], avilla@ [2]
  Reviewed by:	marcus@

Added:
  head/sysutils/hal/files/patch-hald_freebsd_hf-drm.c   (contents, props changed)
  head/sysutils/hal/files/patch-hald_freebsd_probing_probe-storage.c   (contents, props changed)
Modified:
  head/sysutils/hal/Makefile   (contents, props changed)
  head/sysutils/hal/files/hald.in   (contents, props changed)

Modified: head/sysutils/hal/Makefile
==============================================================================
--- head/sysutils/hal/Makefile	Sat Sep 29 18:10:12 2012	(r305044)
+++ head/sysutils/hal/Makefile	Sat Sep 29 18:17:59 2012	(r305045)
@@ -8,7 +8,7 @@
 
 PORTNAME=	hal
 DISTVERSION=	0.5.14
-PORTREVISION=	19
+PORTREVISION=	20
 CATEGORIES=	sysutils
 MASTER_SITES=	http://hal.freedesktop.org/releases/
 

Modified: head/sysutils/hal/files/hald.in
==============================================================================
--- head/sysutils/hal/files/hald.in	Sat Sep 29 18:10:12 2012	(r305044)
+++ head/sysutils/hal/files/hald.in	Sat Sep 29 18:17:59 2012	(r305045)
@@ -41,6 +41,43 @@ local_force_depend()
    return 0
 }
 
+init_var_policykit()
+{
+  local USER=polkit
+  local GROUP=${USER}
+  local PREFIX=/usr/local
+
+  /usr/bin/install -d -o root -m 0770 -g ${GROUP} /var/run/PolicyKit
+  /usr/bin/install -d -o root -m 0770 -g ${GROUP} /var/lib/PolicyKit
+  /usr/bin/install -d -o ${USER} -m 0755 -g wheel /var/lib/PolicyKit-public
+  /bin/mkdir -p /var/lib/misc
+  /usr/bin/touch -f /var/lib/misc/PolicyKit.reload
+  /usr/sbin/chown ${USER}:${GROUP} /var/lib/misc/PolicyKit.reload
+  /bin/chmod 0664 /var/lib/misc/PolicyKit.reload
+}
+
+init_var_polkit()
+{
+  mkdir -p /var/lib/polkit-1/localauthority
+  for i in 10-vendor.d 20-org.d 30-site.d 50-local.d 90-mandatory.d
+  do
+    mkdir -p /var/lib/polkit-1/localauthority/${i}
+  done
+  chmod 0700 /var/lib/polkit-1
+}
+
+init_var_hal()
+{
+  local USER=haldaemon
+  local GROUP=${USER}
+
+  /usr/bin/install -d -o ${USER} -g ${GROUP} /var/run/hald
+  /usr/bin/install -d -o ${USER} -g ${GROUP} /var/cache/hald
+  /usr/bin/install -d -o ${USER} -g ${GROUP} /var/lib/hal
+  /usr/local/bin/polkit-auth --user ${USER} --grant \
+          org.freedesktop.policykit.read 1> /dev/null 2>&1
+}
+
 hald_precmd()
 {
     if ! checkyesno dbus_enable
@@ -48,6 +85,10 @@ hald_precmd()
 	local_force_depend dbus || return 1
     fi
 
+    init_var_policykit
+    init_var_polkit
+    init_var_hal
+
     chmod 0755 /var/cache
 
     mkdir -p $(dirname $pidfile)

Added: head/sysutils/hal/files/patch-hald_freebsd_hf-drm.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/hal/files/patch-hald_freebsd_hf-drm.c	Sat Sep 29 18:17:59 2012	(r305045)
@@ -0,0 +1,15 @@
+--- hald/freebsd/hf-drm.c.orig	2008-08-10 15:50:10.000000000 +0200
++++ hald/freebsd/hf-drm.c	2012-09-27 12:04:28.000000000 +0200
+@@ -234,6 +234,12 @@
+   {
+     HalDevice *parent = HAL_DEVICE(l->data);
+ 
++    if (hf_device_store_match(hald_get_gdl(),
++			      "info.parent", HAL_PROPERTY_TYPE_STRING, hal_device_get_udi(parent),
++			      "info.subsystem", HAL_PROPERTY_TYPE_STRING, "drm",
++			      NULL))
++      continue;
++
+     if (! hal_device_property_get_bool(parent, "info.ignore"))
+       {
+         Card *card;

Added: head/sysutils/hal/files/patch-hald_freebsd_probing_probe-storage.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/sysutils/hal/files/patch-hald_freebsd_probing_probe-storage.c	Sat Sep 29 18:17:59 2012	(r305045)
@@ -0,0 +1,39 @@
+--- hald/freebsd/probing/probe-storage.c.orig	2009-08-24 14:42:29.000000000 +0200
++++ hald/freebsd/probing/probe-storage.c	2012-09-27 12:03:02.000000000 +0200
+@@ -236,7 +236,27 @@
+ 
+       hfp_cdrom_free(cdrom);
+     }
+-  else if (! has_children) /* by definition, if it has children it has no fs */
++  else
++    {
++      int fd;
++      off_t size;
++
++      fd = open(device_file, O_RDONLY | O_NONBLOCK);
++      if (fd > -1)
++	{
++	  libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.removable.media_available", TRUE, &hfp_error);
++	  if (ioctl (fd, DIOCGMEDIASIZE, &size) == 0)
++	    {
++	      libhal_device_set_property_uint64(hfp_ctx, hfp_udi, "storage.removable.media_size", size, &hfp_error);
++	    }
++	  close(fd);
++	}
++      else
++	{
++	  libhal_device_set_property_bool(hfp_ctx, hfp_udi, "storage.removable.media_available", FALSE, &hfp_error);
++	}
++
++      if (! has_children) /* by definition, if it has children it has no fs */
+     {
+       struct volume_id *vid;
+ 
+@@ -249,6 +269,7 @@
+ 
+       volume_id_close(vid);
+     }
++    }
+ 
+  end:
+   return ret;
_______________________________________________
svn-ports-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-ports-all
To unsubscribe, send any mail to "svn-ports-all-unsubscribe@freebsd.org"
Comment 3 Koop Mast freebsd_committer freebsd_triage 2012-09-29 19:18:42 UTC
State Changed
From-To: open->closed

Committed thanks!