PDA

View Full Version : Script to fully install XBMC and configure autostart on Kubuntu 8.04 Desktop


hitman
2009-01-09, 12:17
I put together the following script to fully install xbmc and set it to autostart. This script can be run from a Vanilla install of Kubuntu 8.04 Desktop. It may work on other versions but I have only tested on 8.04.

Create a file such as install_xbmc.sh and paste the following code into it:

# Set user that runs XBMC here, assumes that the user that executed the
# script will be running XBMC, if not then comment out this line and uncomment
# the one after and change <username> to the required user.
XBMC_USER=`who am i | awk '{ print $1 }'`
#XBMC_USER=<username>

# Add sources:
echo "deb http://ppa.launchpad.net/team-xbmc-gutsy/ubuntu gutsy main
deb-src http://ppa.launchpad.net/team-xbmc-gutsy/ubuntu gutsy main
deb http://ppa.launchpad.net/team-xbmc-hardy/ubuntu hardy main
deb-src http://ppa.launchpad.net/team-xbmc-hardy/ubuntu hardy main
deb http://ppa.launchpad.net/team-xbmc-intrepid/ubuntu intrepid main
deb-src http://ppa.launchpad.net/team-xbmc-intrepid/ubuntu intrepid main
deb http://ppa.launchpad.net/team-xbmc-svn/ubuntu gutsy main
deb-src http://ppa.launchpad.net/team-xbmc-svn/ubuntu gutsy main
deb http://ppa.launchpad.net/team-xbmc-svn/ubuntu hardy main
deb-src http://ppa.launchpad.net/team-xbmc-svn/ubuntu hardy main
deb http://ppa.launchpad.net/team-xbmc-svn/ubuntu intrepid main
deb-src http://ppa.launchpad.net/team-xbmc-svn/ubuntu intrepid main
deb http://ppa.launchpad.net/xbmc-addons/ubuntu intrepid main
deb-src http://ppa.launchpad.net/xbmc-addons/ubuntu intrepid main
deb http://ppa.launchpad.net/xbmc-addons/ubuntu hardy main
deb-src http://ppa.launchpad.net/xbmc-addons/ubuntu hardy main
deb http://ppa.launchpad.net/xbmc-addons/ubuntu gutsy main
deb-src http://ppa.launchpad.net/xbmc-addons/ubuntu gutsy main" >> /etc/apt/sources.list.d/xbmc.list

# Update and install xbmc (Uncomment or add packages as required)
apt-get update
apt-get -y --force-yes install xbmc
#apt-get -y --force-yes install xbmc-skin-mediastream
#apt-get -y --force-yes install xbmc-eventclients-*
#apt-get -y --force-yes install xbmc-scripts

# Autostart configuration

# get homedir (as ~${XBMC_USER} didn't seem to work via sudo)

HOME_DIR=`grep ${XBMC_USER} /etc/passwd | cut -d":" -f6`

echo "#!/bin/bash
exec /usr/bin/xbmc --standalone" > ${HOME_DIR}/.xinitrc

chown ${XBMC_USER}:${XBMC_USER} ${HOME_DIR}/.xinitrc
chmod +x ${HOME_DIR}/.xinitrc

echo "if [[ x\`pidof X\` = \"x\" ]]; then startx; fi" >> ${HOME_DIR}/.bash_login
chown ${XBMC_USER}:${XBMC_USER} ${HOME_DIR}/.bash_login

#apt-get -y --force-yes install rcconf
apt-get -y --force-yes install mingetty

sed -i '/^exec \/sbin\/getty 38400 tty1/s/^/#/' /etc/event.d/tty1
sed -i "/exec \/sbin\/getty 38400 tty1/ aexec \/sbin\/mingetty \-\-autologin ${XBMC_USER} tty1" /etc/event.d/tty1

# Allow powerdown
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.shutdown
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.shutdown-multiple-sessions
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.reboot
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.reboot-multiple-sessions
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.set-powersave
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.suspend
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.hibernate

sed -i '/SystemPowerManagement/s/deny/allow/g' /etc/dbus-1/system.d/hal.conf
sed -i "/user/s/0/${XBMC_USER}/g" /etc/dbus-1/system.d/hal.conf

# Remove kdm from autostarting
update-rc.d -f kdm remove

execute the script using:
sudo sh install_xbmc.sh

Reboot and hopefully it will all work, it did for me in a VM.

