mirror of
https://github.com/archr-linux/Arch-R.git
synced 2026-03-31 14:41:55 -07:00
120 lines
3.5 KiB
Plaintext
120 lines
3.5 KiB
Plaintext
################################################################################
|
|
# 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, 51 Franklin Street, Suite 500, Boston, MA 02110, USA.
|
|
# http://www.gnu.org/copyleft/gpl.html
|
|
################################################################################
|
|
|
|
# starting XBMC
|
|
#
|
|
# runlevels: openelec
|
|
|
|
LIRCDEV="/var/run/lirc/lircd"
|
|
[ -e /var/run/lirc/lircd.irtrans ] && LIRCDEV="/var/run/lirc/lircd.irtrans"
|
|
XBMC_ARGS="--standalone -fs --lircdev $LIRCDEV"
|
|
|
|
progress "starting XBMC"
|
|
|
|
# hack for Boxee Remote
|
|
if $(cat /proc/bus/input/devices | grep Vendor=0471 | grep -q Product=20d9);then
|
|
export SDL_MOUSE_RELATIVE=0
|
|
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
|
|
files=$(ls $SUBFONTS/*.[tT][tT][fF] 2>/dev/null | wc -l)
|
|
if [ "$files" = "0" ]; then
|
|
cp /usr/share/xbmc/media/Fonts/*.[tT][tT][fF] $SUBFONTS/
|
|
fi
|
|
mount --bind $SUBFONTS /usr/share/xbmc/media/Fonts/
|
|
fi
|
|
|
|
# starting autostart script (will be removed later again, dont use it!!!)
|
|
AUTOSTART="/storage/.config/autostart.sh"
|
|
if [ -f $AUTOSTART ]; then
|
|
echo "!!! AUTOSTART script detected !!!" >> /var/log/messages
|
|
cat "$AUTOSTART" >> /var/log/messages
|
|
echo "!!! -End of autostart script- !!!" >> /var/log/messages
|
|
|
|
sh $AUTOSTART
|
|
fi
|
|
|
|
# starting autoupdate
|
|
[ -f /usr/bin/autoupdate ] && /usr/bin/autoupdate &
|
|
|
|
# waiting for Xorg to start
|
|
wait_for_xorg
|
|
|
|
# set cpu's to 'conservative'
|
|
( usleep 15000000
|
|
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)
|
|
if [ ! $(pidof console-kit-daemon) ]; then
|
|
touch "$LOCKDIR/$LOCKFILE"
|
|
poweroff -f
|
|
fi
|
|
;;
|
|
64)
|
|
if [ ! $(pidof console-kit-daemon) ]; then
|
|
touch "$LOCKDIR/$LOCKFILE"
|
|
poweroff -f
|
|
fi
|
|
;;
|
|
66)
|
|
if [ ! $(pidof console-kit-daemon) ]; then
|
|
touch "$LOCKDIR/$LOCKFILE"
|
|
reboot
|
|
fi
|
|
;;
|
|
255)
|
|
echo "Abnormal Exit. Exited with code $RET"
|
|
echo "is Xorg running? check /var/log/Xorg.log"
|
|
;;
|
|
*)
|
|
echo "Abnormal Exit. Exited with code $RET"
|
|
;;
|
|
esac
|
|
|
|
usleep 250000
|
|
done
|