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
This commit is contained in:
Jérémy Zurcher 2013-04-05 15:20:23 +02:00
parent cbd395a719
commit e234e74ee7
3 changed files with 20 additions and 9 deletions

View File

@ -1,3 +1,7 @@
2013-04-05 Jérémy Zurcher
* added support for systemd halt and poweroff
2013-03-28 Cedric Bail 2013-03-28 Cedric Bail
* added support for systemd user session. * added support for systemd user session.

View File

@ -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([music_control], true, [CHECK_MODULE_MUSIC_CONTROL])
AC_E_OPTIONAL_MODULE([contact], true) AC_E_OPTIONAL_MODULE([contact], true)
HALT="/sbin/shutdown -h now"
REBOOT="/sbin/shutdown -r now"
SUSPEND="" SUSPEND=""
HIBERNATE="" HIBERNATE=""
case "$host_os" in case "$host_os" in
freebsd*|pcbsd*) freebsd*|pcbsd*)
SUSPEND="acpiconf -s3" SUSPEND="acpiconf -s3"
AC_MSG_NOTICE([use suspend method: $SUSPEND]) AC_MSG_NOTICE([use suspend method: $SUSPEND])
AC_SUBST(SUSPEND)
HIBERNATE="acpiconf -s4" HIBERNATE="acpiconf -s4"
AC_MSG_NOTICE([use hibernate method: $HIBERNATE]) 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" 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 else
AC_PATH_PROGS([SUSPEND], [sleep.sh pm-suspend],[/etc/acpi/sleep.sh], [/etc/acpi:/sbin:/usr/sbin:$PATH]) 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" SUSPEND="/etc/acpi/sleep.sh force"
AC_MSG_NOTICE([use suspend method: $SUSPEND]) AC_MSG_NOTICE([use suspend method: $SUSPEND])
fi fi
AC_PATH_PROGS([HIBERNATE], [hibernate.sh pm-hibernate],[/etc/acpi/hibernate.sh], [/etc/acpi:/sbin:/usr/sbin:$PATH]) 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" HIBERNATE="/etc/acpi/hibernate.sh force"
AC_MSG_NOTICE([use hibernate method: $HIBERNATE]) AC_MSG_NOTICE([use hibernate method: $HIBERNATE])
fi fi
fi fi
;; ;;
esac esac
AC_SUBST(HALT)
AC_SUBST(REBOOT)
AC_SUBST(SUSPEND)
AC_SUBST(HIBERNATE)
m4_ifdef([v_mic], m4_ifdef([v_mic],
[ [

View File

@ -43,8 +43,8 @@
# user and group name can use glob matches (* == all for example) like the # user and group name can use glob matches (* == all for example) like the
# shell. as can action names allowed or denied. # shell. as can action names allowed or denied.
action: halt /sbin/shutdown -h now action: halt @HALT@
action: reboot /sbin/shutdown -r now action: reboot @REBOOT@
action: suspend @SUSPEND@ action: suspend @SUSPEND@
action: hibernate @HIBERNATE@ action: hibernate @HIBERNATE@
action: /bin/mount /bin/mount action: /bin/mount /bin/mount