From 4c2d0c78dc68e93935ce671abd9a031fbba11145 Mon Sep 17 00:00:00 2001 From: Stephan Raue Date: Wed, 30 May 2012 20:14:59 +0200 Subject: [PATCH] xbmc-frodo: sync scripts with package 'xbmc' Signed-off-by: Stephan Raue --- .../xbmc-frodo/init.d/91_cleanup-logfiles | 4 +-- .../xbmc-frodo/init.d/92_setup-xbmc | 1 + .../mediacenter/xbmc-frodo/init.d/93_xbmc | 34 ++++++++++++++----- .../xbmc-frodo/scripts/setwakeup.sh | 28 +++++++++++++++ .../xbmc-frodo/scripts/wait_on_xbmc_exit | 29 ++++++++++++++++ 5 files changed, 85 insertions(+), 11 deletions(-) create mode 100755 packages/mediacenter/xbmc-frodo/scripts/setwakeup.sh create mode 100755 packages/mediacenter/xbmc-frodo/scripts/wait_on_xbmc_exit diff --git a/packages/mediacenter/xbmc-frodo/init.d/91_cleanup-logfiles b/packages/mediacenter/xbmc-frodo/init.d/91_cleanup-logfiles index 3447a2bad0..7f479fe516 100644 --- a/packages/mediacenter/xbmc-frodo/init.d/91_cleanup-logfiles +++ b/packages/mediacenter/xbmc-frodo/init.d/91_cleanup-logfiles @@ -1,6 +1,6 @@ ################################################################################ -# Copyright (C) 2009-2010 OpenELEC.tv -# http://www.openelec.tv +# 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 diff --git a/packages/mediacenter/xbmc-frodo/init.d/92_setup-xbmc b/packages/mediacenter/xbmc-frodo/init.d/92_setup-xbmc index 4e68137e9a..7075f3d3fe 100644 --- a/packages/mediacenter/xbmc-frodo/init.d/92_setup-xbmc +++ b/packages/mediacenter/xbmc-frodo/init.d/92_setup-xbmc @@ -17,6 +17,7 @@ # the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. # http://www.gnu.org/copyleft/gpl.html ################################################################################ + # setup XBMC # # runlevels: openelec diff --git a/packages/mediacenter/xbmc-frodo/init.d/93_xbmc b/packages/mediacenter/xbmc-frodo/init.d/93_xbmc index 6ff48d66e9..6fb03041e9 100644 --- a/packages/mediacenter/xbmc-frodo/init.d/93_xbmc +++ b/packages/mediacenter/xbmc-frodo/init.d/93_xbmc @@ -17,6 +17,7 @@ # the Free Software Foundation, 51 Franklin Street, Suite 500, Boston, MA 02110, USA. # http://www.gnu.org/copyleft/gpl.html ################################################################################ + # starting XBMC # # runlevels: openelec @@ -35,9 +36,6 @@ fi # hack: make addon-bins executable chmod +x /storage/.xbmc/addons/*/bin/* > /dev/null 2>&1 -# hack: make addon-libs executable - chmod +x /storage/.xbmc/addons/*/lib/* > /dev/null 2>&1 - # hack to support user installed fonts SUBFONTS="/storage/.xbmc/userdata/fonts" if [ -d "$SUBFONTS" ]; then @@ -64,28 +62,46 @@ fi # waiting for Xorg to start wait_for_xorg -# set cpu's to 'on demand' +# set cpu's to 'conservative' ( usleep 15000000 - progress "set cpu's to 'on demand'" - cpupower frequency-set -g ondemand > /dev/null 2>&1 + progress "set cpu's to 'conservative'" + cpupower frequency-set -g conservative > /dev/null 2>&1 )& +# prevent restrating XBMC at reboot or shutdown + LOCKDIR="/var/lock/" + LOCKFILE="xbmc.disabled" + [ -f "$LOCKDIR/$LOCKFILE" ] && rm -f "$LOCKDIR/$LOCKFILE" & + # starting XBMC usleep $XBMC_STARTDELAY while true; do + while [ -f "$LOCKDIR/$LOCKFILE" ]; do + usleep 250000 + done + DISPLAY=:0.0 /usr/lib/xbmc/xbmc.bin $XBMC_ARGS > /dev/null 2>&1 RET=$? case "$RET" in 0) - poweroff -f + if [ ! $(pidof console-kit-daemon) ]; then + touch "$LOCKDIR/$LOCKFILE" + poweroff -f + fi ;; 64) - poweroff -f + if [ ! $(pidof console-kit-daemon) ]; then + touch "$LOCKDIR/$LOCKFILE" + poweroff -f + fi ;; 66) - reboot + if [ ! $(pidof console-kit-daemon) ]; then + touch "$LOCKDIR/$LOCKFILE" + reboot + fi ;; 255) echo "Abnormal Exit. Exited with code $RET" diff --git a/packages/mediacenter/xbmc-frodo/scripts/setwakeup.sh b/packages/mediacenter/xbmc-frodo/scripts/setwakeup.sh new file mode 100755 index 0000000000..557abff270 --- /dev/null +++ b/packages/mediacenter/xbmc-frodo/scripts/setwakeup.sh @@ -0,0 +1,28 @@ +#!/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 +################################################################################ + +if [ -f /sys/class/rtc/rtc0/wakealarm ]; then + logger -t setwakeup.sh "### Setting system wakeup time ###" + echo 0 > /sys/class/rtc/rtc0/wakealarm + echo $1 > /sys/class/rtc/rtc0/wakealarm + logger -t setwakeup.sh "### $(cat /proc/driver/rtc) ###" +fi diff --git a/packages/mediacenter/xbmc-frodo/scripts/wait_on_xbmc_exit b/packages/mediacenter/xbmc-frodo/scripts/wait_on_xbmc_exit new file mode 100755 index 0000000000..60efb36402 --- /dev/null +++ b/packages/mediacenter/xbmc-frodo/scripts/wait_on_xbmc_exit @@ -0,0 +1,29 @@ +#!/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 +################################################################################ + +count=0 + +while [ $(pidof xbmc.bin) -a $count -le 20 ]; do + usleep 250000 + logger -t wait_on_xbmc_exit "### Waiting for XBMC to Exit - $count ###" + count=$((count+1)) +done