Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

removed bashisms to allow the script to be processed by /bin/sh

  • Loading branch information...
commit 6d3f22c9e72a47aac99b41f5f1a50549c7e3c0bf 1 parent 9a4b788
lcapriotti authored
Showing with 53 additions and 41 deletions.
  1. +53 −41 tools/XBMCLive/xbmc
View
94 tools/XBMCLive/xbmc
@@ -22,32 +22,29 @@ get_opt() {
CMDLINE=$(cat /proc/cmdline)
-#Process command line options
-XBMC_PARAMS=""
-for i in ${CMDLINE}; do
- case "${i}" in
- xbmc\=*)
- XBMC_PARAMS=$(get_opt $i)
- ;;
- boot\=*)
- SRCMEDIA=$(echo "$i" | cut -d "=" -f 2)
- ;;
- esac
-done
-
-XBMC_BOOTTORAM="$( echo $XBMC_PARAMS | grep "boottoram" )"
-
-if [ "$XBMC_BOOTTORAM" != "" ]; then
- eject /dev/scd0 &> /dev/null
- eject /dev/scd1 &> /dev/null
- eject /dev/scd2 &> /dev/null
-fi
-
do_start()
{
log_action_begin_msg "Configuring system and starting XBMC"
- INSTALL="$( echo $XBMC_PARAMS | grep "install" )"
- if [ "$INSTALL" != "" ]; then
+
+ #Process command line options
+ XBMC_PARAMS=""
+ for i in ${CMDLINE}; do
+ case "${i}" in
+ xbmc\=*)
+ XBMC_PARAMS=$(get_opt $i)
+ ;;
+ esac
+ done
+
+ XBMC_BOOTTORAM="$(echo $XBMC_PARAMS | grep boottoram)"
+ if [ -n "$XBMC_BOOTTORAM" ]; then
+ eject /dev/scd0 &> /dev/null
+ eject /dev/scd1 &> /dev/null
+ eject /dev/scd2 &> /dev/null
+ fi
+
+ INSTALL="$( echo $XBMC_PARAMS | grep install)"
+ if [ -n "$INSTALL" ]; then
# if usplash is runing, make sure to stop it now, yes "start" kills it.
if pidof usplash > /dev/null; then
DO_NOT_SWITCH_VT=yes /etc/init.d/usplash start
@@ -55,41 +52,43 @@ do_start()
su -c "/usr/bin/installXBMC.py" -l
else
# Generates valid xorg.conf for proprietary drivers if missing
- XBMC_NOGENXCONF="$( echo $XBMC_PARAMS | grep "nogenxconf" )"
- if [ ! -e /etc/X11/xorg.conf ] && [ "$XBMC_NOGENXCONF" == "" ]; then
+ XBMC_NOGENXCONF="$( echo $XBMC_PARAMS | grep nogenxconf )"
+ if [ ! -e /etc/X11/xorg.conf ] && [ ! -n "$XBMC_NOGENXCONF" ]; then
NVIDIA="$(lspci -nn | grep 0300 | grep 10de)"
- if [ "$NVIDIA" == "" ]; then
+ if [ ! -n "$NVIDIA" ]; then
AMD="$(lspci -nn | grep 0300 | grep 1002)"
- if [ "$AMD" != "" ]; then
+ if [ -n "$AMD" ]; then
# run aticonfig
- echo "Generating xorg.conf for ATI..."
+ log_warning_msg "Generating xorg.conf for ATI..."
/usr/bin/aticonfig --initial --sync-vsync=on -f
fi
else
# run nvidia-xconfig
- echo "Generating xorg.conf for NVIDIA..."
+ log_warning_msg "Generating xorg.conf for NVIDIA..."
/usr/bin/nvidia-xconfig -s --no-logo --force-generate
fi
fi
- RUNX="$(grep "splash" /proc/cmdline)"
- if [ "$RUNX" == "" ]; then
- echo "Not starting X."
+ RUNX="$(echo $CMDLINE | grep splash)"
+ if [ ! -n "$RUNX" ]; then
+ log_warning_msg "Not starting X."
if [ -f /home/xbmc/.xsession ]; then
rm /home/xbmc/.xsession
fi
else
- NOMOUNT="$( echo $XBMC_PARAMS | grep "nodiskmount" )"
- if [ "$NOMOUNT" == "" ]; then
+ NOMOUNT="$(echo $XBMC_PARAMS | grep nodiskmount)"
+ if [ ! -n "$NOMOUNT" ]; then
+ log_warning_msg "Mounting local disks..."
/usr/bin/diskmounter &
fi
# Redirect XBMC home folder and logfile to usb flash
- if [ "$SRCMEDIA" == "usb" ]; then
- NOREDIR="$( echo $XBMC_PARAMS | grep "noredir" )"
- if [ "$NOREDIR" == "" ]; then
- echo "Redirect XBMC home folder and logfile to usb flash..."
+ SRCMEDIA="$(echo $CMDLINE | grep boot=usb)"
+ if [ -n "$SRCMEDIA" ]; then
+ NOREDIR="$(echo $XBMC_PARAMS | grep noredir)"
+ if [ ! -n "$NOREDIR" ]; then
+ log_warning_msg "Redirect XBMC home folder and logfile to usb flash..."
# Relies on init scripts to mount boot device on a specified directory
BOOTMEDIAMOUNTPOINT=`mount | grep bootMedia | cut -f 3 -d " "`
@@ -105,8 +104,8 @@ do_start()
fi
fi
- XBMC_SETVOLUME="$( echo $XBMC_PARAMS | grep "setvolume" )"
- if [ "$XBMC_SETVOLUME" != "" ]; then
+ XBMC_SETVOLUME="$(echo $XBMC_PARAMS | grep setvolume)"
+ if [ -n "$XBMC_SETVOLUME" ]; then
/usr/bin/setAlsaVolumes.py
fi
@@ -114,6 +113,7 @@ do_start()
if pidof usplash > /dev/null; then
DO_NOT_SWITCH_VT=yes /etc/init.d/usplash start
fi
+
/usr/bin/runXBMC.sh &
fi
fi
@@ -121,7 +121,19 @@ do_start()
}
do_stop() {
- killall Xorg xbmc
+ touch /tmp/noRestartXBMC
+ if [ -f /home/xbmc/.xsession ]; then
+ rm /home/xbmc/.xsession
+ fi
+
+ if [ "$(pidof xbmc.bin)" ] ; then
+ killall xbmc.bin
+ sleep 1
+ fi
+
+ if [ -f /tmp/noRestartXBMC ]; then
+ rm /tmp/noRestartXBMC
+ fi
}
case "$1" in
Please sign in to comment.
Something went wrong with that request. Please try again.