EDIT: got most of the info from The PPA thread (http://www.xbmc.org/forum/showthread.php?t=33327) and the autostart thread (http://xbmc.org/forum/showthread.php?t=38473).

Cheers,
Hitman

rodercot
2009-01-18, 14:57
I put together the following script to fully install xbmc and set it to autostart. This script can be run from a Vanilla install of Kubuntu 8.04 Desktop. It may work on other versions but I have only tested on 8.04.

Create a file such as install_xbmc.sh and paste the following code into it:

# Set user that runs XBMC here, assumes that the user that executed the
# script will be running XBMC, if not then comment out this line and uncomment
# the one after and change <username> to the required user.
XBMC_USER=`who am i | awk '{ print $1 }'`
#XBMC_USER=<username>

# Add sources:
echo "deb http://ppa.launchpad.net/team-xbmc-gutsy/ubuntu gutsy main
deb-src http://ppa.launchpad.net/team-xbmc-gutsy/ubuntu gutsy main
deb http://ppa.launchpad.net/team-xbmc-hardy/ubuntu hardy main
deb-src http://ppa.launchpad.net/team-xbmc-hardy/ubuntu hardy main
deb http://ppa.launchpad.net/team-xbmc-intrepid/ubuntu intrepid main
deb-src http://ppa.launchpad.net/team-xbmc-intrepid/ubuntu intrepid main
deb http://ppa.launchpad.net/team-xbmc-svn/ubuntu gutsy main
deb-src http://ppa.launchpad.net/team-xbmc-svn/ubuntu gutsy main
deb http://ppa.launchpad.net/team-xbmc-svn/ubuntu hardy main
deb-src http://ppa.launchpad.net/team-xbmc-svn/ubuntu hardy main
deb http://ppa.launchpad.net/team-xbmc-svn/ubuntu intrepid main
deb-src http://ppa.launchpad.net/team-xbmc-svn/ubuntu intrepid main
deb http://ppa.launchpad.net/xbmc-addons/ubuntu intrepid main
deb-src http://ppa.launchpad.net/xbmc-addons/ubuntu intrepid main
deb http://ppa.launchpad.net/xbmc-addons/ubuntu hardy main
deb-src http://ppa.launchpad.net/xbmc-addons/ubuntu hardy main
deb http://ppa.launchpad.net/xbmc-addons/ubuntu gutsy main
deb-src http://ppa.launchpad.net/xbmc-addons/ubuntu gutsy main" >> /etc/apt/sources.list.d/xbmc.list

# Update and install xbmc (Uncomment or add packages as required)
apt-get update
apt-get -y --force-yes install xbmc
#apt-get -y --force-yes install xbmc-skin-mediastream
#apt-get -y --force-yes install xbmc-eventclients-*
#apt-get -y --force-yes install xbmc-scripts

# Autostart configuration

# get homedir (as ~${XBMC_USER} didn't seem to work via sudo)

HOME_DIR=`grep ${XBMC_USER} /etc/passwd | cut -d":" -f6`

echo "#!/bin/bash
exec /usr/bin/xbmc --standalone" > ${HOME_DIR}/.xinitrc

chown ${XBMC_USER}:${XBMC_USER} ${HOME_DIR}/.xinitrc
chmod +x ${HOME_DIR}/.xinitrc

echo "if [[ x\`pidof X\` = \"x\" ]]; then startx; fi" >> ${HOME_DIR}/.bash_login
chown ${XBMC_USER}:${XBMC_USER} ${HOME_DIR}/.bash_login

#apt-get -y --force-yes install rcconf
apt-get -y --force-yes install mingetty

sed -i '/^exec \/sbin\/getty 38400 tty1/s/^/#/' /etc/event.d/tty1
sed -i "/exec \/sbin\/getty 38400 tty1/ aexec \/sbin\/mingetty \-\-autologin ${XBMC_USER} tty1" /etc/event.d/tty1

# Allow powerdown
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.shutdown
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.shutdown-multiple-sessions
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.reboot
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.reboot-multiple-sessions
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.set-powersave
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.suspend
polkit-auth --user ${XBMC_USER} --grant org.freedesktop.hal.power-management.hibernate

sed -i '/SystemPowerManagement/s/deny/allow/g' /etc/dbus-1/system.d/hal.conf
sed -i "/user/s/0/${XBMC_USER}/g" /etc/dbus-1/system.d/hal.conf

# Remove kdm from autostarting
update-rc.d -f kdm remove

execute the script using:
sudo sh install_xbmc.sh

Reboot and hopefully it will all work, it did for me in a VM.

EDIT: got most of the info from The PPA thread (http://www.xbmc.org/forum/showthread.php?t=33327) and the autostart thread (http://xbmc.org/forum/showthread.php?t=38473).

Cheers,
Hitman


It seems to work on intrpeid. I built using netinstall8.10 using inetbootin from flash with no gdm. Already had my sources.list and xbmc installed so I commented out some lines that I did not need but it seemed to run fine for the rest and my ssh errors after login are gone.

Thanks,

Dave