jeyzu pushed a commit to branch master.

commit e234e74ee7b454d6a6c449ccfdab33a81292aa89
Author: Jérémy Zurcher <[email protected]>
Date:   Fri Apr 5 15:20:23 2013 +0200

    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 581fc38..1e76acb 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 caeaa0f..501bc11 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 b0dfab5..eccb4af 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

-- 

------------------------------------------------------------------------------
Minimize network downtime and maximize team effectiveness.
Reduce network management and security costs.Learn how to hire 
the most talented Cisco Certified professionals. Visit the 
Employer Resources Portal
http://www.cisco.com/web/learning/employer_resources/index.html

Reply via email to