make install script work with OpenELEC

Former-commit-id: 6a929160576979b9bb869d9b4297510a764a5c56
This commit is contained in:
johan 2014-01-05 15:47:47 +01:00
parent 7f11f9befa
commit cc42821a50
1 changed files with 39 additions and 9 deletions

View File

@ -5,12 +5,14 @@
# Find out if we are on Raspbmc # Find out if we are on Raspbmc
IS_XBIAN=`cat /etc/issue | grep XBian | wc -l` IS_XBIAN=`cat /etc/issue | grep XBian | wc -l`
IS_RASPBMC=`cat /etc/issue | grep Raspbmc | wc -l` IS_RASPBMC=`cat /etc/issue | grep Raspbmc | wc -l`
IS_OPENELEC=`cat /etc/issue | grep -m 1 OpenELEC | wc -l`
# check which init script we should use # check which init script we should use
USE_INITCTL=`which /sbin/initctl | wc -l` USE_INITCTL=`which /sbin/initctl | wc -l`
USE_SERVICE=`which /usr/sbin/service | wc -l`
# Make sure that the boblight daemon is no longer running # Make sure that the boblight daemon is no longer running
BOBLIGHT_PROCNR=$(ps -e | grep "boblight" | wc -l) BOBLIGHT_PROCNR=$(pidof boblightd | wc -l)
if [ $BOBLIGHT_PROCNR -eq 1 ]; if [ $BOBLIGHT_PROCNR -eq 1 ];
then then
echo 'Found running instance of boblight. Please stop boblight via XBMC menu before installing hyperion' echo 'Found running instance of boblight. Please stop boblight via XBMC menu before installing hyperion'
@ -21,16 +23,28 @@ fi
# Start the hyperion daemon # Start the hyperion daemon
if [ $USE_INITCTL -eq 1 ]; then if [ $USE_INITCTL -eq 1 ]; then
/sbin/initctl stop hyperion /sbin/initctl stop hyperion
else elif [ $USE_SERVICE -eq 1 ]; then
/usr/sbin/service hyperion stop /usr/sbin/service hyperion stop
fi fi
# Get and extract the Hyperion binaries and effects to /opt # Get and extract the Hyperion binaries and effects
wget https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz echo 'Downloading hyperion'
if [ $IS_OPENELEC -eq 1 ]; then
# OpenELEC has a readonly file system. Use alternative location
curl --get https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz | tar -C /storage -xz
curl --get https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.deps.openelec-rpi.tar.gz | tar -C /storage/hyperion/bin -xz
# modify the default config to have a correct effect path
sed -i 's:/opt:/storage:g' /storage/hyperion/config/hyperion.config.json
else
wget https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz
fi
# create links to the binaries # create links to the binaries
ln -fs /opt/hyperion/bin/hyperiond /usr/bin/hyperiond if [ $IS_OPENELEC -ne 1 ]; then
ln -fs /opt/hyperion/bin/hyperion-remote /usr/bin/hyperion-remote ln -fs /opt/hyperion/bin/hyperiond /usr/bin/hyperiond
ln -fs /opt/hyperion/bin/hyperion-remote /usr/bin/hyperion-remote
fi
# create link to the gpio changer (gpio->spi) # create link to the gpio changer (gpio->spi)
if [ $IS_RASPBMC -eq 1 ]; then if [ $IS_RASPBMC -eq 1 ]; then
@ -38,25 +52,41 @@ if [ $IS_RASPBMC -eq 1 ]; then
fi fi
# Copy a link to the hyperion configuration file to /etc # Copy a link to the hyperion configuration file to /etc
ln -s /opt/hyperion/config/hyperion.config.json /etc/hyperion.config.json if [ $IS_OPENELEC -eq 1 ]; then
# copy to alternate location, because of readonly file system
# /storage/.config is available as samba share. A symbolic link would not be working
false | cp -i /storage/hyperion/config/hyperion.config.json /storage/.config/hyperion.config.json 2>/dev/null
else
ln -s /opt/hyperion/config/hyperion.config.json /etc/hyperion.config.json
fi
# Copy the service control configuration to /etc/int # Copy the service control configuration to /etc/int
if [ $USE_INITCTL -eq 1 ]; then if [ $USE_INITCTL -eq 1 ]; then
echo 'Installing initctl script'
if [ $IS_RASPBMC -eq 1 ]; then if [ $IS_RASPBMC -eq 1 ]; then
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/ wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
else else
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
fi fi
else elif [ $USE_SERVICE -eq 1 ]; then
echo 'Installing startup script in init.d'
# place startup script in init.d and add it to upstart # place startup script in init.d and add it to upstart
ln -fs /opt/hyperion/init.d/hyperion.init.sh /etc/init.d/hyperion ln -fs /opt/hyperion/init.d/hyperion.init.sh /etc/init.d/hyperion
chmod +x /etc/init.d/hyperion chmod +x /etc/init.d/hyperion
update-rc.d hyperion defaults 98 02 update-rc.d hyperion defaults 98 02
elif [ $IS_OPENELEC -eq 1 ]; then
# only add to start script if hyperion is not present yet
if [ `cat /storage/.config/autostart.sh 2>/dev/null | grep hyperiond | wc -l` -eq 0 ]; then
echo 'Adding Hyperion to autostart script'
echo "/storage/hyperion/bin/hyperiond.sh /storage/.config/hyperion.config.json > /dev/null 2>&1 &" >> /storage/.config/autostart.sh
chmod +x /storage/.config/autostart.sh
fi
fi fi
# Start the hyperion daemon # Start the hyperion daemon
if [ $USE_INITCTL -eq 1 ]; then if [ $USE_INITCTL -eq 1 ]; then
/sbin/initctl start hyperion /sbin/initctl start hyperion
else elif [ $USE_SERVICE -eq 1 ]; then
/usr/sbin/service hyperion start /usr/sbin/service hyperion start
fi fi