unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Fix XFCE shutdown/reboot via menu.
@ 2015-11-21 16:55 Ricardo Wurmus
  2015-11-21 20:37 ` Ludovic Courtès
  0 siblings, 1 reply; 6+ messages in thread
From: Ricardo Wurmus @ 2015-11-21 16:55 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1161 bytes --]

Hi Guix,

in the XFCE panel there is an item called “Action Buttons” offering
screen locking, log out, switch user, shutdown and reboot.  Shutdown and
reboot do not work at the moment.

I investigated a little and came up with a configuration in which these
two features do work.

First I had to patch our xfce-session package.  Upower is checked for at
configure time and needed for shutdown and reboot.  Polkit’s “pkexec” is
required to run the shutdown helper.

The helper contains a bunch of hardcoded paths to /sbin/shutdown, which
are replaced in a build phase — not in a snippet because eventually we
should also fix the paths to pm-{suspend,hibernate}, which would be
provided by an input that is currently not present(?).

I also needed to change my system configuration to add “pkexec” to the
list of setuid programs:

  (setuid-programs (cons #~(string-append #$polkit "/bin/pkexec")
                           %setuid-programs))

Maybe this should just be added to %setuid-programs?

Is it okay to use /run/setuid-programs/pkexec in the shutdown helper or
should this rather be a reference to the polkit input?

Here’s the patch:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-WIP-xfce-session-Fix-shutdown-reboot-via-menu.patch --]
[-- Type: text/x-patch, Size: 2074 bytes --]

From 2d39ace79b79a1672488e09bdcf442ff893cbf98 Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Sat, 21 Nov 2015 17:47:00 +0100
Subject: [PATCH] WIP: xfce-session: Fix shutdown/reboot via menu.

---
 gnu/packages/xfce.scm | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/gnu/packages/xfce.scm b/gnu/packages/xfce.scm
index a4987c1..4c223d7 100644
--- a/gnu/packages/xfce.scm
+++ b/gnu/packages/xfce.scm
@@ -35,6 +35,7 @@
   #:use-module (gnu packages image)
   #:use-module (gnu packages gnome)
   #:use-module (gnu packages pdf)
+  #:use-module (gnu packages polkit)
   #:use-module (gnu packages gstreamer)
   #:use-module (gnu packages linux)
   #:use-module (gnu packages photo)
@@ -429,13 +430,29 @@ your system in categories, so you can quickly find and launch them.")
                (list (search-patch "xfce4-session-fix-xflock4.patch")))))
     (build-system gnu-build-system)
     (arguments
-     '(#:configure-flags
+     '(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'fix-paths-to-shutdown-tools
+           (lambda _
+             ;; FIXME: also replace paths to "pm-hibernate" and "pm-suspend"
+             (substitute* "xfsm-shutdown-helper/main.c"
+               (("/sbin/shutdown -h now")
+                "/run/current-system/profile/sbin/halt")
+               (("/sbin/shutdown -r now")
+                "/run/current-system/profile/sbin/restart"))
+             ;; TODO: should we use a store reference to polkit instead?
+             (substitute* "xfce4-session/xfsm-shutdown-fallback.c"
+               (("pkexec ") "/run/setuid-programs/pkexec "))
+             #t)))
+       #:configure-flags
        (list (string-append "--with-xsession-prefix=" %output))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("intltool" ,intltool)))
     (inputs
      `(("iceauth" ,iceauth)
+       ("upower" ,upower)
+       ("polkit" ,polkit)
        ("libsm" ,libsm)
        ("libwnck" ,libwnck-1)
        ("libxfce4ui" ,libxfce4ui)))
-- 
2.5.0


[-- Attachment #3: Type: text/plain, Size: 12 bytes --]


~~ Ricardo

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-11-28 14:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-21 16:55 [PATCH] Fix XFCE shutdown/reboot via menu Ricardo Wurmus
2015-11-21 20:37 ` Ludovic Courtès
2015-11-21 21:06   ` Ricardo Wurmus
2015-11-24 20:40     ` Ludovic Courtès
2015-11-25 17:46       ` Ricardo Wurmus
2015-11-28 14:14         ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).