From e234e74ee7b454d6a6c449ccfdab33a81292aa89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 5 Apr 2013 15:20:23 +0200 Subject: [PATCH] systemd: fix + complete power mgmt method support - fix typo in configure.ac for suspend/hibernate method selection - add systemd support of halt and reboot actions --- ChangeLog | 4 ++++ configure.ac | 21 ++++++++++++++------- data/etc/sysactions.conf.in | 4 ++-- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 581fc383d..1e76acb86 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-04-05 Jérémy Zurcher + + * added support for systemd halt and poweroff + 2013-03-28 Cedric Bail * added support for systemd user session. diff --git a/configure.ac b/configure.ac index caeaa0f55..501bc1185 100644 --- a/configure.ac +++ b/configure.ac @@ -893,36 +893,43 @@ AC_E_OPTIONAL_MODULE([access], true) AC_E_OPTIONAL_MODULE([music_control], true, [CHECK_MODULE_MUSIC_CONTROL]) AC_E_OPTIONAL_MODULE([contact], true) +HALT="/sbin/shutdown -h now" +REBOOT="/sbin/shutdown -r now" SUSPEND="" HIBERNATE="" case "$host_os" in freebsd*|pcbsd*) SUSPEND="acpiconf -s3" AC_MSG_NOTICE([use suspend method: $SUSPEND]) - AC_SUBST(SUSPEND) HIBERNATE="acpiconf -s4" AC_MSG_NOTICE([use hibernate method: $HIBERNATE]) - AC_SUBST(HIBERNATE) ;; *) - if test "x{have_systemd_user_session}" = "xyes"; then + if test "x${have_systemd_user_session}" = "xyes"; then + HALT="/usr/bin/systemctl poweroff" + REBOOT="/usr/bin/systemctl reboot" SUSPEND="/usr/bin/systemctl suspend" - HIBERNATE="/usr/bin/systemctl hibernate" + HIBERNATE="/usr/bin/systemctl hibernate" + AC_MSG_NOTICE([use systemctl for halt, reboot, suspend and hibernate]) else AC_PATH_PROGS([SUSPEND], [sleep.sh pm-suspend],[/etc/acpi/sleep.sh], [/etc/acpi:/sbin:/usr/sbin:$PATH]) - if test "$SUSPEND" = "/etc/acpi/sleep.sh" ; then + if test "$SUSPEND" = "/etc/acpi/sleep.sh" ; then SUSPEND="/etc/acpi/sleep.sh force" AC_MSG_NOTICE([use suspend method: $SUSPEND]) fi AC_PATH_PROGS([HIBERNATE], [hibernate.sh pm-hibernate],[/etc/acpi/hibernate.sh], [/etc/acpi:/sbin:/usr/sbin:$PATH]) - if test "$HIBERNATE" = "/etc/acpi/hibernate.sh" ; then + if test "$HIBERNATE" = "/etc/acpi/hibernate.sh" ; then HIBERNATE="/etc/acpi/hibernate.sh force" AC_MSG_NOTICE([use hibernate method: $HIBERNATE]) - fi + fi fi ;; esac +AC_SUBST(HALT) +AC_SUBST(REBOOT) +AC_SUBST(SUSPEND) +AC_SUBST(HIBERNATE) m4_ifdef([v_mic], [ diff --git a/data/etc/sysactions.conf.in b/data/etc/sysactions.conf.in index b0dfab51c..eccb4af56 100644 --- a/data/etc/sysactions.conf.in +++ b/data/etc/sysactions.conf.in @@ -43,8 +43,8 @@ # user and group name can use glob matches (* == all for example) like the # shell. as can action names allowed or denied. -action: halt /sbin/shutdown -h now -action: reboot /sbin/shutdown -r now +action: halt @HALT@ +action: reboot @REBOOT@ action: suspend @SUSPEND@ action: hibernate @HIBERNATE@ action: /bin/mount /bin/mount