From mboxrd@z Thu Jan 1 00:00:00 1970 From: ludo@gnu.org (Ludovic =?utf-8?Q?Court=C3=A8s?=) Subject: Re: [PATCH] Fix XFCE shutdown/reboot via menu. Date: Sat, 21 Nov 2015 21:37:46 +0100 Message-ID: <87fuzz5bs5.fsf@gnu.org> References: <87vb8vqolg.fsf@elephly.net> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:51112) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a0Euu-0001nv-Ai for guix-devel@gnu.org; Sat, 21 Nov 2015 15:37:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a0Eur-0001KJ-3z for guix-devel@gnu.org; Sat, 21 Nov 2015 15:37:52 -0500 In-Reply-To: <87vb8vqolg.fsf@elephly.net> (Ricardo Wurmus's message of "Sat, 21 Nov 2015 17:55:23 +0100") List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org To: Ricardo Wurmus Cc: guix-devel Ricardo Wurmus skribis: > in the XFCE panel there is an item called =E2=80=9CAction Buttons=E2=80= =9D 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. \o/ > First I had to patch our xfce-session package. Upower is checked for at > configure time and needed for shutdown and reboot. Polkit=E2=80=99s =E2= =80=9Cpkexec=E2=80=9D 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 =E2=80=94 not in a snippet because eventual= ly we > should also fix the paths to pm-{suspend,hibernate}, which would be > provided by an input that is currently not present(?). The =E2=80=98run=E2=80=99 function in xfsm-shutdown-helper/main.c runs thes= e programs with: result =3D g_spawn_sync (NULL, argv, envp, G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NU= LL | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, NULL, NULL, &status, &err); I=E2=80=99m guessing G_SPAWN_SEARCH_PATH means that the program is searched= for in $PATH, in which case writing =E2=80=98halt=E2=80=99 would be enough (it = would be found in /run/setuid-programs.) > I also needed to change my system configuration to add =E2=80=9Cpkexec=E2= =80=9D 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? I think polkit-service-type should extend setuid-service-type to add that program. > Is it okay to use /run/setuid-programs/pkexec in the shutdown helper or > should this rather be a reference to the polkit input? The code that spawns pkexec looks like this: command =3D g_strdup_printf ("pkexec " XFSM_SHUTDOWN_HELPER_CMD " --%s", = action); ret =3D g_spawn_command_line_sync (command, NULL, NULL, &exit_status, err= or); I think this can be left unchanged, as long as we provide pkexec in $PATH (which is the case if it=E2=80=99s in /run/setuid-programs.) Thanks for looking into it! Ludo=E2=80=99.