diff --git a/packages/mediacenter/xbmc/package.mk b/packages/mediacenter/xbmc/package.mk index 73c30094b8..4e1aef292b 100644 --- a/packages/mediacenter/xbmc/package.mk +++ b/packages/mediacenter/xbmc/package.mk @@ -555,4 +555,6 @@ post_install() { enable_service xbmc-reboot.service enable_service xbmc-userfonts.service enable_service xbmc.service + enable_service xbmc-lcd-suspend.service + enable_service xbmc-lirc-suspend.service } diff --git a/packages/mediacenter/xbmc/sleep.d/61_xbmc_lirc b/packages/mediacenter/xbmc/sleep.d/61_xbmc_lirc deleted file mode 100755 index 0cb99c757e..0000000000 --- a/packages/mediacenter/xbmc/sleep.d/61_xbmc_lirc +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. /etc/profile - -case "$1" in - hibernate|suspend) - xbmc-send --host=127.0.0.1 -a "LIRC.Stop" - ;; - thaw|resume) - xbmc-send --host=127.0.0.1 -a "LIRC.Start" - ;; - *) exit $NA - ;; -esac diff --git a/packages/mediacenter/xbmc/sleep.d/62_xbmc_lcd b/packages/mediacenter/xbmc/sleep.d/62_xbmc_lcd deleted file mode 100755 index a3f8e358a4..0000000000 --- a/packages/mediacenter/xbmc/sleep.d/62_xbmc_lcd +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/sh - -################################################################################ -# This file is part of OpenELEC - http://www.openelec.tv -# Copyright (C) 2009-2012 Stephan Raue (stephan@openelec.tv) -# -# This Program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This Program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with OpenELEC.tv; see the file COPYING. If not, write to -# the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. -# http://www.gnu.org/copyleft/gpl.html -################################################################################ - -. /etc/profile - -case "$1" in - hibernate|suspend) - xbmc-send --host=127.0.0.1 -a "LCD.Suspend" - ;; - thaw|resume) - xbmc-send --host=127.0.0.1 -a "LCD.Resume" - ;; - *) exit $NA - ;; -esac diff --git a/packages/mediacenter/xbmc/sleep.d/00_addon-sleep b/packages/mediacenter/xbmc/sleep.d/addon-sleep.sh similarity index 85% rename from packages/mediacenter/xbmc/sleep.d/00_addon-sleep rename to packages/mediacenter/xbmc/sleep.d/addon-sleep.sh index 01c9653b45..f5ea30a67e 100755 --- a/packages/mediacenter/xbmc/sleep.d/00_addon-sleep +++ b/packages/mediacenter/xbmc/sleep.d/addon-sleep.sh @@ -22,7 +22,11 @@ . /etc/profile +# see https://wiki.archlinux.org/index.php/Power_Management#Hooks_in_.2Fusr.2Flib.2Fsystemd.2Fsystem-sleep + for script in $HOME/.xbmc/addons/*/sleep.d/*.power; do - progress "running addon sleep script $script ($1)..." - sh $script $1 + progress "running addon sleep script $script ($@)..." + sh $script $@ done + +exit 0 \ No newline at end of file diff --git a/packages/mediacenter/xbmc/sleep.d/99_custom-sleep b/packages/mediacenter/xbmc/sleep.d/custon-sleep.sh similarity index 85% rename from packages/mediacenter/xbmc/sleep.d/99_custom-sleep rename to packages/mediacenter/xbmc/sleep.d/custon-sleep.sh index c75768a686..decf6a65ee 100755 --- a/packages/mediacenter/xbmc/sleep.d/99_custom-sleep +++ b/packages/mediacenter/xbmc/sleep.d/custon-sleep.sh @@ -22,9 +22,13 @@ . /etc/profile +# see https://wiki.archlinux.org/index.php/Power_Management#Hooks_in_.2Fusr.2Flib.2Fsystemd.2Fsystem-sleep + for script in $HOME/.config/sleep.d/*.power; do if [ -f $script ]; then - progress "running custom sleep script $script ($1)..." - sh $script $1 + progress "running custom sleep script $script ($@)..." + sh $script $@ fi done + +exit 0 \ No newline at end of file diff --git a/packages/mediacenter/xbmc/system.d/xbmc-lcd-suspend.service b/packages/mediacenter/xbmc/system.d/xbmc-lcd-suspend.service new file mode 100644 index 0000000000..ee10d3054b --- /dev/null +++ b/packages/mediacenter/xbmc/system.d/xbmc-lcd-suspend.service @@ -0,0 +1,13 @@ +[Unit] +Description=LIRC sleep hook +Before=sleep.target +StopWhenUnneeded=yes + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=-/usr/bin/xbmc-send --host=127.0.0.1 -a "LCD.Suspend" +ExecStop=-/usr/bin/xbmc-send --host=127.0.0.1 -a "LCD.Resume" + +[Install] +WantedBy=sleep.target diff --git a/packages/mediacenter/xbmc/system.d/xbmc-lirc-suspend.service b/packages/mediacenter/xbmc/system.d/xbmc-lirc-suspend.service new file mode 100644 index 0000000000..f229b6b193 --- /dev/null +++ b/packages/mediacenter/xbmc/system.d/xbmc-lirc-suspend.service @@ -0,0 +1,13 @@ +[Unit] +Description=LIRC sleep hook +Before=sleep.target +StopWhenUnneeded=yes + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=-/usr/bin/xbmc-send --host=127.0.0.1 -a "LIRC.Stop" +ExecStop=-/usr/bin/xbmc-send --host=127.0.0.1 -a "LIRC.Start" + +[Install] +WantedBy=sleep.target