xbmc: rework sleep scripts for systemd

Signed-off-by: Stephan Raue <stephan@openelec.tv>
This commit is contained in:
Stephan Raue 2013-08-06 13:43:26 +02:00
parent 4a5a22c670
commit 52086f25ab
7 changed files with 40 additions and 72 deletions

View File

@ -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
}

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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