[packages/mate-power-manager] allow mate-power-manager to work if not booted with systemd
glen
glen at pld-linux.org
Mon Feb 18 23:29:45 CET 2013
commit e1330f15f4bdd78124804362b59a0feac046cabe
Author: Elan Ruusamäe <glen at delfi.ee>
Date: Tue Feb 19 00:28:46 2013 +0200
allow mate-power-manager to work if not booted with systemd
mate-power-manager.spec | 8 ++---
systemd-fallback.patch | 77 +++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 4 deletions(-)
---
diff --git a/mate-power-manager.spec b/mate-power-manager.spec
index ec08abe..7bd02dd 100644
--- a/mate-power-manager.spec
+++ b/mate-power-manager.spec
@@ -1,13 +1,11 @@
-# TODO
-# - it should not require systemd at runtime even if compiled with systemd
#
# Conditional build:
-%bcond_with systemd # without systemd inhibit
+%bcond_without systemd # without systemd inhibit
Summary: MATE power management service
Name: mate-power-manager
Version: 1.5.1
-Release: 4
+Release: 5
License: GPL v2+
Group: X11/Applications
Source0: http://pub.mate-desktop.org/releases/1.5/%{name}-%{version}.tar.xz
@@ -15,6 +13,7 @@ Source0: http://pub.mate-desktop.org/releases/1.5/%{name}-%{version}.tar.xz
Patch0: bashism.patch
Patch1: use-gnome-keyring.patch
Patch2: use-libnotify.patch
+Patch3: systemd-fallback.patch
URL: http://wiki.mate-desktop.org/mate-power-manager
BuildRequires: cairo-devel >= 1.0.0
BuildRequires: dbus-glib-devel
@@ -54,6 +53,7 @@ MATE session.
%patch0 -p1
%patch1 -p1
%patch2 -p1
+%patch3 -p1
%build
NOCONFIGURE=1 ./autogen.sh
diff --git a/systemd-fallback.patch b/systemd-fallback.patch
new file mode 100644
index 0000000..b5ded16
--- /dev/null
+++ b/systemd-fallback.patch
@@ -0,0 +1,77 @@
+--- mate-power-manager-1.5.1/src/Makefile.am~ 2013-02-18 23:31:11.000000000 +0200
++++ mate-power-manager-1.5.1/src/Makefile.am 2013-02-18 23:37:07.366519454 +0200
+@@ -190,6 +190,7 @@
+ $(LIBNOTIFY_LIBS) \
+ $(GPM_EXTRA_LIBS) \
+ $(UPOWER_LIBS) \
++ $(SYSTEMD_INHIBIT_LIBS) \
+ -lm
+
+ mate_power_manager_CFLAGS = \
+--- mate-power-manager-1.5.1/src/gpm-manager.c 2013-02-18 22:44:55.699497700 +0200
++++ mate-power-manager-1.5.1/src/gpm-manager.c 2013-02-18 22:55:33.785398083 +0200
+@@ -33,6 +33,9 @@
+ #ifdef HAVE_UNISTD_H
+ #include <unistd.h>
+ #endif /* HAVE_UNISTD_H */
++#ifdef WITH_SYSTEMD_INHIBIT
++#include <systemd/sd-daemon.h>
++#endif /* WITH_SYSTEMD_INHIBIT */
+
+ #include <glib/gi18n.h>
+ #include <gtk/gtk.h>
+@@ -1847,17 +1850,19 @@
+ #ifdef WITH_SYSTEMD_INHIBIT
+ /**
+ * gpm_main_system_inhibit:
++ *
++ * Return a fd to the to the inhibitor, that we can close on exit.
++ *
++ * Return value: fd, -1 on error
+ **/
+ static gint32
+ gpm_manager_systemd_inhibit (GDBusProxy *proxy) {
+- /* Return a fd to the to the inhibitor, that we can close on exit. */
+- //GDBusProxy *proxy;
+ GError *error = NULL;
+ gint32 r = -1;
+ gint32 fd = -1;
+ GVariant *res;
+ GUnixFDList *fd_list = NULL;
+- //proxy == NULL;
++
+ /* Should we define these elsewhere? */
+ const char* arg_what = "handle-power-key:handle-suspend-key:handle-lid-switch";
+ const char* arg_who = g_get_user_name ();
+@@ -1892,7 +1897,7 @@
+ &fd_list,
+ NULL,
+ &error
+- );
++ );
+ if (error == NULL && res != NULL) {
+ g_variant_get(res, "(h)", &r);
+ egg_debug ("Inhibiting systemd sleep res = %i", r);
+@@ -1907,8 +1912,8 @@
+ } else if (error != NULL || res == NULL) {
+ egg_error ("Error in dbus - %s", error->message);
+ g_error_free (error);
+- return -EIO;
+- }
++ return -EIO;
++ }
+ egg_debug ("Inhibiting systemd sleep - success");
+ return r;
+ }
+@@ -1933,7 +1938,10 @@
+
+ #ifdef WITH_SYSTEMD_INHIBIT
+ /* We want to inhibit the systemd suspend options, and take care of them ourselves */
+- manager->priv->systemd_inhibit = gpm_manager_systemd_inhibit (manager->priv->systemd_inhibit_proxy);
++ if (sd_booted() > 0) {
++ manager->priv->systemd_inhibit = gpm_manager_systemd_inhibit (manager->priv->systemd_inhibit_proxy);
++ }
++
+ #endif
+
+ /* init to unthrottled */
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/mate-power-manager.git/commitdiff/ffff9b3d18aa1d0dd61ae9e2a4798fd6fc3ea4ce
More information about the pld-cvs-commit
mailing list