summaryrefslogtreecommitdiff
path: root/sysutils/hal/files
diff options
context:
space:
mode:
Diffstat (limited to 'sysutils/hal/files')
-rw-r--r--sysutils/hal/files/extra-patch-tools_hal-storage-mount.c60
-rw-r--r--sysutils/hal/files/hald.in26
-rw-r--r--sysutils/hal/files/patch-Makefile.in12
-rw-r--r--sysutils/hal/files/patch-doc_Makefile.in20
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_addons_addon-storage.c135
-rw-r--r--sysutils/hal/files/patch-hald_freebsd_hf-scsi.c12
-rw-r--r--sysutils/hal/files/patch-tools_Makefile.in11
-rw-r--r--sysutils/hal/files/pkg-install.in2
8 files changed, 216 insertions, 62 deletions
diff --git a/sysutils/hal/files/extra-patch-tools_hal-storage-mount.c b/sysutils/hal/files/extra-patch-tools_hal-storage-mount.c
index ce9895f941a4..82a7fb6070e0 100644
--- a/sysutils/hal/files/extra-patch-tools_hal-storage-mount.c
+++ b/sysutils/hal/files/extra-patch-tools_hal-storage-mount.c
@@ -1,30 +1,30 @@
---- tools/hal-storage-mount.c.orig Sun May 14 20:57:59 2006
-+++ tools/hal-storage-mount.c Sat Apr 7 12:50:53 2007
-@@ -513,23 +513,11 @@
- explicit_mount_point_given = FALSE;
- if (strlen (mount_point) == 0) {
- char *p;
-- const char *label;
-+ char *basename;
-
-- if (volume != NULL)
-- label = libhal_volume_get_label (volume);
-- else
-- label = NULL;
--
-- 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), "disk");
-- }
-+ 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;
+--- tools/hal-storage-mount.c.orig 2008-01-03 21:10:54.000000000 -0500
++++ tools/hal-storage-mount.c 2008-01-04 09:29:10.000000000 -0500
+@@ -583,23 +583,11 @@ handle_mount (LibHalContext *hal_ctx,
+ explicit_mount_point_given = FALSE;
+ if (strlen (mount_point) == 0) {
+ char *p;
+- const char *label;
++ char *basename;
+
+- if (volume != NULL)
+- label = libhal_volume_get_label (volume);
+- else
+- label = NULL;
+-
+- 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");
+- }
++ 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
index ab906a516f30..7f8f2c659c86 100644
--- a/sysutils/hal/files/hald.in
+++ b/sysutils/hal/files/hald.in
@@ -3,7 +3,7 @@
# $FreeBSD$
#
# PROVIDE: hald
-# REQUIRE: DAEMON usbd devd dbus polkitd
+# REQUIRE: DAEMON usbd devd dbus
#
# Add the following line to /etc/rc.conf to enable the HAL daemon:
#
@@ -24,6 +24,7 @@ pidfile="/var/run/${name}/${name}.pid"
stop_postcmd="hald_postcmd"
start_precmd="hald_precmd"
+start_cmd="hald_start"
local_force_depend()
{
@@ -46,10 +47,7 @@ hald_precmd()
local_force_depend dbus || return 1
fi
- if ! checkyesno polkitd_enable
- then
- local_force_depend polkitd || return 1
- fi
+ chmod 0755 /var/cache
mkdir -p $(dirname $pidfile)
}
@@ -59,5 +57,23 @@ 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/patch-Makefile.in b/sysutils/hal/files/patch-Makefile.in
index 27219f54c076..17d23980f55c 100644
--- a/sysutils/hal/files/patch-Makefile.in
+++ b/sysutils/hal/files/patch-Makefile.in
@@ -1,11 +1,11 @@
---- Makefile.in.orig Thu May 4 15:35:41 2006
-+++ Makefile.in Thu May 4 15:36:40 2006
-@@ -377,14 +377,14 @@ distclean-libtool:
+--- Makefile.in.orig 2008-01-03 21:28:32.000000000 -0500
++++ Makefile.in 2008-01-03 21:29:15.000000000 -0500
+@@ -311,14 +311,14 @@ clean-libtool:
+ distclean-libtool:
-rm -f libtool
- uninstall-info-am:
install-dist_dbusDATA: $(dist_dbus_DATA)
- @$(NORMAL_INSTALL)
-- test -z "$(dbusdir)" || $(mkdir_p) "$(DESTDIR)$(dbusdir)"
+- test -z "$(dbusdir)" || $(MKDIR_P) "$(DESTDIR)$(dbusdir)"
- @list='$(dist_dbus_DATA)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f=$(am__strip_dir) \
@@ -13,7 +13,7 @@
- $(dist_dbusDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(dbusdir)/$$f"; \
- done
+# @$(NORMAL_INSTALL)
-+# test -z "$(dbusdir)" || $(mkdir_p) "$(DESTDIR)$(dbusdir)"
++# test -z "$(dbusdir)" || $(MKDIR_P) "$(DESTDIR)$(dbusdir)"
+# @list='$(dist_dbus_DATA)'; for p in $$list; do \
+# if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+# f=$(am__strip_dir) \
diff --git a/sysutils/hal/files/patch-doc_Makefile.in b/sysutils/hal/files/patch-doc_Makefile.in
index d05f0136ccbf..9cd951720ede 100644
--- a/sysutils/hal/files/patch-doc_Makefile.in
+++ b/sysutils/hal/files/patch-doc_Makefile.in
@@ -1,11 +1,11 @@
---- doc/Makefile.in.orig Tue May 2 01:04:31 2006
-+++ doc/Makefile.in Tue May 2 01:04:42 2006
-@@ -269,7 +269,7 @@ sharedstatedir = @sharedstatedir@
- sysconfdir = @sysconfdir@
- target_alias = @target_alias@
+--- 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 conf
-+SUBDIRS = spec conf
- all: all-recursive
-
- .SUFFIXES:
+-SUBDIRS = api spec man
++SUBDIRS = spec man
+ MAINTAINERCLEANFILES = \
+ *~ \
+ Makefile.in
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 000000000000..ebeeb072c7af
--- /dev/null
+++ b/sysutils/hal/files/patch-hald_freebsd_addons_addon-storage.c
@@ -0,0 +1,135 @@
+--- hald/freebsd/addons/addon-storage.c.orig 2008-03-17 17:25:16.000000000 -0400
++++ hald/freebsd/addons/addon-storage.c 2008-03-22 03:25:19.000000000 -0400
+@@ -150,6 +150,34 @@ hf_addon_storage_update (void)
+ return has_media;
+ }
+
++static boolean
++poll_for_media (void)
++{
++ boolean has_media;
++
++ has_media = hf_addon_storage_update();
++ if (has_media != addon.had_media)
++ {
++ /*
++ * FIXME: if the media was removed, we should force-unmount
++ * all its child volumes (see linux2/addons/addon-storage.c).
++ * However, currently (FreeBSD 6.0) umount -f is broken and
++ * can cause kernel panics. When I tried to umount -f a
++ * flash card after removing it, it failed with EAGAIN. It
++ * continued to fail after I inserted the card. The system
++ * then hung while rebooting and did not unmount my other
++ * filesystems.
++ */
++
++ libhal_device_rescan(hfp_ctx, hfp_udi, &hfp_error);
++ dbus_error_free(&hfp_error);
++ addon.had_media = has_media;
++
++ return TRUE;
++ }
++ return FALSE;
++}
++
+ static void
+ update_proc_title (const char *device, boolean polling_enabled)
+ {
+@@ -159,6 +187,29 @@ update_proc_title (const char *device, b
+ setproctitle("no polling on %s because it is explicitly disabled", device);
+ }
+
++static DBusHandlerResult
++filter_function (DBusConnection *connection, DBusMessage *message, void *user_data)
++{
++ if (dbus_message_is_method_call(message,
++ "org.freedesktop.Hal.Device.Storage.Removable",
++ "CheckForMedia"))
++ {
++ DBusMessage *reply;
++ dbus_bool_t had_effect;
++
++ hfp_info("Forcing poll for media becusse CheckForMedia() was called");
++
++ had_effect = poll_for_media();
++
++ reply = dbus_message_new_method_return (message);
++ dbus_message_append_args(reply, DBUS_TYPE_BOOLEAN, &had_effect, DBUS_TYPE_INVALID);
++ dbus_connection_send(connection, reply, NULL);
++ dbus_message_unref(reply);
++ }
++
++ return DBUS_HANDLER_RESULT_HANDLED;
++}
++
+ int
+ main (int argc, char **argv)
+ {
+@@ -202,13 +253,30 @@ main (int argc, char **argv)
+ ! strcmp(driver, "cd")))) && ! strcmp(removable, "true");
+ addon.had_media = hf_addon_storage_update();
+
++ if (! libhal_device_addon_is_ready(hfp_ctx, hfp_udi, &hfp_error))
++ goto end;
++ dbus_error_free(&hfp_error);
++
+ connection = libhal_ctx_get_dbus_connection(hfp_ctx);
+ assert(connection != NULL);
++ dbus_connection_set_exit_on_disconnect(connection, 0);
++ dbus_connection_add_filter(connection, filter_function, NULL, NULL);
+
+- while (TRUE)
++ if (! libhal_device_claim_interface(hfp_ctx,
++ hfp_udi,
++ "org.freedesktop.Hal.Device.Storage.Removable",
++ " <method name=\"CheckForMedia\">\n"
++ " <arg name=\"call_had_sideeffect\" direction=\"out\" type=\"b\"/>\n"
++ " </method>\n",
++ &hfp_error))
+ {
+- boolean has_media;
++ hfp_critical("Cannot claim interface 'org.freedesktop.Hal.Device.Storage.Removable'");
++ goto end;
++ }
++ dbus_error_free(&hfp_error);
+
++ while (TRUE)
++ {
+ /* process dbus traffic until update interval has elapsed */
+ while (TRUE)
+ {
+@@ -225,7 +293,7 @@ main (int argc, char **argv)
+ if (timeout.tv_sec < 0) /* current time went backwards */
+ timeout = addon.update_interval;
+
+- dbus_connection_read_write(connection, timeout.tv_sec * 1000 + timeout.tv_usec / 1000);
++ dbus_connection_read_write_dispatch(connection, timeout.tv_sec * 1000 + timeout.tv_usec / 1000);
+ if (! dbus_connection_get_is_connected(connection))
+ goto end;
+ }
+@@ -239,24 +307,7 @@ main (int argc, char **argv)
+
+ if (should_poll)
+ {
+- has_media = hf_addon_storage_update();
+- if (has_media != addon.had_media)
+- {
+- /*
+- * FIXME: if the media was removed, we should force-unmount
+- * all its child volumes (see linux2/addons/addon-storage.c).
+- * However, currently (FreeBSD 6.0) umount -f is broken and
+- * can cause kernel panics. When I tried to umount -f a
+- * flash card after removing it, it failed with EAGAIN. It
+- * continued to fail after I inserted the card. The system
+- * then hung while rebooting and did not unmount my other
+- * filesystems.
+- */
+-
+- libhal_device_rescan(hfp_ctx, hfp_udi, &hfp_error);
+- dbus_error_free(&hfp_error);
+- addon.had_media = has_media;
+- }
++ poll_for_media();
+ }
+ else
+ {
diff --git a/sysutils/hal/files/patch-hald_freebsd_hf-scsi.c b/sysutils/hal/files/patch-hald_freebsd_hf-scsi.c
new file mode 100644
index 000000000000..598ac6283341
--- /dev/null
+++ b/sysutils/hal/files/patch-hald_freebsd_hf-scsi.c
@@ -0,0 +1,12 @@
+--- hald/freebsd/hf-scsi.c.orig 2008-03-18 15:58:59.000000000 -0400
++++ hald/freebsd/hf-scsi.c 2008-03-18 15:57:36.000000000 -0400
+@@ -409,8 +409,8 @@ hf_scsi_handle_pending_device (struct de
+ */
+ hf_block_device_complete(block_device, block_device, FALSE);
+
+- hf_storage_device_probe(block_device, FALSE);
+ hf_device_add(block_device);
++ hf_storage_device_probe(block_device, FALSE);
+ }
+ }
+ }
diff --git a/sysutils/hal/files/patch-tools_Makefile.in b/sysutils/hal/files/patch-tools_Makefile.in
deleted file mode 100644
index c5ce9282732e..000000000000
--- a/sysutils/hal/files/patch-tools_Makefile.in
+++ /dev/null
@@ -1,11 +0,0 @@
---- tools/Makefile.in.orig Tue May 2 20:23:05 2006
-+++ tools/Makefile.in Tue May 2 20:23:22 2006
-@@ -325,7 +325,7 @@
- sharedstatedir = @sharedstatedir@
- sysconfdir = @sysconfdir@
- target_alias = @target_alias@
--SUBDIRS = freebsd linux device-manager
-+SUBDIRS = freebsd device-manager
- INCLUDES = \
- -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\" \
- -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\" \
diff --git a/sysutils/hal/files/pkg-install.in b/sysutils/hal/files/pkg-install.in
index 2cfda5753d4c..72b67ff95936 100644
--- a/sysutils/hal/files/pkg-install.in
+++ b/sysutils/hal/files/pkg-install.in
@@ -34,6 +34,8 @@ if [ -z "${PACKAGE_BUILDING}" ]; then
fi
/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
fi
for pair in %%RC_FILES%%; do