diff options
author | Ali Abdallah <ali@xfce.org> | 2018-09-24 09:47:55 +0200 |
---|---|---|
committer | Landry Breuil <landry@rhaalovely.net> | 2019-05-02 19:48:28 +0200 |
commit | 1d56462b83cf320dff96d5b9ac3a767b019a0dd4 (patch) | |
tree | b0d6a017673f7f5b71ba1339b34f5878702cec90 /xfsm-shutdown-helper | |
parent | 8fe5cc56bc51b0c5d7a861f05c552fa2af07e26b (diff) | |
download | xfce4-session-1d56462b83cf320dff96d5b9ac3a767b019a0dd4.tar.gz |
Added better shutdown fallback support for the BSDs (Bug #14722)
On the BSDs, users of group operator can shutdown/reboot the machine.
We added some code on the fallback support in case consolekit is not
running.
Also, users with write access to /var/run/apmdev on OpenBSD and to
/dev/acpi on the other BSDs can suspend and hibernate the machine.
So we also support this on the fallback code.
Diffstat (limited to 'xfsm-shutdown-helper')
-rw-r--r-- | xfsm-shutdown-helper/main.c | 38 |
1 files changed, 2 insertions, 36 deletions
diff --git a/xfsm-shutdown-helper/main.c b/xfsm-shutdown-helper/main.c index 2c9bb1ae..793d9fb3 100644 --- a/xfsm-shutdown-helper/main.c +++ b/xfsm-shutdown-helper/main.c @@ -48,6 +48,8 @@ #include <unistd.h> #endif +#include "libxfsm/xfsm-shutdown-common.h" + #include <glib.h> /* XXX */ @@ -56,42 +58,6 @@ #define EXIT_CODE_ARGUMENTS_INVALID 3 #define EXIT_CODE_INVALID_USER 4 -#ifdef POWEROFF_CMD -#undef POWEROFF_CMD -#endif -#ifdef REBOOT_CMD -#undef REBOOT_CMD -#endif -#ifdef UP_BACKEND_SUSPEND_COMMAND -#undef UP_BACKEND_SUSPEND_COMMAND -#endif -#ifdef UP_BACKEND_HIBERNATE_COMMAND -#undef UP_BACKEND_HIBERNATE_COMMAND -#endif - -#if defined(__DragonFly__) || defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) -#define POWEROFF_CMD "/sbin/shutdown -p now" -#define REBOOT_CMD "/sbin/shutdown -r now" -#elif defined(sun) || defined(__sun) -#define POWEROFF_CMD "/usr/sbin/shutdown -i 5 -g 0 -y" -#define REBOOT_CMD "/usr/sbin/shutdown -i 6 -g 0 -y" -#else -#define POWEROFF_CMD "/sbin/shutdown -h now" -#define REBOOT_CMD "/sbin/shutdown -r now" -#endif -#ifdef BACKEND_TYPE_FREEBSD -#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/acpiconf -s 3" -#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/acpiconf -s 4" -#endif -#if BACKEND_TYPE_LINUX -#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/pm-suspend" -#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/pm-hibernate" -#endif -#ifdef BACKEND_TYPE_OPENBSD -#define UP_BACKEND_SUSPEND_COMMAND "/usr/sbin/zzz" -#define UP_BACKEND_HIBERNATE_COMMAND "/usr/sbin/ZZZ" -#endif - static gboolean run (const gchar *command) |