[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH] Fix XFCE shutdown/reboot via menu.
From: |
Ricardo Wurmus |
Subject: |
Re: [PATCH] Fix XFCE shutdown/reboot via menu. |
Date: |
Sat, 21 Nov 2015 22:06:58 +0100 |
User-agent: |
mu4e 0.9.13; emacs 24.5.1 |
Ludovic Courtès <address@hidden> writes:
> Ricardo Wurmus <address@hidden> skribis:
>
>> 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(?).
>
> The ‘run’ function in xfsm-shutdown-helper/main.c runs these programs
> with:
>
> result = g_spawn_sync (NULL, argv, envp,
> G_SPAWN_SEARCH_PATH | G_SPAWN_STDOUT_TO_DEV_NULL
> |
> G_SPAWN_STDERR_TO_DEV_NULL,
> NULL, NULL, NULL, NULL, &status, &err);
>
> I’m guessing G_SPAWN_SEARCH_PATH means that the program is searched for
> in $PATH, in which case writing ‘halt’ would be enough (it would be
> found in /run/setuid-programs.)
I see.
>> 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?
>
> I think polkit-service-type should extend setuid-service-type to add
> that program.
‘polkit-service-type’ already extends ‘setuid-programs-service-type’
with ‘polkit-setuid-programs’:
(define polkit-setuid-programs
(match-lambda
(($ <polkit-configuration> polkit)
(list #~(string-append #$polkit
"/lib/polkit-1/polkit-agent-helper-1")))))
I guess we can just append ‘#~(string-append #$polkit "/bin/pkexec")’
here.
>> 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 = g_strdup_printf ("pkexec " XFSM_SHUTDOWN_HELPER_CMD " --%s",
> action);
> ret = g_spawn_command_line_sync (command, NULL, NULL, &exit_status, error);
>
> I think this can be left unchanged, as long as we provide pkexec in
> $PATH (which is the case if it’s in /run/setuid-programs.)
Okay. I’ll try the above changes and report back.
~~ Ricardo