xbmc & xbmc-pvr: redesign of poweroff and reboot.

This commit is contained in:
Gregor Fuis 2012-02-27 19:10:01 +01:00
parent 0e58875ea4
commit 33ef1232fb
8 changed files with 106 additions and 6 deletions

View File

@ -71,22 +71,39 @@ fi
cpupower frequency-set -g ondemand > /dev/null 2>&1
)&
# prevent restrating XBMC at reboot or shutdown
XBMC_LOCKED="/storage/xbmc_locked"
[ -f $XBMC_LOCKED ] && rm -f $XBMC_LOCKED &
# starting XBMC
usleep $XBMC_STARTDELAY
while true; do
while [ -f $XBMC_LOCKED ]; 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 $XBMC_LOCKED
poweroff -f
fi
;;
64)
poweroff -f
if [ ! $(pidof console-kit-daemon) ]; then
touch $XBMC_LOCKED
poweroff -f
fi
;;
66)
reboot
if [ ! $(pidof console-kit-daemon) ]; then
touch $XBMC_LOCKED
reboot
fi
;;
255)
echo "Abnormal Exit. Exited with code $RET"

View File

@ -27,6 +27,7 @@ PYTHON_LIBDIR="`ls -d $INSTALL/usr/lib/python*`"
mkdir -p $INSTALL/usr/bin
cp $PKG_DIR/scripts/cputemp $INSTALL/usr/bin
cp $PKG_DIR/scripts/gputemp $INSTALL/usr/bin
cp $PKG_DIR/scripts/wait_on_xbmc_exit $INSTALL/usr/bin
cp $PKG_BUILD/tools/EventClients/Clients/XBMC\ Send/xbmc-send.py $INSTALL/usr/bin/xbmc-send
mkdir -p $INSTALL/usr/lib/xbmc

View File

@ -0,0 +1,29 @@
#!/bin/sh
################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv
# http://www.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, 675 Mass Ave, Cambridge, MA 02139, 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

View File

@ -71,22 +71,39 @@ fi
cpupower frequency-set -g ondemand > /dev/null 2>&1
)&
# prevent restrating XBMC at reboot or shutdown
XBMC_LOCKED="/storage/xbmc_locked"
[ -f $XBMC_LOCKED ] && rm -f $XBMC_LOCKED &
# starting XBMC
usleep $XBMC_STARTDELAY
while true; do
while [ -f $XBMC_LOCKED ]; 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 $XBMC_LOCKED
poweroff -f
fi
;;
64)
poweroff -f
if [ ! $(pidof console-kit-daemon) ]; then
touch $XBMC_LOCKED
poweroff -f
fi
;;
66)
reboot
if [ ! $(pidof console-kit-daemon) ]; then
touch $XBMC_LOCKED
reboot
fi
;;
255)
echo "Abnormal Exit. Exited with code $RET"

View File

@ -27,6 +27,7 @@ PYTHON_LIBDIR="`ls -d $INSTALL/usr/lib/python*`"
mkdir -p $INSTALL/usr/bin
cp $PKG_DIR/scripts/cputemp $INSTALL/usr/bin
cp $PKG_DIR/scripts/gputemp $INSTALL/usr/bin
cp $PKG_DIR/scripts/wait_on_xbmc_exit $INSTALL/usr/bin
cp $PKG_BUILD/tools/EventClients/Clients/XBMC\ Send/xbmc-send.py $INSTALL/usr/bin/xbmc-send
mkdir -p $INSTALL/usr/lib/xbmc

View File

@ -0,0 +1,29 @@
#!/bin/sh
################################################################################
# Copyright (C) 2009-2010 OpenELEC.tv
# http://www.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, 675 Mass Ave, Cambridge, MA 02139, 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

View File

@ -20,4 +20,7 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
XBMC_LOCKED="/storage/xbmc_locked"
touch $XBMC_LOCKED
wait_on_xbmc_exit
reboot

View File

@ -20,4 +20,7 @@
# http://www.gnu.org/copyleft/gpl.html
################################################################################
XBMC_LOCKED="/storage/xbmc_locked"
touch $XBMC_LOCKED
wait_on_xbmc_exit
poweroff