changing the install location of hal-system-power-pmu to libexec
Sjoerd Simons
sjoerd at luon.net
Sun Feb 19 13:53:48 PST 2006
On Fri, Feb 17, 2006 at 11:05:29PM +0100, Sjoerd Simons wrote:
> On Thu, Feb 16, 2006 at 11:40:52PM +0000, Richard Hughes wrote:
> > Okay, installing hal-system-power-pmu to bin isn't the best of ideas, as
> > it's only designed to be run by HAL. Nor is it a good idea to install
> > to /usr/share/hal/scripts, as it's quite clearly not a script.
> >
> > In CVS, the hal-power-brightness-* scripts assume it's in the latter, so
> > don't work for pmu at the moment. [1]
> >
> > David wanted it to go into libexec, for which I've attached a patch, but
> > It's real messy with the hardcoded /usr/libexec/ bit in each file. The
> > only way I see around that is to convert each script into a script.in
> > file that gets 'compiled' with the correct path.
>
> The libexec dir should be part of the PATH of every program the runner calls.
> So no need to hardcode it, just call hal-system-power-pmu :)
Oops made a thinko, with the attached this is actually true :p.. It adds a save
PATH to the enviroment by default (hald should never ever specify need to add a
path to the enviroment send to the runner, so we're not overriding anything...).
Sjoerd
--
In order to live free and happily, you must sacrifice boredom.
It is not always an easy sacrifice.
-------------- next part --------------
Index: hald-runner/main.c
===================================================================
RCS file: /cvs/hal/hal/hald-runner/main.c,v
retrieving revision 1.3
diff -u -r1.3 main.c
--- hald-runner/main.c 23 Jan 2006 14:54:48 -0000 1.3
+++ hald-runner/main.c 19 Feb 2006 21:35:26 -0000
@@ -47,13 +47,15 @@
if (!dbus_message_iter_next(iter) || dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
goto malformed;
dbus_message_iter_recurse(iter, &sub_iter);
- r->environment = get_string_array(&sub_iter);
+ /* Add default path for the programs we start */
+ tmpstr = g_strdup_printf("PATH=/sbin:/usr/sbin:/bin:/usr/bin:%s", getenv("PATH"));
+ r->environment = get_string_array(&sub_iter, tmpstr);
/* Then argv */
if (!dbus_message_iter_next(iter) || dbus_message_iter_get_arg_type(iter) != DBUS_TYPE_ARRAY)
goto malformed;
dbus_message_iter_recurse(iter, &sub_iter);
- r->argv = get_string_array(&sub_iter);
+ r->argv = get_string_array(&sub_iter, NULL);
return TRUE;
Index: hald-runner/utils.c
===================================================================
RCS file: /cvs/hal/hal/hald-runner/utils.c,v
retrieving revision 1.2
diff -u -r1.2 utils.c
--- hald-runner/utils.c 23 Jan 2006 14:54:48 -0000 1.2
+++ hald-runner/utils.c 19 Feb 2006 21:35:26 -0000
@@ -31,7 +31,7 @@
#include "utils.h"
char **
-get_string_array(DBusMessageIter *iter)
+get_string_array(DBusMessageIter *iter, char *extra)
{
GArray *array;
char **result;
@@ -45,6 +45,8 @@
g_array_append_vals(array, &t, 1);
dbus_message_iter_next(iter);
}
+ if (extra != NULL)
+ g_array_append_vals(array, &extra, 1);
result = (char **) array->data;
g_array_free(array, FALSE);
return result;
Index: hald-runner/utils.h
===================================================================
RCS file: /cvs/hal/hal/hald-runner/utils.h,v
retrieving revision 1.1
diff -u -r1.1 utils.h
--- hald-runner/utils.h 21 Jan 2006 02:45:27 -0000 1.1
+++ hald-runner/utils.h 19 Feb 2006 21:35:26 -0000
@@ -28,7 +28,7 @@
#define DBUS_API_SUBJECT_TO_CHANGE
#include <dbus/dbus-glib-lowlevel.h>
-char **get_string_array(DBusMessageIter *iter);
+char **get_string_array(DBusMessageIter *iter, gchar *extra);
char **get_string_array_from_fd(int fd);
void free_string_array(char **array);
More information about the hal
mailing list