2013-07-26 22:38:34 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2013-10-02 09:44:08 +02:00
|
|
|
# Script for downloading and installing the latest Hyperion release
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2014-01-04 14:12:33 +01:00
|
|
|
# Find out if we are on Raspbmc
|
2013-11-24 13:37:30 +01:00
|
|
|
IS_XBIAN=`cat /etc/issue | grep XBian | wc -l`
|
2014-01-04 14:12:33 +01:00
|
|
|
IS_RASPBMC=`cat /etc/issue | grep Raspbmc | wc -l`
|
|
|
|
|
|
|
|
# check which init script we should use
|
|
|
|
USE_INITCTL=`which /sbin/initctl | wc -l`
|
2013-11-24 13:37:30 +01:00
|
|
|
|
2013-10-02 09:44:08 +02:00
|
|
|
# Make sure that the boblight daemon is no longer running
|
|
|
|
BOBLIGHT_PROCNR=$(ps -e | grep "boblight" | wc -l)
|
|
|
|
if [ $BOBLIGHT_PROCNR -eq 1 ];
|
|
|
|
then
|
|
|
|
echo 'Found running instance of boblight. Please stop boblight via XBMC menu before installing hyperion'
|
|
|
|
exit
|
|
|
|
fi
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2013-10-02 09:44:08 +02:00
|
|
|
# Stop hyperion daemon if it is running
|
2014-01-04 14:28:33 +01:00
|
|
|
# Start the hyperion daemon
|
|
|
|
if [ $USE_INITCTL -eq 1 ]; then
|
|
|
|
/sbin/initctl stop hyperion
|
|
|
|
else
|
|
|
|
/usr/sbin/service hyperion stop
|
|
|
|
fi
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2013-12-14 06:39:51 +01:00
|
|
|
# Get and extract the Hyperion binaries and effects to /opt
|
|
|
|
wget https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz
|
2013-11-24 13:37:30 +01:00
|
|
|
|
2013-12-14 06:39:51 +01:00
|
|
|
# create links to the binaries
|
|
|
|
ln -fs /opt/hyperion/bin/hyperiond /usr/bin/hyperiond
|
|
|
|
ln -fs /opt/hyperion/bin/hyperion-remote /usr/bin/hyperion-remote
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2013-12-14 06:39:51 +01:00
|
|
|
# create link to the gpio changer (gpio->spi)
|
2014-01-04 14:12:33 +01:00
|
|
|
if [ $IS_RASPBMC -eq 1 ]; then
|
2013-12-14 06:39:51 +01:00
|
|
|
ln -fs /opt/hyperion/bin/gpio2spi /usr/bin/gpio2spi
|
2013-11-24 13:37:30 +01:00
|
|
|
fi
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2013-12-14 06:39:51 +01:00
|
|
|
# Copy a link to the hyperion configuration file to /etc
|
|
|
|
ln -s /opt/hyperion/config/hyperion.config.json /etc/hyperion.config.json
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2013-10-02 09:44:08 +02:00
|
|
|
# Copy the service control configuration to /etc/int
|
2014-01-04 14:12:33 +01:00
|
|
|
if [ $USE_INITCTL -eq 1 ]; then
|
|
|
|
if [ $IS_RASPBMC -eq 1 ]; then
|
|
|
|
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
|
|
|
|
else
|
|
|
|
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
|
|
|
|
fi
|
2013-11-24 13:37:30 +01:00
|
|
|
else
|
2014-01-04 14:12:33 +01:00
|
|
|
# place startup script in init.d and add it to upstart
|
2014-01-04 14:28:33 +01:00
|
|
|
ln -fs /opt/hyperion/init.d/hyperion.init.sh /etc/init.d/hyperion
|
2014-01-04 14:12:33 +01:00
|
|
|
chmod +x /etc/init.d/hyperion
|
|
|
|
update-rc.d hyperion defaults 98 02
|
2013-11-24 13:37:30 +01:00
|
|
|
fi
|
2013-10-02 09:44:08 +02:00
|
|
|
|
|
|
|
# Start the hyperion daemon
|
2014-01-04 14:12:33 +01:00
|
|
|
if [ $USE_INITCTL -eq 1 ]; then
|
|
|
|
/sbin/initctl start hyperion
|
|
|
|
else
|
|
|
|
/usr/sbin/service hyperion start
|
|
|
|
fi
|