[gnome-power-manager/gnome-2-32] Remove hardcoded paths from pkexec setup.



commit 1f52e3bb4815d19c65f9e49adc27a84c2fba3461
Author: Brian Hutsell <bhut_ooto yahoo com>
Date:   Mon May 17 23:49:08 2010 +0800

    Remove hardcoded paths from pkexec setup.
    
    Signed-off-by: Richard Hughes <richard hughsie com>

 configure.ac                                       |   10 ++++++++++
 policy/Makefile.am                                 |    7 +++++--
 ....power.policy.in => org.gnome.power.policy.in2} |    2 +-
 src/Makefile.am                                    |    1 +
 src/gpm-brightness.c                               |    4 ++--
 5 files changed, 19 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a6e5301..e0410df 100644
--- a/configure.ac
+++ b/configure.ac
@@ -367,4 +367,14 @@ echo "
         dbus-1 services dir:       $DBUS_SERVICES_DIR
         gconf-schema dir:          $GCONF_SCHEMA_FILE_DIR
 "
+if [[ "${prefix}" != "/usr" ]] ; then
+	echo '
+WARNING!!!  GNOME Power Manager uses the "pkexec" utility to provide root
+permissions necessary for the "gnome-power-backlight-helper" executable to run.
+
+A link should be provided from the file
+"/usr/share/polkit-1/actions/org.gnome.power.policy" to the installed version
+"${prefix}/share/polkit-1/actions/org.gnome.power.policy" after installation.
+'
+fi
 
diff --git a/policy/Makefile.am b/policy/Makefile.am
index f7c03d1..25df27d 100644
--- a/policy/Makefile.am
+++ b/policy/Makefile.am
@@ -6,8 +6,11 @@ dist_polkit_policy_DATA =					\
 # http://bugzilla.gnome.org/show_bug.cgi?id=462312
 @INTLTOOL_POLICY_RULE@
 
-EXTRA_DIST = org.gnome.power.policy.in
-DISTCLEANFILES = org.gnome.power.policy
+.in2.in:
+	sed "s|[ ]sbindir@|${sbindir}|" $< > $@
+
+EXTRA_DIST = org.gnome.power.policy.in2
+DISTCLEANFILES = org.gnome.power.policy org.gnome.power.policy.in
 
 clean-local :
 	rm -f *~
diff --git a/policy/org.gnome.power.policy.in b/policy/org.gnome.power.policy.in2
similarity index 90%
rename from policy/org.gnome.power.policy.in
rename to policy/org.gnome.power.policy.in2
index 2135ba8..f54ff62 100644
--- a/policy/org.gnome.power.policy.in
+++ b/policy/org.gnome.power.policy.in2
@@ -25,7 +25,7 @@
       <allow_inactive>no</allow_inactive>
       <allow_active>yes</allow_active>
     </defaults>
-    <annotate key="org.freedesktop.policykit.exec.path">/usr/sbin/gnome-power-backlight-helper</annotate>
+    <annotate key="org.freedesktop.policykit.exec.path">@sbindir@/gnome-power-backlight-helper</annotate>
   </action>
 
 </policyconfig>
diff --git a/src/Makefile.am b/src/Makefile.am
index a4e623f..9c954c6 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -21,6 +21,7 @@ INCLUDES =						\
 	-DI_KNOW_THE_DEVICEKIT_POWER_API_IS_SUBJECT_TO_CHANGE \
 	$(DEVKIT_CFLAGS)				\
 	-DBINDIR=\"$(bindir)\"			 	\
+	-DSBINDIR=\"$(sbindir)\"			 \
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\"	\
 	-DDATADIR=\"$(datadir)\"			\
 	-DPREFIX=\""$(prefix)"\" 			\
diff --git a/src/gpm-brightness.c b/src/gpm-brightness.c
index c39cad9..46357f6 100644
--- a/src/gpm-brightness.c
+++ b/src/gpm-brightness.c
@@ -101,7 +101,7 @@ gpm_brightness_helper_get_value (const gchar *argument)
 	gchar *command = NULL;
 
 	/* get the data */
-	command = g_strdup_printf ("pkexec /usr/sbin/gnome-power-backlight-helper --%s", argument);
+	command = g_strdup_printf ("pkexec " SBINDIR "/gnome-power-backlight-helper --%s", argument);
 	ret = g_spawn_command_line_sync (command,
 					 &stdout_data, NULL, &exit_status, &error);
 	if (!ret) {
@@ -133,7 +133,7 @@ gpm_brightness_helper_set_value (const gchar *argument, gint value)
 	gchar *command = NULL;
 
 	/* get the data */
-	command = g_strdup_printf ("pkexec /usr/sbin/gnome-power-backlight-helper --%s %i", argument, value);
+	command = g_strdup_printf ("pkexec " SBINDIR "/gnome-power-backlight-helper --%s %i", argument, value);
 	ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, &error);
 	if (!ret) {
 		egg_error ("failed to get value: %s", error->message);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]