Pre-Eden XBMC-live on Ubuntu 10.04 Lucid

I wanted to try out some of the new features in the upcoming XBMC Eden release.

The problem is that I am running XMBC-live on Ubuntu 10.04 Lucid and the Eden xbmc-live package requires the uxlaunch package which is only available in newer versions of Ubuntu. However, it is still possible to get a working xbmc-live setup by manually configuring the system startup.

NOTICE: This guide describes how I was able to upgrade my existing Ubuntu 10.04 XMBC-live system to work with Eden nightlies. I have no idea if this process works on fresh installs or different versions of Ubuntu. If you are running Ubuntu 10.04, I would recommend installing the stable version of XBMC-live prior to attempting this guide.

First, add the XBMC nightly PPA. The official PPA is provided by Team-XBMC and can be found here: ppa:team-xbmc/unstable.

However, at time of writing, the official PPA was having some problems with the build servers, so I ended up using a ppa recommended on XBMCFreak located here: ppa:nathan-renniewaldock/xbmc-nightly.

The first step is to install the new PPA and update your sources.

sudo add-apt-repository ppa:nathan-renniewaldock/xbmc-nightly
sudo apt-get update

Next, upgrade the xbmc packages:

apt-get upgrade xbmc xbmc-bin

During this process, some of the old xbmc packages will be removed, including xbmc-data and xbmc-standalone.

Now we should have the new version of xbmc installed, however, when we boot the system, X will not start automatically and we will be left with a login prompt.

The final step is to edit the startup script. This script is located at /etc/init/xbmc-live.conf and probably already exists if you already had a previous version of XMBC-live installed. There is a simple change to make to the script to point it at the new executable.

Open the script:

sudo nano /etc/init/xbmc-live.conf

Scroll down to the script section and change the exec from /usr/bin/runXBMC to /usr/bin/xbmc-standalone:

script
        if ! grep -i -q autostart /tmp/xbmcliveParams ; then
                exit
        fi

        exec /bin/su xbmc -c "/usr/bin/startx /etc/X11/Xsession /usr/bin/xbmc-standalone"
end script

Restart your system and XMBC should come up. Switch to the confluence skin to see the new features.

Here is the full script for completeness:

# xbmc-live
#
# init XBMC environment and starts XBMC in fullscreen (if asked to do so)

#      Copyright (C) 2005-2008 Team XBMC
#      http://www.xbmc.org
#
#  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 XBMC; 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

description     "XBMCLive"
author          "Luigi Capriotti"

start on (filesystem and stopped udevtrigger)

stop on runlevel [06]

emits starting-x

pre-start script
    get_opt() {
        echo "$@" | cut -d "=" -f 2
    }

    clear >/dev/tty7 || true

    CMDLINE=$(cat /proc/cmdline)

    #Process command line options
    XBMC_PARAMS=""
    for i in ${CMDLINE}; do
        case "${i}" in
        xbmc\=*)
              XBMC_PARAMS=$(get_opt $i)
              ;;
        esac
    done
    echo $XBMC_PARAMS > /tmp/xbmcliveParams

    if grep "boot=live" /proc/cmdline ; then
        # Relies on init scripts to mount boot device on a specified directory
        BOOTMEDIAMOUNTPOINT="/live/image"
    fi

    BOOTHOOKSDIRECTORY="/etc/xbmc"

    xbmcUser=xbmc
    # Read configuration variable file if it is present
    [ -r /etc/default/xbmc-live ] && . /etc/default/xbmc-live
    if ! getent passwd $xbmcUser >/dev/null; then
        xbmcUser=$(getent passwd 1000 | sed -e 's/\:.*//')
    fi

    # Executes pre-hooks (if any) in the System "Hooks" directory
    if [ -d $BOOTHOOKSDIRECTORY/live.d ]; then
      for hook in $(find $BOOTHOOKSDIRECTORY/live.d -type f -perm /u=x,g=x,o=x | sort)
      do
            $hook $BOOTMEDIAMOUNTPOINT $XBMC_PARAMS  || true
      done
    fi

    # Executes pre-hooks (if any) in the user "Hooks" directory
    if [ -d /home/$xbmcUser/.xbmc/live.d ]; then
      for hook in $(find /home/$xbmcUser/.xbmc/live.d -type f -perm /u=x,g=x,o=x | sort)
      do
            $hook $BOOTMEDIAMOUNTPOINT $XBMC_PARAMS  || true
      done
    fi

    if [ -f /home/$xbmcUser/.xsession ] ; then
        rm /home/$xbmcUser/.xsession
    fi
    if [ -f /tmp/noRestartXBMC ] ; then
        rm /tmp/noRestartXBMC
    fi
end script

script
    if ! grep -i -q autostart /tmp/xbmcliveParams ; then
        exit
    fi

    exec /bin/su xbmc -c "/usr/bin/startx /etc/X11/Xsession /usr/bin/xbmc-standalone"
end script

pre-stop script
    touch /tmp/noRestartXBMC
    rm /tmp/xbmcliveParams

    # Clean up the console before we switch to it, to avoid text flicker
    if [ -x /usr/bin/tput ] ; then
        tput -Tlinux reset > /dev/tty1 || true
        tput -Tlinux reset > /dev/tty8 || true
    fi

    # Clear VT 1 & 8 of any console messages
    clear >/dev/tty1 || true
    clear >/dev/tty8 || true
end script