summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2009-12-24 03:20:50 +0800
committermarcus <marcus@df743ca5-7f9a-e211-a948-0013205c9059>2009-12-24 03:20:50 +0800
commite9f273f2b04ce3a2d949098c5a6a529441e967bd (patch)
tree63ac5a1da97d6819f3a2a7056d852b16751e728d
parent51b484f9b07e185f12ae1e5664c01612858d41df (diff)
downloadmarcuscom-ports-e9f273f2b04ce3a2d949098c5a6a529441e967bd.tar
marcuscom-ports-e9f273f2b04ce3a2d949098c5a6a529441e967bd.tar.gz
marcuscom-ports-e9f273f2b04ce3a2d949098c5a6a529441e967bd.tar.bz2
marcuscom-ports-e9f273f2b04ce3a2d949098c5a6a529441e967bd.tar.lz
marcuscom-ports-e9f273f2b04ce3a2d949098c5a6a529441e967bd.tar.xz
marcuscom-ports-e9f273f2b04ce3a2d949098c5a6a529441e967bd.tar.zst
marcuscom-ports-e9f273f2b04ce3a2d949098c5a6a529441e967bd.zip
Update to 0.5.14.
git-svn-id: svn://creme-brulee.marcuscom.com/ports/trunk@13294 df743ca5-7f9a-e211-a948-0013205c9059
-rw-r--r--sysutils/hal/Makefile122
-rw-r--r--sysutils/hal/distinfo3
-rw-r--r--sysutils/hal/files/10-mouse-sysmouse.fdi8
-rw-r--r--sysutils/hal/files/README.fuse31
-rw-r--r--sysutils/hal/files/extra-patch-tools_hal-storage-mount.c25
-rw-r--r--sysutils/hal/files/hald.in80
-rwxr-xr-xsysutils/hal/files/mount-fuse153
-rw-r--r--sysutils/hal/files/patch-Makefile.in31
-rw-r--r--sysutils/hal/files/patch-doc_Makefile.in11
-rw-r--r--sysutils/hal/files/patch-fdi_policy_10osvendor_10-power-mgmt-policy.fdi13
-rw-r--r--sysutils/hal/files/patch-fdi_policy_10osvendor_10-x11-input.fdi31
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_addons_addon-storage.c105
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_hf-usb2.c107
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_hf-volume.c16
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_probing_probe-volume.c31
-rw-r--r--sysutils/hal/files/patch-hald_hf-storage.c77
-rw-r--r--sysutils/hal/files/patch-tools_hal-storage-eject.c11
-rw-r--r--sysutils/hal/files/patch-tools_hal-storage-mount.c91
-rw-r--r--sysutils/hal/files/patch-tools_hal-storage-shared.c45
-rw-r--r--sysutils/hal/files/pkg-deinstall.in17
-rw-r--r--sysutils/hal/files/pkg-install.in25
-rw-r--r--sysutils/hal/pkg-descr6
-rw-r--r--sysutils/hal/pkg-plist130
23 files changed, 1169 insertions, 0 deletions
diff --git a/sysutils/hal/Makefile b/sysutils/hal/Makefile
new file mode 100644
index 000000000..5cd9b9d55
--- /dev/null
+++ b/sysutils/hal/Makefile
@@ -0,0 +1,122 @@
+# New ports collection makefile for: HAL
+# Date Created: 02 May 2006
+# Whom: Joe Marcus Clarke <marcus@FreeBSD.org>
+#
+# $FreeBSD$
+# $MCom: ports/sysutils/hal/Makefile,v 1.72 2009/11/28 05:59:03 mezz Exp $
+#
+
+PORTNAME= hal
+DISTVERSION= 0.5.14
+CATEGORIES= sysutils
+MASTER_SITES= http://hal.freedesktop.org/releases/
+
+MAINTAINER= gnome@FreeBSD.org
+COMMENT= Hardware Abstraction Layer for simplifying device access
+
+LIB_DEPENDS= polkit.2:${PORTSDIR}/sysutils/policykit \
+ volume_id.0:${PORTSDIR}/devel/libvolume_id \
+ ck-connector.0:${PORTSDIR}/sysutils/consolekit
+RUN_DEPENDS= ${LOCALBASE}/share/pciids/pci.ids:${PORTSDIR}/misc/pciids
+
+USE_GETTEXT= yes
+USE_GMAKE= yes
+USE_GNOME= gnomehack intlhack ltverhack
+USE_AUTOTOOLS= libtool:22
+USE_LDCONFIG= yes
+USE_PYTHON= yes
+CONFIGURE_ARGS= --disable-gtk-doc \
+ --with-backend=freebsd \
+ --disable-docbook-docs \
+ --with-pci-ids=${LOCALBASE}/share/pciids \
+ --disable-usb-ids \
+ --without-libpci \
+ --disable-usb \
+ --disable-smbios \
+ --disable-apm \
+ --disable-pmu \
+ --enable-policy-kit \
+ --enable-console-kit \
+ --with-socket-dir=/var/run/hald \
+ --with-eject=/usr/sbin/cdcontrol \
+ --with-pid-file=/var/run/hald/hald.pid \
+ --with-deprecated-keys \
+ --localstatedir=/var
+CONFIGURE_ENV= CPPFLAGS="-I${LOCALBASE}/include" \
+ LDFLAGS="-L${LOCALBASE}/lib" \
+ GTKDOC="false"
+
+#HALVERSION= 0.5.10
+#SNAPVERSION= 20080218
+
+USERS= haldaemon
+GROUPS= haldaemon
+
+USE_RC_SUBR= hald
+USE_GNOME_SUBR= yes
+DOCSDIR= ${PREFIX}/share/doc/${PORTNAME}-${DISTVERSION}
+PLIST_SUB= VERSION=${DISTVERSION}
+
+RC_FILES= hal.conf:${PREFIX}/etc/dbus-1/system.d
+PLIST_FILES= ${PRIV_FILES:S|^|%%DATADIR%%/dist/|}
+
+SUB_FILES= pkg-install pkg-deinstall
+SUB_LIST= RC_FILES="${RC_FILES}"
+
+MAN1= hal-disable-polling.1 hal-find-by-capability.1 \
+ hal-find-by-property.1 hal-get-property.1 \
+ hal-is-caller-locked-out.1 hal-is-caller-privileged.1 \
+ hal-lock.1 hal-set-property.1 lshal.1
+MAN8= hald.8
+
+OPTIONS= FIXED_MOUNTPOINTS "use fixed mountpoints" off
+
+.include <bsd.port.pre.mk>
+
+.if (${ARCH}=="i386" || ${ARCH}=="amd64" || ${ARCH}=="ia64")
+RUN_DEPENDS+= dmidecode:${PORTSDIR}/sysutils/dmidecode
+.endif
+
+.if defined(WITH_FIXED_MOUNTPOINTS)
+EXTRA_PATCHES+= ${FILESDIR}/extra-patch-tools_hal-storage-mount.c
+.endif
+
+.if ${OSVERSION} >= 800063
+PLIST_SUB+= USB2=""
+.else
+PLIST_SUB+= USB2="@comment "
+.endif
+
+post-patch:
+ @${REINPLACE_CMD} -e '/^scriptdir = /s|[(]libexecdir[)]/scripts|(libexecdir)/hal/scripts|' \
+ ${WRKSRC}/tools/Makefile.in \
+ ${WRKSRC}/tools/freebsd/Makefile.in
+ @${REINPLACE_CMD} -e 's|[(]libexecdir[)]/scripts|(libexecdir)/hal/scripts|' \
+ ${WRKSRC}/hald/Makefile.in \
+ ${WRKSRC}/tools/Makefile.in
+ @${REINPLACE_CMD} -e 's|user="0"|group="operator"|g' \
+ ${WRKSRC}/hal.conf.in
+ @${SED} -e 's|%%LOCALBASE%%|${LOCALBASE}|' \
+ < ${FILESDIR}/README.fuse > ${WRKDIR}/README.fuse
+
+post-install:
+ ${MKDIR} ${DATADIR}/dist
+ ${INSTALL_DATA} ${WRKSRC}/hal.conf ${DATADIR}/dist
+ ${MKDIR} ${PREFIX}/share/hal/fdi/policy/10osvendor
+ ${INSTALL_DATA} ${FILESDIR}/10-mouse-sysmouse.fdi \
+ ${PREFIX}/share/hal/fdi/policy/10osvendor
+ ${INSTALL_SCRIPT} ${FILESDIR}/mount-fuse \
+ ${PREFIX}/share/hal/mount-fuse
+.if !defined(PACKAGE_BUILDING)
+ @${SETENV} PKG_PREFIX=${PREFIX} \
+ ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL
+.endif
+.if !defined(NOPORTDOCS)
+ ${MKDIR} ${DOCSDIR}
+ ${INSTALL_DATA} ${WRKSRC}/hald/freebsd/README \
+ ${DOCSDIR}/README.freebsd
+ ${INSTALL_DATA} ${WRKDIR}/README.fuse \
+ ${DOCSDIR}/README.fuse
+.endif
+
+.include <bsd.port.post.mk>
diff --git a/sysutils/hal/distinfo b/sysutils/hal/distinfo
new file mode 100644
index 000000000..ff1858776
--- /dev/null
+++ b/sysutils/hal/distinfo
@@ -0,0 +1,3 @@
+MD5 (hal-0.5.14.tar.gz) = e9163df591a6f38f59fdbfe33e73bf20
+SHA256 (hal-0.5.14.tar.gz) = 323aacfa52f12def3b0d1e76456e34f027c345adc344aad19a8cc0c59c1a8d02
+SIZE (hal-0.5.14.tar.gz) = 1238766
diff --git a/sysutils/hal/files/10-mouse-sysmouse.fdi b/sysutils/hal/files/10-mouse-sysmouse.fdi
new file mode 100644
index 000000000..cffd4f624
--- /dev/null
+++ b/sysutils/hal/files/10-mouse-sysmouse.fdi
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<deviceinfo version="0.2">
+ <device>
+ <match key="info.capabilities" contains="input.mouse">
+ <append key="info.addons" type="strlist">hald-addon-mouse-sysmouse</append>
+ </match>
+ </device>
+</deviceinfo>
diff --git a/sysutils/hal/files/README.fuse b/sysutils/hal/files/README.fuse
new file mode 100644
index 000000000..bf610ae53
--- /dev/null
+++ b/sysutils/hal/files/README.fuse
@@ -0,0 +1,31 @@
+Mounting Fuse File Systems with HAL
+-----------------------------------
+
+$FreeBSD: ports/sysutils/hal/files/README.fuse,v 1.2 2009/11/28 20:06:01 marcus Exp $
+
+Hal supports mounting Fuse device-backed file systems (e.g. NTFS). To enable
+this feature, copy the included %%LOCALBASE%%/share/hal/mount-fuse script
+to /sbin. Make sure this script is executable. Edit the script, and change
+the FUSE_HELPER environment variable to the name of the executable which
+will actually mount the Fuse volume (e.g. for NTFS, this is ``ntfs-3g'').
+
+Finally, the script must be renamed to ``mount_FSNAME''. FSNAME is the name
+of the file system type (e.g. for NTFS, this is ``ntfs''). If there is
+already an executable in /sbin or /usr/sbin with this name, the
+existing executable must be renamed or deleted.
+
+As is stated in the examples above, overriding FreeBSD's existing NTFS
+support with Fuse's ntfs-3g is the most common use case for this. The
+ntfs-3g Fuse driver uses different mount options than FreeBSD's included
+mount_ntfs. GNOME transparently supports switching between ntfs and
+ntfs-3g. Simply edit the following GConf key in the GNOME
+Configuration Editor (i.e. gconf-editor):
+
+/system/storage/default_options/ntfs/fstype_override
+
+Set the value to ``ntfs-3g'', then add your desired ntfs-3g options to the
+following GConf key:
+
+/system/storage/default_options/ntfs-3g/mount_options
+
+Other desktop systems may have similar options.
diff --git a/sysutils/hal/files/extra-patch-tools_hal-storage-mount.c b/sysutils/hal/files/extra-patch-tools_hal-storage-mount.c
new file mode 100644
index 000000000..f505709e1
--- /dev/null
+++ b/sysutils/hal/files/extra-patch-tools_hal-storage-mount.c
@@ -0,0 +1,25 @@
+--- tools/hal-storage-mount.c.orig 2008-05-20 13:24:30.000000000 -0400
++++ tools/hal-storage-mount.c 2008-05-20 13:30:14.000000000 -0400
+@@ -585,17 +585,11 @@ handle_mount (LibHalContext *hal_ctx,
+ explicit_mount_point_given = FALSE;
+ if (strlen (mount_point) == 0) {
+ char *p;
+-
+- if (label != NULL) {
+- /* best - use label */
+- g_strlcpy (mount_point, label, sizeof (mount_point));
+-
+- /* TODO: use drive type */
+-
+- } else {
+- /* fallback - use "disk" */
+- g_snprintf (mount_point, sizeof (mount_point), "%s", "disk");
+- }
++ char *basename;
++
++ basename = g_path_get_basename (device);
++ g_strlcpy (mount_point, basename, sizeof (mount_point));
++ g_free (basename);
+
+ /* sanitize computed mount point name, e.g. replace invalid chars with '-' */
+ p = mount_point;
diff --git a/sysutils/hal/files/hald.in b/sysutils/hal/files/hald.in
new file mode 100644
index 000000000..31bb3ffa3
--- /dev/null
+++ b/sysutils/hal/files/hald.in
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# $FreeBSD: ports/sysutils/hal/files/hald.in,v 1.9 2009/11/28 20:06:02 marcus Exp $
+# $MCom: ports/sysutils/hal/files/hald.in,v 1.17 2009/09/26 13:42:01 marcus Exp $
+#
+# PROVIDE: hald
+# REQUIRE: DAEMON usbd devd dbus moused
+#
+# Add the following line to /etc/rc.conf to enable the HAL daemon:
+#
+# hald_enable="YES"
+#
+
+. %%RC_SUBR%%
+. %%GNOME_SUBR%%
+
+hald_enable=${hald_enable-${gnome_enable}}
+hald_flags=${hald_flags-""}
+
+name=hald
+rcvar=`set_rcvar`
+
+command="%%PREFIX%%/sbin/hald"
+pidfile="/var/run/${name}/${name}.pid"
+
+stop_postcmd="hald_postcmd"
+start_precmd="hald_precmd"
+start_cmd="hald_start"
+
+local_force_depend()
+{
+ _depend="$1"
+ if [ -f %%LOCALBASE%%/etc/rc.d/${_depend}.sh ]; then
+ _depend="${_depend}.sh"
+ fi
+
+ if ! %%LOCALBASE%%/etc/rc.d/${_depend} forcestatus 1>/dev/null 2>&1 &&
+ ! %%LOCALBASE%%/etc/rc.d/${_depend} forcestart; then
+ return 1
+ fi
+ return 0
+}
+
+hald_precmd()
+{
+ if ! checkyesno dbus_enable
+ then
+ local_force_depend dbus || return 1
+ fi
+
+ chmod 0755 /var/cache
+
+ mkdir -p $(dirname $pidfile)
+}
+
+hald_postcmd()
+{
+ rm -f $pidfile
+}
+
+hald_start()
+{
+ if ! checkyesno hald_enable ; then
+ return 0
+ fi
+ echo "Starting ${name}."
+
+ ( iter=0
+ while ! ps -axoargs | grep "^/usr/libexec/getty " | grep -qv grep >/dev/null 2>&1; do
+ if [ ${iter} -eq 60 ]; then
+ break
+ fi
+ sleep 1
+ iter=$(expr ${iter} + 1)
+ done
+ ${command} ${hald_flags} ) &
+}
+
+load_rc_config ${name}
+run_rc_command "$1"
diff --git a/sysutils/hal/files/mount-fuse b/sysutils/hal/files/mount-fuse
new file mode 100755
index 000000000..a0ea8536e
--- /dev/null
+++ b/sysutils/hal/files/mount-fuse
@@ -0,0 +1,153 @@
+#!/bin/sh
+# Wrapper script for FreeBSD and PC-BSD, which takes calls from HAL
+# for running mount_ntfs, and performs it with a given FUSE helper.
+###################################################################
+
+## Modify this next variable to point to the correct FUSE helper.
+FUSE_HELPER="ntfs-3g"
+## DO NOT modify anything below this.
+
+FUSEDB="/tmp"
+if [ -n "${TMPDIR}" ]
+then
+ FUSEDB=${TMPDIR}
+fi
+
+FUSEDB="${FUSEDB}/.fuse-mnts"
+MNTSTRING=""
+OPTIONS=""
+FOUNDOPT="0"
+FOUNDU="0"
+FOUNDG="0"
+FOUNDBADARG="0"
+HWDEV=""
+FOUNDDEV="0"
+
+for i in $@
+do
+ if [ "$FOUNDOPT" = "1" ]
+ then
+ OPTIONS="${OPTIONS} -o ${i}"
+ elif [ "${FOUNDU}" = "1" ]
+ then
+ OPTIONS="${OPTIONS} -o uid=${i}"
+ elif [ "${FOUNDG}" = "1" ]
+ then
+ OPTIONS="${OPTIONS} -o gid=${i}"
+ elif [ "${FOUNDBADARG}" = "1" ]
+ then
+ # We have an invalid argument flag, so ignore it and following argument
+ FOUNDBADARG="0"
+ else
+
+ if [ "${FOUNDDEV}" = "1" ]
+ then
+ # Save the mount-point, will be used later
+ MNTPOINT="${i}"
+ FOUNDDEV="2"
+ fi
+
+ echo ${i}| grep -q "/dev" 2>/dev/null
+ if [ "$?" = "0" -a "${FOUNDDEV}" = "0" ]
+ then
+ FOUNDDEV="1"
+ # Lets check if we were given a fuse[] device
+ # or a real device name
+ echo "${i}" | grep -q "fuse" 2>/dev/null
+ if [ "$?" = "0" ]
+ then
+ # Lets save the old fuse device name we had saved
+ OLDFUSE="${i}"
+
+ # Lets get the *real* device name for FUSE helper
+ REALHWDEV="`cat ${FUSEDB} | grep ${i} | cut -d '=' -f 2`"
+
+ # Now lets change the string we will be saving
+ i="${REALHWDEV}"
+ else
+ # We are doing a first time mount of this device
+
+ # Set the real device name for mounting
+ REALHWDEV="${i}"
+ fi
+ fi
+
+ # Add the value to our mount string if it isn't any invalid flag
+ if [ "${i}" != "-o" -a "${i}" != "-u" -a "${i}" != "-C" -a "${i}" != "-g" -a "${i}" != "-m" -a "${i}" != "-a" -a "${i}" != "-i" -a "${i}" -a "-W" ]
+ then
+ MNTSTRING="${MNTSTRING} ${i}"
+ fi
+
+ fi
+
+ # Check if we are on a -u user id flag now
+ if [ "${i}" = "-u" ]
+ then
+ FOUNDU="1"
+ else
+ FOUNDU="0"
+ fi
+
+ # Check if we are on a -g group id flag now
+ if [ "${i}" = "-g" ]
+ then
+ FOUNDG="1"
+ else
+ FOUNDG="0"
+ fi
+
+ # Check if we are on a -o option
+ if [ "${i}" = "-o" ]
+ then
+ FOUNDOPT="1"
+ else
+ FOUNDOPT="0"
+ fi
+
+ # Check if we are on some other invalid flag
+ if [ "${i}" = "-C" -o "${i}" = "-m" -o "${i}" = "-W" ]
+ then
+ FOUNDBADARG="1"
+ else
+ FOUNDBADARG="0"
+ fi
+done
+
+# Save our final string which our FUSE helper will use
+FINALSTRING="${MNTSTRING} ${OPTIONS}"
+
+# Check that fuse.ko is loaded
+kldstat | grep -q fuse 2>/dev/null
+if [ "$?" != "0" ]
+then
+ kldload /usr/local/modules/fuse.ko
+fi
+
+# Run the FUSE helper command now, with the options in the right order
+${FUSE_HELPER} ${FINALSTRING}
+
+# If we have an OLDFUSE variable, lets clear it from the list
+if [ ! -z "${OLDFUSE}" -a -e ${FUSEDB} ]
+then
+ cat ${FUSEDB} | grep -v "${OLDFUSE}=" > /tmp/.newfuse
+ mv /tmp/.newfuse ${FUSEDB}
+fi
+
+# Now lets figure out which fuse device was used and save it to DB
+NEWFUSE="`mount | tr -s ' ' | grep \" ${MNTPOINT} \" | cut -d ' ' -f 1`"
+
+# Make sure we don't already have this fuse device listed
+if [ -e ${FUSEDB} ]
+then
+ cat ${FUSEDB} | grep -v "${NEWFUSE}=" > /tmp/.newfuse
+ mv /tmp/.newfuse ${FUSEDB}
+else
+ touch ${FUSEDB}
+fi
+
+# Save the fuse device to our DB
+echo "${NEWFUSE}=${REALHWDEV}" >> ${FUSEDB}
+
+
+# Finished!
+exit 0
diff --git a/sysutils/hal/files/patch-Makefile.in b/sysutils/hal/files/patch-Makefile.in
new file mode 100644
index 000000000..46b74a5b1
--- /dev/null
+++ b/sysutils/hal/files/patch-Makefile.in
@@ -0,0 +1,31 @@
+--- Makefile.in.orig 2009-12-23 13:39:15.000000000 -0500
++++ Makefile.in 2009-12-23 13:39:58.000000000 -0500
+@@ -379,17 +379,17 @@ clean-libtool:
+ distclean-libtool:
+ -rm -f libtool config.lt
+ install-dist_dbusDATA: $(dist_dbus_DATA)
+- @$(NORMAL_INSTALL)
+- test -z "$(dbusdir)" || $(MKDIR_P) "$(DESTDIR)$(dbusdir)"
+- @list='$(dist_dbus_DATA)'; test -n "$(dbusdir)" || list=; \
+- for p in $$list; do \
+- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+- echo "$$d$$p"; \
+- done | $(am__base_list) | \
+- while read files; do \
+- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbusdir)'"; \
+- $(INSTALL_DATA) $$files "$(DESTDIR)$(dbusdir)" || exit $$?; \
+- done
++# @$(NORMAL_INSTALL)
++# test -z "$(dbusdir)" || $(MKDIR_P) "$(DESTDIR)$(dbusdir)"
++# @list='$(dist_dbus_DATA)'; test -n "$(dbusdir)" || list=; \
++# for p in $$list; do \
++# if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
++# echo "$$d$$p"; \
++# done | $(am__base_list) | \
++# while read files; do \
++# echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dbusdir)'"; \
++# $(INSTALL_DATA) $$files "$(DESTDIR)$(dbusdir)" || exit $$?; \
++# done
+
+ uninstall-dist_dbusDATA:
+ @$(NORMAL_UNINSTALL)
diff --git a/sysutils/hal/files/patch-doc_Makefile.in b/sysutils/hal/files/patch-doc_Makefile.in
new file mode 100644
index 000000000..9cd951720
--- /dev/null
+++ b/sysutils/hal/files/patch-doc_Makefile.in
@@ -0,0 +1,11 @@
+--- doc/Makefile.in.orig 2008-01-03 21:41:19.000000000 -0500
++++ doc/Makefile.in 2008-01-03 21:41:31.000000000 -0500
+@@ -203,7 +203,7 @@ target_alias = @target_alias@
+ top_builddir = @top_builddir@
+ top_srcdir = @top_srcdir@
+ EXTRA_DIST = TODO
+-SUBDIRS = api spec man
++SUBDIRS = spec man
+ MAINTAINERCLEANFILES = \
+ *~ \
+ Makefile.in
diff --git a/sysutils/hal/files/patch-fdi_policy_10osvendor_10-power-mgmt-policy.fdi b/sysutils/hal/files/patch-fdi_policy_10osvendor_10-power-mgmt-policy.fdi
new file mode 100644
index 000000000..1391709f8
--- /dev/null
+++ b/sysutils/hal/files/patch-fdi_policy_10osvendor_10-power-mgmt-policy.fdi
@@ -0,0 +1,13 @@
+--- fdi/policy/10osvendor/10-power-mgmt-policy.fdi.orig 2008-05-07 19:21:15.000000000 -0400
++++ fdi/policy/10osvendor/10-power-mgmt-policy.fdi 2009-01-30 17:41:05.000000000 -0500
+@@ -10,7 +10,9 @@
+
+ <device>
+ <match key="power_management.type" string="acpi">
+- <append key="info.addons" type="strlist">hald-addon-acpi</append>
++ <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name" string="Linux">
++ <append key="info.addons" type="strlist">hald-addon-acpi</append>
++ </match>
+ </match>
+ </device>
+
diff --git a/sysutils/hal/files/patch-fdi_policy_10osvendor_10-x11-input.fdi b/sysutils/hal/files/patch-fdi_policy_10osvendor_10-x11-input.fdi
new file mode 100644
index 000000000..bb18f3310
--- /dev/null
+++ b/sysutils/hal/files/patch-fdi_policy_10osvendor_10-x11-input.fdi
@@ -0,0 +1,31 @@
+--- fdi/policy/10osvendor/10-x11-input.fdi.orig 2009-06-26 03:28:39.000000000 -0400
++++ fdi/policy/10osvendor/10-x11-input.fdi 2009-07-18 21:19:15.000000000 -0400
+@@ -7,15 +7,6 @@
+ <merge key="input.x11_driver" type="string">evdev</merge>
+ </match>
+
+- <!-- FIXME: Support tablets too. -->
+- <match key="info.capabilities" contains="input.mouse">
+- <merge key="input.x11_driver" type="string">mouse</merge>
+- <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
+- string="Linux">
+- <merge key="input.x11_driver" type="string">evdev</merge>
+- </match>
+- </match>
+-
+ <match key="info.capabilities" contains="input.tablet">
+ <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
+ string="Linux">
+@@ -23,10 +14,10 @@
+ </match>
+ </match>
+
+- <match key="info.capabilities" contains="input.keys">
++ <match key="info.capabilities" contains="input.keyboard">
+ <!-- If we're using Linux, we use evdev by default (falling back to
+ keyboard otherwise). -->
+- <merge key="input.x11_driver" type="string">keyboard</merge>
++ <merge key="input.x11_driver" type="string">kbd</merge>
+ <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
+ string="Linux">
+ <merge key="input.x11_driver" type="string">evdev</merge>
diff --git a/sysutils/hal/files/patch-hald_freebsd_addons_addon-storage.c b/sysutils/hal/files/patch-hald_freebsd_addons_addon-storage.c
new file mode 100644
index 000000000..fed388c95
--- /dev/null
+++ b/sysutils/hal/files/patch-hald_freebsd_addons_addon-storage.c
@@ -0,0 +1,105 @@
+--- hald/freebsd/addons/addon-storage.c.orig 2009-08-24 08:42:29.000000000 -0400
++++ hald/freebsd/addons/addon-storage.c 2009-12-23 13:53:00.000000000 -0500
+@@ -107,8 +107,7 @@ hf_addon_storage_update (void)
+
+ if (hf_addon_storage_cdrom_eject_pressed(cdrom))
+ {
+- libhal_device_emit_condition(hfp_ctx, hfp_udi, "EjectPressed", "", &hfp_error);
+- dbus_error_free(&hfp_error);
++ libhal_device_emit_condition(hfp_ctx, hfp_udi, "EjectPressed", "", NULL);
+ }
+
+ hfp_cdrom_free(cdrom);
+@@ -164,19 +163,17 @@ unmount_volumes (void)
+ "block.storage_device",
+ hfp_udi,
+ &num_volumes,
+- &hfp_error)) != NULL)
++ NULL)) != NULL)
+ {
+ int i;
+
+- dbus_error_free(&hfp_error);
+-
+ for (i = 0; i < num_volumes; i++)
+ {
+ char *vol_udi;
+
+ vol_udi = volumes[i];
+
+- if (libhal_device_get_property_bool(hfp_ctx, vol_udi, "volume.is_mounted", &hfp_error))
++ if (libhal_device_get_property_bool(hfp_ctx, vol_udi, "volume.is_mounted", NULL))
+ {
+ DBusMessage *msg = NULL;
+ DBusMessage *reply = NULL;
+@@ -185,7 +182,6 @@ unmount_volumes (void)
+ char **options = NULL;
+ char *devfile;
+
+- dbus_error_free(&hfp_error);
+ hfp_info("Forcing unmount of volume '%s'", vol_udi);
+
+ dbus_connection = libhal_ctx_get_dbus_connection(hfp_ctx);
+@@ -265,10 +261,9 @@ poll_for_media (boolean check_only, bool
+ check_lock_state = FALSE;
+
+ hfp_info("Checking whether device %s is locked by HAL", addon.device_file);
+- if (libhal_device_is_locked_by_others(hfp_ctx, hfp_udi, "org.freedesktop.Hal.Device.Storage", &hfp_error))
++ if (libhal_device_is_locked_by_others(hfp_ctx, hfp_udi, "org.freedesktop.Hal.Device.Storage", NULL))
+ {
+ hfp_info("... device %s is locked by HAL", addon.device_file);
+- dbus_error_free(&hfp_error);
+ is_locked_by_hal = TRUE;
+ update_proc_title(addon.device_file);
+ goto skip_check;
+@@ -278,10 +273,8 @@ poll_for_media (boolean check_only, bool
+ hfp_info("... device %s is not locked by HAL", addon.device_file);
+ is_locked_by_hal = FALSE;
+ }
+- dbus_error_free(&hfp_error);
+
+- should_poll = libhal_device_get_property_bool(hfp_ctx, hfp_udi, "storage.media_check_enabled", &hfp_error);
+- dbus_error_free(&hfp_error);
++ should_poll = libhal_device_get_property_bool(hfp_ctx, hfp_udi, "storage.media_check_enabled", NULL);
+ polling_disabled = ! should_poll;
+ update_proc_title(addon.device_file);
+ }
+@@ -314,8 +307,7 @@ poll_for_media (boolean check_only, bool
+ unmount_volumes();
+ #endif
+
+- libhal_device_rescan(hfp_ctx, hfp_udi, &hfp_error);
+- dbus_error_free(&hfp_error);
++ libhal_device_rescan(hfp_ctx, hfp_udi, NULL);
+ addon.had_media = has_media;
+
+ return TRUE;
+@@ -412,12 +404,10 @@ main (int argc, char **argv)
+ ! strcmp(driver, "cd")))) && ! strcmp(removable, "true");
+ addon.had_media = poll_for_media(TRUE, FALSE);
+
+- if (! libhal_device_addon_is_ready(hfp_ctx, hfp_udi, &hfp_error))
++ if (! libhal_device_addon_is_ready(hfp_ctx, hfp_udi, NULL))
+ goto end;
+- dbus_error_free(&hfp_error);
+
+- syscon = dbus_bus_get(DBUS_BUS_SYSTEM, &hfp_error);
+- dbus_error_free(&hfp_error);
++ syscon = dbus_bus_get(DBUS_BUS_SYSTEM, NULL);
+ assert(syscon != NULL);
+ dbus_connection_set_exit_on_disconnect(syscon, 0);
+
+@@ -452,12 +442,11 @@ main (int argc, char **argv)
+ " <method name=\"CheckForMedia\">\n"
+ " <arg name=\"call_had_sideeffect\" direction=\"out\" type=\"b\"/>\n"
+ " </method>\n",
+- &hfp_error))
++ NULL))
+ {
+ hfp_critical("Cannot claim interface 'org.freedesktop.Hal.Device.Storage.Removable'");
+ goto end;
+ }
+- dbus_error_free(&hfp_error);
+
+ while (TRUE)
+ {
diff --git a/sysutils/hal/files/patch-hald_freebsd_hf-usb2.c b/sysutils/hal/files/patch-hald_freebsd_hf-usb2.c
new file mode 100644
index 000000000..1008774e5
--- /dev/null
+++ b/sysutils/hal/files/patch-hald_freebsd_hf-usb2.c
@@ -0,0 +1,107 @@
+--- hald/freebsd/hf-usb2.c.orig 2009-08-24 08:42:29.000000000 -0400
++++ hald/freebsd/hf-usb2.c 2009-12-23 14:16:03.000000000 -0500
+@@ -98,10 +98,10 @@ hf_usb2_probe_interfaces(HalDevice *pare
+ if (driver)
+ {
+ if (! strcmp(driver, "ukbd"))
+- hf_device_set_input(device, "keyboard", NULL);
+- else if (! strcmp(driver, "ums"))
++ hf_device_set_input(device, "keyboard", "keys", devname);
++ else if (! strcmp(driver, "ums") || ! strcmp(driver, "atp"))
+ {
+- hf_device_set_input(device, "mouse", devname);
++ hf_device_set_input(device, "mouse", NULL, devname);
+ hf_runner_run_sync(device, 0, "hald-probe-mouse", NULL);
+ }
+ else if (! strcmp(driver, "uhid"))
+@@ -192,11 +192,12 @@ hf_usb2_probe (void)
+ addr = libusb20_dev_get_address(pdev);
+
+ if (addr == 1)
+- parent = hf_devtree_find_parent_from_info(hald_get_gdl(), "usbus", bus);
++ parent = hf_devtree_find_from_info(hald_get_gdl(), "usbus", bus);
+ else
+ parent = hf_device_store_match(hald_get_gdl(), "usb_device.bus_number",
+ HAL_PROPERTY_TYPE_INT32, bus, "usb_device.port_number",
+- HAL_PROPERTY_TYPE_INT32, addr - 1, NULL);
++ HAL_PROPERTY_TYPE_INT32, addr - 1, "info.bus",
++ HAL_PROPERTY_TYPE_STRING, "usb_device", NULL);
+ if (! parent || hal_device_property_get_bool(parent, "info.ignore"))
+ continue;
+
+@@ -216,7 +217,13 @@ hf_usb2_devd_add (const char *name,
+ HalDevice *parent_device;
+ int bus, addr, pbus, paddr;
+
+- if (strncmp(name, "ugen", strlen("ugen")))
++ if (! parent)
++ return FALSE;
++
++ if (strncmp(name, "ugen", strlen("ugen")) &&
++ ! strncmp(parent, "uhub", strlen("uhub")))
++ return TRUE;
++ else if (strncmp(name, "ugen", strlen("ugen")))
+ return FALSE;
+ else if (strncmp(parent, "ugen", strlen("ugen")))
+ return TRUE;
+@@ -232,7 +239,8 @@ hf_usb2_devd_add (const char *name,
+
+ parent_device = hf_device_store_match(hald_get_gdl(),
+ "usb_device.bus_number", HAL_PROPERTY_TYPE_INT32, pbus,
+- "usb_device.port_number", HAL_PROPERTY_TYPE_INT32, paddr, NULL);
++ "usb_device.port_number", HAL_PROPERTY_TYPE_INT32, paddr, "info.bus",
++ HAL_PROPERTY_TYPE_STRING, "usb_device", NULL);
+
+ if (parent_device && ! hal_device_property_get_bool(parent_device,
+ "info.ignore"))
+@@ -255,8 +263,6 @@ hf_usb2_devd_remove (const char *name,
+
+ if (strncmp(name, "ugen", strlen("ugen")))
+ return FALSE;
+- else if (strncmp(parent, "ugen", strlen("ugen")))
+- return TRUE;
+
+ if (sscanf(name, "ugen%i.%i", &bus, &addr) != 2)
+ return FALSE;
+@@ -265,7 +271,8 @@ hf_usb2_devd_remove (const char *name,
+
+ device = hf_device_store_match(hald_get_gdl(), "usb_device.bus_number",
+ HAL_PROPERTY_TYPE_INT32, bus, "usb_device.port_number",
+- HAL_PROPERTY_TYPE_INT32, addr, NULL);
++ HAL_PROPERTY_TYPE_INT32, addr, "info.bus",
++ HAL_PROPERTY_TYPE_STRING, "usb_device", NULL);
+
+ if (device)
+ {
+@@ -276,6 +283,23 @@ hf_usb2_devd_remove (const char *name,
+ return FALSE;
+ }
+
++static gboolean
++hf_usb2_devd_notify (const char *system,
++ const char *subsystem,
++ const char *type,
++ const char *data)
++{
++ if (! data || strcmp(system, "DEVFS") || strcmp(subsystem, "CDEV") ||
++ (strcmp(type, "CREATE") && strcmp(type, "DESTROY")))
++ return FALSE;
++
++ if (! strncmp(data, "cdev=ugen", strlen("cdev=ugen")) ||
++ ! strncmp(data, "cdev=usb", strlen("cdev=usb")))
++ return TRUE;
++
++ return FALSE;
++}
++
+ HFHandler hf_usb2_handler = {
+ .privileged_init = hf_usb2_privileged_init,
+ .probe = hf_usb2_probe
+@@ -283,5 +307,6 @@ HFHandler hf_usb2_handler = {
+
+ HFDevdHandler hf_usb2_devd_handler = {
+ .add = hf_usb2_devd_add,
+- .remove = hf_usb2_devd_remove
++ .remove = hf_usb2_devd_remove,
++ .notify = hf_usb2_devd_notify
+ };
diff --git a/sysutils/hal/files/patch-hald_freebsd_hf-volume.c b/sysutils/hal/files/patch-hald_freebsd_hf-volume.c
new file mode 100644
index 000000000..4fb0d95b4
--- /dev/null
+++ b/sysutils/hal/files/patch-hald_freebsd_hf-volume.c
@@ -0,0 +1,16 @@
+--- hald/freebsd/hf-volume.c.orig 2009-12-23 14:01:00.000000000 -0500
++++ hald/freebsd/hf-volume.c 2009-12-23 14:01:25.000000000 -0500
+@@ -86,9 +86,12 @@ hf_volume_resolve_fuse (const char *spec
+ {
+ if (strcmp(fields[0], special) == 0)
+ {
++ char *ret;
++
++ ret = g_strdup(fields[1]);
+ g_strfreev(fields);
+ g_strfreev(lines);
+- return g_strdup(fields[1]);
++ return ret;
+ }
+ }
+ g_strfreev(fields);
diff --git a/sysutils/hal/files/patch-hald_freebsd_probing_probe-volume.c b/sysutils/hal/files/patch-hald_freebsd_probing_probe-volume.c
new file mode 100644
index 000000000..1ff3d0206
--- /dev/null
+++ b/sysutils/hal/files/patch-hald_freebsd_probing_probe-volume.c
@@ -0,0 +1,31 @@
+--- hald/freebsd/probing/probe-volume.c.orig 2009-12-23 14:06:53.000000000 -0500
++++ hald/freebsd/probing/probe-volume.c 2009-12-23 14:07:01.000000000 -0500
+@@ -574,6 +574,7 @@ main (int argc, char **argv)
+
+ snprintf(ufsid, sizeof(ufsid), "%08x%08x", ufsdisk.d_fs.fs_id[0], ufsdisk.d_fs.fs_id[1]);
+ libhal_device_set_property_string(hfp_ctx, hfp_udi, "volume.freebsd.ufsid", ufsid, &hfp_error);
++ dbus_error_free(&hfp_error);
+ ufs_devs = libhal_manager_find_device_string_match(hfp_ctx,
+ "volume.freebsd.ufsid",
+ ufsid,
+@@ -582,16 +583,17 @@ main (int argc, char **argv)
+ dbus_error_free(&hfp_error);
+ for (i = 0; i < num_udis; i++)
+ {
+- if (ufs_devs[i] != NULL)
++ if (ufs_devs[i] != NULL && strcmp(ufs_devs[i], hfp_udi))
+ {
+ gboolean mounted;
+
+ mounted = libhal_device_get_property_bool(hfp_ctx, ufs_devs[i], "volume.is_mounted", &hfp_error);
+- dbus_error_free(&hfp_error);
++ dbus_error_free(&hfp_error);
+ if (mounted)
+- {
++ {
+ libhal_device_set_property_bool(hfp_ctx, hfp_udi, "volume.ignore", TRUE, &hfp_error);
+ dbus_error_free(&hfp_error);
++ break;
+ }
+ }
+ }
diff --git a/sysutils/hal/files/patch-hald_hf-storage.c b/sysutils/hal/files/patch-hald_hf-storage.c
new file mode 100644
index 000000000..513e845b0
--- /dev/null
+++ b/sysutils/hal/files/patch-hald_hf-storage.c
@@ -0,0 +1,77 @@
+--- hald/freebsd/hf-storage.c.orig 2009-08-24 08:42:29.000000000 -0400
++++ hald/freebsd/hf-storage.c 2009-12-23 14:09:05.000000000 -0500
+@@ -30,6 +30,7 @@
+ #include <limits.h>
+ #include <inttypes.h>
+ #include <string.h>
++#include <unistd.h>
+ #include <sys/param.h>
+ #include <sys/types.h>
+ #include <sys/disklabel.h>
+@@ -418,10 +419,39 @@ hf_storage_parse_conftxt (const char *co
+ continue;
+ }
+
++ /* XXX This is a hack, but we need to ignore dynamic labels like
++ * ufsids which are created and destroyed based on whether or not
++ * the actual device is mounted or not. If we don't then strange
++ * things happen in applications like nautilus.
++ */
++ if ((! strcmp(fields[1], "LABEL") ||
++ ! strcmp(fields[1], "BSD")) &&
++ ! strncmp(fields[2], "ufsid/", strlen("ufsid/")))
++ {
++ g_strfreev(fields);
++ continue;
++ }
++
+ geom_obj = g_new0(Geom_Object, 1);
+
+ geom_obj->class = g_strdup(fields[1]);
+ geom_obj->dev = g_strdup(fields[2]);
++ /* Allow for spaces in label names. */
++ if (! strcmp(fields[1], "LABEL"))
++ {
++ int j;
++
++ for (j = 3; g_strv_length(fields) > (j + 2) &&
++ strcmp(fields[j + 2], "i"); j++)
++ {
++ char *tmp;
++
++ tmp = g_strdup_printf("%s %s", geom_obj->dev, fields[j]);
++ g_free(geom_obj->dev);
++ geom_obj->dev = tmp;
++ }
++ }
++
+ geom_obj->type = -1; /* We use -1 here to denote a missing type. */
+ geom_obj->hash = hash;
+
+@@ -589,11 +619,16 @@ hf_storage_devd_notify (const char *syst
+ char *conftxt;
+ GSList *new_disks;
+
+- if (strcmp(system, "DEVFS") || strcmp(subsystem, "CDEV") ||
++ if (! data || strcmp(system, "DEVFS") || strcmp(subsystem, "CDEV") ||
+ (strcmp(type, "CREATE") && strcmp(type, "DESTROY")))
+ return FALSE;
+
++ if (! strcmp(type, "DESTROY"))
++ g_usleep(G_USEC_PER_SEC/2);
++
+ conftxt = hf_get_string_sysctl(NULL, "kern.geom.conftxt");
++ if (! conftxt)
++ return FALSE;
+ new_disks = hf_storage_parse_conftxt(conftxt);
+ g_free(conftxt);
+
+@@ -669,7 +704,7 @@ hf_storage_conftxt_timeout_cb (gpointer
+ if (hf_is_waiting)
+ return TRUE;
+
+- hf_storage_devd_notify("DEVFS", "CDEV", "CREATE", NULL);
++ hf_storage_devd_notify("DEVFS", "CDEV", "CREATE", "");
+
+ return TRUE;
+ }
diff --git a/sysutils/hal/files/patch-tools_hal-storage-eject.c b/sysutils/hal/files/patch-tools_hal-storage-eject.c
new file mode 100644
index 000000000..730e2a076
--- /dev/null
+++ b/sysutils/hal/files/patch-tools_hal-storage-eject.c
@@ -0,0 +1,11 @@
+--- tools/hal-storage-eject.c.orig 2008-10-27 13:23:11.000000000 -0400
++++ tools/hal-storage-eject.c 2008-10-27 13:23:23.000000000 -0400
+@@ -190,7 +190,7 @@ main (int argc, char *argv[])
+ unknown_eject_error ("Cannot obtain lock on /media/.hal-mtab");
+ }
+ handle_unmount (hal_ctx,
+- udi, volume_to_unmount, drive,
++ volume_udi, volume_to_unmount, drive,
+ libhal_volume_get_device_file (volume_to_unmount),
+ invoked_by_uid, invoked_by_syscon_name,
+ FALSE, FALSE); /* use neither lazy nor force */
diff --git a/sysutils/hal/files/patch-tools_hal-storage-mount.c b/sysutils/hal/files/patch-tools_hal-storage-mount.c
new file mode 100644
index 000000000..390d35111
--- /dev/null
+++ b/sysutils/hal/files/patch-tools_hal-storage-mount.c
@@ -0,0 +1,91 @@
+--- tools/hal-storage-mount.c.orig 2008-05-07 19:24:23.000000000 -0400
++++ tools/hal-storage-mount.c 2008-10-09 00:54:34.000000000 -0400
+@@ -56,8 +56,9 @@
+
+ #ifdef __FreeBSD__
+ #define MOUNT "/sbin/mount"
+-#define MOUNT_OPTIONS "noexec,nosuid"
++#define MOUNT_OPTIONS "nosuid"
+ #define MOUNT_TYPE_OPT "-t"
++#define FUSE_DB "/tmp/.fuse-mnts"
+ #elif sun
+ #define MOUNT "/sbin/mount"
+ #define MOUNT_OPTIONS "noexec,nosuid"
+@@ -255,6 +256,51 @@ out:
+ return f;
+ }
+
++#ifdef __FreeBSD__
++static char *
++resolve_fuse (const char *special)
++{
++ gchar *contents;
++ gchar **lines;
++ gsize len;
++ int i;
++
++ if (! g_file_get_contents (FUSE_DB, &contents, &len, NULL))
++ return g_strdup (special);
++
++ lines = g_strsplit (contents, "\n", 0);
++ g_free (contents);
++
++ for (i = 0; lines && lines[i]; i++) {
++ gchar **fields;
++
++ fields = g_strsplit (lines[i], "=", 2);
++ if (fields && g_strv_length (fields) == 2) {
++ if (strcmp (fields[0], special) == 0) {
++ g_strfreev (fields);
++ g_strfreev (lines);
++ return g_strdup (fields[1]);
++ }
++ }
++ g_strfreev (fields);
++ }
++
++ g_strfreev (lines);
++
++ return g_strdup (special);
++}
++#endif
++
++static char *
++resolve_special (const char *special)
++{
++#ifdef __FreeBSD__
++ if (strstr(special, "fuse"))
++ return resolve_fuse (special);
++#endif
++ return g_strdup (special);
++}
++
+ static LibHalVolume *
+ volume_findby (LibHalContext *hal_ctx, const char *property, const char *value)
+ {
+@@ -400,18 +446,20 @@ device_is_mounted (const char *device, c
+ unknown_error ("Cannot open /etc/mtab or equivalent");
+ }
+ while (((entry = mtab_next (handle, mount_point)) != NULL) && (ret == FALSE)) {
+- char *resolved;
++ char *resolved, *rspecial;
+
+ resolved = resolve_symlink (entry);
++ rspecial = resolve_special (resolved);
++ g_free (resolved);
+ #ifdef DEBUG
+- printf ("/proc/mounts: device %s -> %s \n", entry, resolved);
++ printf ("/proc/mounts: device %s -> %s \n", entry, rspecial);
+ #endif
+- if (strcmp (device, resolved) == 0) {
+- printf ("%s (-> %s) found in mount list. Not mounting.\n", entry, resolved);
++ if (strcmp (device, rspecial) == 0) {
++ printf ("%s (-> %s) found in mount list. Not mounting.\n", entry, rspecial);
+ ret = TRUE;
+ }
+
+- g_free (resolved);
++ g_free (rspecial);
+ }
+ mtab_close (handle);
+ return ret;
diff --git a/sysutils/hal/files/patch-tools_hal-storage-shared.c b/sysutils/hal/files/patch-tools_hal-storage-shared.c
new file mode 100644
index 000000000..1ed7fe907
--- /dev/null
+++ b/sysutils/hal/files/patch-tools_hal-storage-shared.c
@@ -0,0 +1,45 @@
+--- tools/hal-storage-shared.c.orig 2008-05-07 19:24:24.000000000 -0400
++++ tools/hal-storage-shared.c 2008-10-20 14:53:35.000000000 -0400
+@@ -297,6 +297,9 @@ handle_unmount (LibHalContext *hal_ctx,
+ char *mount_point_to_unmount;
+ gboolean mounted_by_other_uid;
+ FILE *hal_mtab_new;
++#ifdef __FreeBSD__
++ char *rdevice = NULL;
++#endif
+
+ #ifdef DEBUG
+ printf ("device = %s\n", device);
+@@ -473,7 +476,20 @@ line_found:
+ #endif
+ if (option_force)
+ args[na++] = "-f";
+- args[na++] = (char *) device;
++#ifdef __FreeBSD__
++ dbus_error_init (&error);
++ if (libhal_device_property_exists (hal_ctx, udi, "volume.freebsd.real_mounted_device", NULL)) {
++ rdevice = libhal_device_get_property_string (hal_ctx, udi, "volume.freebsd.real_mounted_device", &error);
++ if (dbus_error_is_set (&error)) {
++ dbus_error_free (&error);
++ unknown_error ("Error while getting volume.freebsd.real_mounted_device");
++ }
++ }
++ if (rdevice)
++ args[na++] = rdevice;
++ else
++#endif
++ args[na++] = (char *) device;
+ args[na++] = NULL;
+
+ #ifdef DEBUG
+@@ -497,6 +513,10 @@ line_found:
+ unknown_error ("Cannot spawn " UMOUNT);
+ }
+
++#ifdef __FreeBSD__
++ g_free (rdevice);
++#endif
++
+ /* check if unmount was succesful */
+ if (exit_status != 0) {
+ printf ("%s error %d, stdout='%s', stderr='%s'\n", UMOUNT, exit_status, sout, serr);
diff --git a/sysutils/hal/files/pkg-deinstall.in b/sysutils/hal/files/pkg-deinstall.in
new file mode 100644
index 000000000..4650d60fe
--- /dev/null
+++ b/sysutils/hal/files/pkg-deinstall.in
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+[ "$2" != DEINSTALL ] && exit 0
+
+USER=haldaemon
+
+%%LOCALBASE%%/bin/polkit-auth --user ${USER} --revoke \
+ org.freedesktop.policykit.read
+
+for pair in %%RC_FILES%%; do
+ file=`echo $pair | cut -f 1 -d :`
+ destdir=`echo $pair | cut -f 2 -d :`
+
+ if cmp -s %%DATADIR%%/dist/$file $destdir/$file; then
+ rm -f $destdir/$file
+ fi
+done
diff --git a/sysutils/hal/files/pkg-install.in b/sysutils/hal/files/pkg-install.in
new file mode 100644
index 000000000..253eef1f0
--- /dev/null
+++ b/sysutils/hal/files/pkg-install.in
@@ -0,0 +1,25 @@
+#!/bin/sh
+
+case $2 in
+POST-INSTALL)
+ USER=haldaemon
+ 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
+ %%LOCALBASE%%/bin/polkit-auth --user ${USER} --grant \
+ org.freedesktop.policykit.read
+
+ for pair in %%RC_FILES%%; do
+ file=`echo $pair | cut -f 1 -d :`
+ destdir=`echo $pair | cut -f 2 -d :`
+
+ if [ ! -f $destdir/$file ]; then
+ mkdir -p $destdir
+ cp -p %%DATADIR%%/dist/$file $destdir/$file
+ fi
+ done
+ exit 0
+ ;;
+esac
diff --git a/sysutils/hal/pkg-descr b/sysutils/hal/pkg-descr
new file mode 100644
index 000000000..c94358513
--- /dev/null
+++ b/sysutils/hal/pkg-descr
@@ -0,0 +1,6 @@
+HAL is a hardware abstraction layer whose goal is to merge information from
+various sources such that desktop applications can locate and use hardware
+devices. The point is that the exact set of information to merge varies by
+device and bus type.
+
+WWW: http://www.freedesktop.org/Software/hal
diff --git a/sysutils/hal/pkg-plist b/sysutils/hal/pkg-plist
new file mode 100644
index 000000000..06300737f
--- /dev/null
+++ b/sysutils/hal/pkg-plist
@@ -0,0 +1,130 @@
+@unexec %D/etc/rc.d/hald stop > /dev/null 2>&1 || true
+bin/hal-device
+bin/hal-disable-polling
+bin/hal-find-by-capability
+bin/hal-find-by-property
+bin/hal-get-property
+bin/hal-is-caller-locked-out
+bin/hal-is-caller-privileged
+bin/hal-lock
+bin/hal-set-property
+bin/lshal
+@exec mkdir -p %D/etc/hal/fdi/preprobe
+@exec mkdir -p %D/etc/hal/fdi/policy
+@exec mkdir -p %D/etc/hal/fdi/information
+include/hal/libhal-storage.h
+include/hal/libhal.h
+lib/libhal-storage.a
+lib/libhal-storage.la
+lib/libhal-storage.so
+lib/libhal-storage.so.1
+lib/libhal.a
+lib/libhal.la
+lib/libhal.so
+lib/libhal.so.1
+libdata/pkgconfig/hal-storage.pc
+libdata/pkgconfig/hal.pc
+libexec/hal-storage-cleanup-all-mountpoints
+libexec/hal-storage-cleanup-mountpoint
+libexec/hal-storage-closetray
+libexec/hal-storage-eject
+libexec/hal-storage-mount
+libexec/hal-storage-unmount
+libexec/hal-system-power-pm-is-supported
+libexec/hal-system-setserial
+libexec/hal/scripts/freebsd/hal-system-lcd-get-brightness-freebsd
+libexec/hal/scripts/freebsd/hal-system-lcd-set-brightness-freebsd
+libexec/hal/scripts/freebsd/hal-system-power-reboot-freebsd
+libexec/hal/scripts/freebsd/hal-system-power-set-power-save-freebsd
+libexec/hal/scripts/freebsd/hal-system-power-shutdown-freebsd
+libexec/hal/scripts/freebsd/hal-system-power-suspend-freebsd
+libexec/hal/scripts/hal-dockstation-undock
+libexec/hal/scripts/hal-functions
+libexec/hal/scripts/hal-luks-remove
+libexec/hal/scripts/hal-luks-setup
+libexec/hal/scripts/hal-luks-teardown
+libexec/hal/scripts/hal-system-killswitch-get-power
+libexec/hal/scripts/hal-system-killswitch-set-power
+libexec/hal/scripts/hal-system-lcd-get-brightness
+libexec/hal/scripts/hal-system-lcd-set-brightness
+libexec/hal/scripts/hal-system-power-hibernate
+libexec/hal/scripts/hal-system-power-reboot
+libexec/hal/scripts/hal-system-power-set-power-save
+libexec/hal/scripts/hal-system-power-shutdown
+libexec/hal/scripts/hal-system-power-suspend
+libexec/hal/scripts/hal-system-power-suspend-hybrid
+libexec/hal/scripts/hal-system-wol-enable
+libexec/hal/scripts/hal-system-wol-enabled
+libexec/hal/scripts/hal-system-wol-supported
+libexec/hald-addon-mouse-sysmouse
+libexec/hald-addon-storage
+libexec/hald-generate-fdi-cache
+libexec/hald-probe-hiddev
+libexec/hald-probe-mouse
+libexec/hald-probe-scsi
+libexec/hald-probe-smbios
+libexec/hald-probe-storage
+%%USB2%%libexec/hald-probe-usb2-device
+%%USB2%%libexec/hald-probe-usb2-interface
+libexec/hald-probe-volume
+libexec/hald-runner
+sbin/hald
+%%PORTDOCS%%%%DOCSDIR%%/README.freebsd
+%%PORTDOCS%%%%DOCSDIR%%/README.fuse
+%%DATADIR%%/dist/hal.conf
+%%DATADIR%%/fdi/fdi.dtd
+%%DATADIR%%/fdi/information/10freedesktop/01-deprecated-keys.fdi
+@exec mkdir -p %D/%%DATADIR%%/fdi/information/20thirdparty
+%%DATADIR%%/fdi/policy/10osvendor/10-dockstation.fdi
+%%DATADIR%%/fdi/policy/10osvendor/10-input-policy.fdi
+%%DATADIR%%/fdi/policy/10osvendor/10-laptop-panel-mgmt-policy.fdi
+%%DATADIR%%/fdi/policy/10osvendor/10-leds.fdi
+%%DATADIR%%/fdi/policy/10osvendor/10-mouse-sysmouse.fdi
+%%DATADIR%%/fdi/policy/10osvendor/10-power-mgmt-policy.fdi
+%%DATADIR%%/fdi/policy/10osvendor/10-rfkill-switch.fdi
+%%DATADIR%%/fdi/policy/10osvendor/10-tabletPCs.fdi
+%%DATADIR%%/fdi/policy/10osvendor/10-x11-input.fdi
+%%DATADIR%%/fdi/policy/10osvendor/15-storage-luks.fdi
+%%DATADIR%%/fdi/policy/10osvendor/20-storage-methods.fdi
+%%DATADIR%%/fdi/policy/10osvendor/30-wol.fdi
+%%DATADIR%%/mount-fuse
+share/PolicyKit/policy/org.freedesktop.hal.dockstation.policy
+share/PolicyKit/policy/org.freedesktop.hal.killswitch.policy
+share/PolicyKit/policy/org.freedesktop.hal.leds.policy
+share/PolicyKit/policy/org.freedesktop.hal.policy
+share/PolicyKit/policy/org.freedesktop.hal.power-management.policy
+share/PolicyKit/policy/org.freedesktop.hal.storage.policy
+share/PolicyKit/policy/org.freedesktop.hal.wol.policy
+@exec mkdir -p %D/%%DATADIR%%/fdi/policy/20thirdparty
+@exec mkdir -p %D/%%DATADIR%%/fdi/preprobe/10osvendor
+@exec mkdir -p %D/%%DATADIR%%/fdi/preprobe/20thirdparty
+@dirrm %%DATADIR%%/fdi/preprobe/20thirdparty
+@dirrm %%DATADIR%%/fdi/preprobe/10osvendor
+@dirrm %%DATADIR%%/fdi/preprobe
+@dirrm %%DATADIR%%/fdi/policy/20thirdparty
+@dirrm %%DATADIR%%/fdi/policy/10osvendor
+@dirrm %%DATADIR%%/fdi/policy
+@dirrm %%DATADIR%%/fdi/information/20thirdparty
+@dirrm %%DATADIR%%/fdi/information/10freedesktop
+@dirrm %%DATADIR%%/fdi/information
+@dirrm %%DATADIR%%/fdi
+@dirrm %%DATADIR%%/dist
+@dirrm %%DATADIR%%
+@dirrm %%DOCSDIR%%
+@dirrm libexec/hal/scripts/freebsd
+@dirrm libexec/hal/scripts
+@dirrm libexec/hal
+@dirrm include/hal
+@dirrm etc/hal/fdi/preprobe
+@dirrm etc/hal/fdi/policy
+@dirrm etc/hal/fdi/information
+@dirrm etc/hal/fdi
+@dirrm etc/hal
+@unexec rm -f /var/run/hald/hald.pid 2>/dev/null || true
+@unexec rm -rf /var/run/hald/hald-local 2>/dev/null || true
+@unexec rm -rf /var/run/hald/hald-runner 2>/dev/null || true
+@unexec rmdir /var/run/hald 2>/dev/null || true
+@unexec rmdir /var/cache/hald 2>/dev/null || true
+@unexec rmdir /var/cache 2>/dev/null || true
+@unexec /var/lib/hal 2>/dev/null || true
+@unexec /var/lib 2>/dev/null || true