Hannes The Hun Wrote:after fiddling around a lot with the terminal in putty, I'd love to have the possibility in XBMCbuntu/XBMC live to have an additional Shutdown-Option that ends XBMC and starts a Gnome Session
if someone tells me how to do that manually I'll gladly try that
Funny you should ask... I Have done just that by modifying /usr/bin/runXBMC.sh. When xbmc exits( not restart or shutdown)
This is my runXBMC.sh (Modified)
Code:
#!/bin/bash
if [ "$(pidof X)" ] ; then
/usr/share/xbmc/xbmc.bin --standalone
exit
fi
while true
do
echo "#!/bin/bash" > /home/xbmc/.xsession
echo "/usr/share/xbmc/xbmc.bin --standalone" >> /home/xbmc/.xsession
echo "case \"\$?\" in" >> /home/xbmc/.xsession
echo " 0 ) # Quit" >> /home/xbmc/.xsession
echo " touch /tmp/noRestartXBMC" >> /home/xbmc/.xsession
echo " break ;;" >> /home/xbmc/.xsession
echo " 64 ) # Shutdown System" >> /home/xbmc/.xsession
echo " sleep 10 ;;" >> /home/xbmc/.xsession
echo " 65 ) # Warm Reboot" >> /home/xbmc/.xsession
echo " echo "Restarting XBMC ..." ;;" >> /home/xbmc/.xsession
echo " 66 ) # Reboot System" >> /home/xbmc/.xsession
echo " sleep 10 ;;" >> /home/xbmc/.xsession
echo " * ) ;;" >> /home/xbmc/.xsession
echo "esac" >> /home/xbmc/.xsession
chown xbmc:xbmc /home/xbmc/.xsession
if [ "$(whoami)" == "root" ] ; then
su xbmc -c "startx -- -br > /dev/null 2>&1" -l
else
startx -- -br > /dev/null 2>&1
fi
if [ -e /tmp/noRestartXBMC ] ; then
rm /tmp/noRestartXBMC
rm /home/xbmc/.xsession
# break
# Start Gnome Session
echo "#!/bin/bash" > /home/xbmc/.xsession
echo "exec gnome-session" >> /home/xbmc/.xsession
chown xbmc:xbmc /home/xbmc/.xsession
if [ "$(whoami)" == "root" ] ; then
su xbmc -c "startx -- -br > /dev/null 2>&1" -l
else
startx -- -br > /dev/null 2>&1
fi
fi
sleep 2
done
You will notice that I have added extra code within the section that tests to see if noRestartXBMC has been created. This happens when the .xsession detects that xbmc has been terminated using "EXIT"
You will also need to install the following before modifying your runXBMC.sh
Code:
sudo apt get install gnome-core gnome-volume-manager gnome-themes gnome-themes-extras
WARNINGS:
1. Do NOT install gnome by only using the gnome virtual package. This will install gdm which will surely break your setup.
2. Altering runXBMC.sh may no be permenant if you installed the xbmc-live package. If the mantainer changes/updates this package and you upgrade your system, your changes may be lost. To avoid this, you need to manually install. these scripts. Google is you friend
3. This setup is what I do. Dont just copy and paste. Understand it and modify your own.
For Reference, I also modified the xbmc-live script and stripped out the what I deemed as xbmc live specific stuff. Also fixed up the issue with halting xbmc with sudo /etc/init.d/xbmc-live stop
This has been done by adding touch /tmp/noRestartXBMC to do_stop() method
Code:
#!/bin/sh
### BEGIN INIT INFO
# Provides: xbmc
# Required-Start: $local_fs $network $remote_fs
# Required-Stop: $local_fs $network $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Start and Stop XBMC
# - Edited by Zeppstar, Based on xbmc-live svn
# - Striped down to only provide bare minimum
# - Does not required kernel parameter to be passed as per guide
# - Changed do_stop() to terminate back to prompt rather than restart.
# - Added Audio reset to prevent pcm sound loss. (works for me)
#/etc/init.d/xbmc
. /lib/lsb/init-functions
do_start()
{
#Reset Audio - only required if PCM audio drops out after xbmc crash
iecset audio on
log_action_begin_msg "Configuring system and starting XBMC"
# if usplash is running, 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
fi
/usr/bin/runXBMC.sh &
log_action_end_msg 0
}
do_stop() {
touch /tmp/noRestartXBMC
killall xbmc.bin Xorg
}
case "$1" in
start)
do_start
;;
stop)
do_stop
;;
restart|force-reload)
do_stop
do_start
;;
*)
echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload}" >&2
exit 3
;;
esac
exit 0
Edit: I'd like to also add that my gnome-session section in runXBMC.sh is still work in progress. I'm still looking for a perfect blend for my .xssesion start up. Im also looking to add some better fonts. Keep you posted.