2013-07-26 22:38:34 +02:00
|
|
|
#!/bin/sh
|
2016-03-12 03:49:19 +01:00
|
|
|
# Script for downloading and installing the latest Hyperion release
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2014-01-05 16:27:35 +01:00
|
|
|
# Make sure /sbin is on the path (for service to find sub scripts)
|
|
|
|
PATH="/sbin:$PATH"
|
|
|
|
|
2016-03-22 01:01:54 +01:00
|
|
|
#Check which arguments are used
|
|
|
|
if [ "$1" = "HyperConInstall" ] || [ "$2" = "HyperConInstall" ]; then
|
|
|
|
HCInstall=1
|
|
|
|
else HCInstall=0
|
|
|
|
fi
|
2016-04-26 17:21:30 +02:00
|
|
|
if [ "$1" = "BETA" ] || [ "$2" = "BETA" ]; then
|
|
|
|
BETA=1
|
|
|
|
else BETA=0
|
|
|
|
fi
|
2016-03-22 01:01:54 +01:00
|
|
|
|
2016-03-12 03:49:19 +01:00
|
|
|
#Check, if script is running as root
|
|
|
|
if [ $(id -u) != 0 ]; then
|
|
|
|
echo '---> Critical Error: Please run the script as root (sudo sh ./install_hyperion.sh) -> abort'
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2016-04-26 17:21:30 +02:00
|
|
|
#Set welcome message
|
|
|
|
if [ $BETA -eq 1 ]; then
|
|
|
|
WMESSAGE="echo This script will update Hyperion to the latest BETA"
|
2016-06-10 18:32:39 +02:00
|
|
|
else WMESSAGE="echo This script will install/update Hyperion Ambient Light"
|
2016-04-26 17:21:30 +02:00
|
|
|
fi
|
|
|
|
|
2016-03-12 03:49:19 +01:00
|
|
|
#Welcome message
|
|
|
|
echo '*******************************************************************************'
|
2016-04-26 17:21:30 +02:00
|
|
|
$WMESSAGE
|
2016-04-26 12:27:59 +02:00
|
|
|
echo 'Created by brindosch - hyperion-project.org - the official Hyperion source.'
|
2016-03-12 03:49:19 +01:00
|
|
|
echo '*******************************************************************************'
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2016-05-04 18:50:40 +02:00
|
|
|
# Find out if we are on OpenElec (Rasplex) / OSMC / Raspbian
|
2016-05-05 12:38:24 +02:00
|
|
|
OS_OPENELEC=`grep -m1 -c 'OpenELEC\|RasPlex\|LibreELEC' /etc/issue`
|
|
|
|
OS_LIBREELEC=`grep -m1 -c LibreELEC /etc/issue`
|
2016-05-04 18:50:40 +02:00
|
|
|
OS_RASPLEX=`grep -m1 -c RasPlex /etc/issue`
|
2016-03-12 03:49:19 +01:00
|
|
|
OS_OSMC=`grep -m1 -c OSMC /etc/issue`
|
2016-04-26 12:27:59 +02:00
|
|
|
OS_RASPBIAN=`grep -m1 -c 'Raspbian\|RetroPie' /etc/issue`
|
2014-01-04 14:12:33 +01:00
|
|
|
|
2016-04-26 12:27:59 +02:00
|
|
|
# Find out which device this script runs on
|
2016-03-12 03:49:19 +01:00
|
|
|
CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710' /proc/cpuinfo`
|
|
|
|
CPU_IMX6=`grep -m1 -c i.MX6 /proc/cpuinfo`
|
|
|
|
CPU_WETEK=`grep -m1 -c Amlogic /proc/cpuinfo`
|
2016-03-15 21:27:57 +01:00
|
|
|
CPU_X32X64=`uname -m | grep 'x86_32\|i686\|x86_64' | wc -l`
|
2016-03-12 03:49:19 +01:00
|
|
|
# Check that we have a known configuration
|
2016-03-16 20:57:06 +01:00
|
|
|
if [ $CPU_RPI -ne 1 ] && [ $CPU_IMX6 -ne 1 ] && [ $CPU_WETEK -ne 1 ] && [ $CPU_X32X64 -ne 1 ]; then
|
2016-03-12 03:49:19 +01:00
|
|
|
echo '---> Critical Error: CPU information does not match any known releases -> abort'
|
|
|
|
exit 1
|
|
|
|
fi
|
2016-04-26 12:27:59 +02:00
|
|
|
|
|
|
|
#Check which RPi we are one (in case)
|
|
|
|
RPI_1=`grep -m1 -c BCM2708 /proc/cpuinfo`
|
|
|
|
RPI_2=`grep -m1 -c BCM2709 /proc/cpuinfo`
|
|
|
|
RPI_3=`grep -m1 -c BCM2710 /proc/cpuinfo`
|
|
|
|
|
2016-03-12 03:49:19 +01:00
|
|
|
#Check, if year equals 1970
|
|
|
|
DATE=$(date +"%Y")
|
|
|
|
if [ "$DATE" -le "2015" ]; then
|
|
|
|
echo "---> Critical Error: Please update your systemtime (Year of your system: ${DATE}) -> abort"
|
|
|
|
exit 1
|
|
|
|
fi
|
2015-01-24 23:42:22 +01:00
|
|
|
|
2014-01-04 14:12:33 +01:00
|
|
|
# check which init script we should use
|
2016-03-12 03:49:19 +01:00
|
|
|
USE_SYSTEMD=`grep -m1 -c systemd /proc/1/comm`
|
2014-01-04 14:12:33 +01:00
|
|
|
USE_INITCTL=`which /sbin/initctl | wc -l`
|
2014-01-05 15:47:47 +01:00
|
|
|
USE_SERVICE=`which /usr/sbin/service | 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
|
2014-01-05 15:47:47 +01:00
|
|
|
BOBLIGHT_PROCNR=$(pidof boblightd | wc -l)
|
2016-03-12 03:49:19 +01:00
|
|
|
if [ $BOBLIGHT_PROCNR -eq 1 ]; then
|
2016-04-26 12:27:59 +02:00
|
|
|
echo '---> Critical Error: Found running instance of boblight. Please stop boblight via Kodi menu before installing hyperion -> abort'
|
2016-03-12 03:49:19 +01:00
|
|
|
exit 1
|
2013-10-02 09:44:08 +02:00
|
|
|
fi
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2016-06-10 18:32:39 +02:00
|
|
|
#set service script path
|
|
|
|
SERVICEL="/usr/share/hyperion/services"
|
|
|
|
|
|
|
|
# Stop hyperion daemon if it is running and set service path
|
2016-03-12 03:49:19 +01:00
|
|
|
echo '---> Stop Hyperion, if necessary'
|
|
|
|
if [ $OS_OPENELEC -eq 1 ]; then
|
|
|
|
killall hyperiond 2>/dev/null
|
|
|
|
elif [ $USE_INITCTL -eq 1 ]; then
|
|
|
|
/sbin/initctl stop hyperion 2>/dev/null
|
2016-06-10 18:32:39 +02:00
|
|
|
SERVICEP="/etc/init"
|
2016-03-12 03:49:19 +01:00
|
|
|
elif [ $USE_SYSTEMD -eq 1 ]; then
|
|
|
|
service hyperion stop 2>/dev/null
|
2016-06-10 18:32:39 +02:00
|
|
|
SERVICEP="/etc/systemd/system"
|
2016-03-12 03:49:19 +01:00
|
|
|
#many people installed with the official script and this just uses service, if both registered -> dead
|
|
|
|
/usr/sbin/service hyperion stop 2>/dev/null
|
2016-06-10 18:32:39 +02:00
|
|
|
#Bad workaround for Jessie (systemd) users that used the old official script for install
|
|
|
|
update-rc.d -f hyperion remove 2>/dev/null
|
|
|
|
rm /etc/init.d/hyperion 2>/dev/null
|
|
|
|
elif [ $USE_SERVICE -eq 1 ]; then
|
|
|
|
/usr/sbin/service hyperion stop 2>/dev/null
|
|
|
|
SERVICEP="/etc/init.d"
|
2014-01-04 14:28:33 +01:00
|
|
|
fi
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2016-06-10 18:32:39 +02:00
|
|
|
#Install dependencies for Hyperion and setup preperation
|
2016-03-12 03:49:19 +01:00
|
|
|
if [ $OS_OPENELEC -ne 1 ]; then
|
|
|
|
echo '---> Install/Update Hyperion dependencies (This may take a while)'
|
|
|
|
apt-get -qq update && apt-get -qq --yes install libqtcore4 libqtgui4 libqt4-network libusb-1.0-0 ca-certificates
|
2016-06-10 18:32:39 +02:00
|
|
|
mkdir /etc/hyperion 2>/dev/null
|
2016-03-12 03:49:19 +01:00
|
|
|
fi
|
|
|
|
|
|
|
|
#Check, if dtparam=spi=on is in place (not for OPENELEC)
|
2016-04-26 12:27:59 +02:00
|
|
|
if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -ne 1 ]; then
|
2016-03-12 03:49:19 +01:00
|
|
|
SPIOK=`grep '^\dtparam=spi=on' /boot/config.txt | wc -l`
|
|
|
|
if [ $SPIOK -ne 1 ]; then
|
2016-05-05 12:55:11 +02:00
|
|
|
echo '---> Raspberry Pi found, but SPI is not set, we write "dtparam=spi=on" to /boot/config.txt'
|
2016-03-12 03:49:19 +01:00
|
|
|
sed -i '$a dtparam=spi=on' /boot/config.txt
|
2016-05-05 12:38:24 +02:00
|
|
|
if [ $HCInstall -ne 1 ]; then
|
|
|
|
REBOOTMESSAGE="echo Please reboot your Raspberry Pi, we inserted dtparam=spi=on to /boot/config.txt"
|
|
|
|
fi
|
2016-05-04 18:50:40 +02:00
|
|
|
fi
|
2016-03-12 03:49:19 +01:00
|
|
|
fi
|
|
|
|
|
2016-05-05 12:38:24 +02:00
|
|
|
#Check, if dtparam=spi=on is in place (just for OPENELEC/LibreELEC
|
2016-04-26 12:27:59 +02:00
|
|
|
if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ]; then
|
2016-03-12 03:49:19 +01:00
|
|
|
SPIOK=`grep '^\dtparam=spi=on' /flash/config.txt | wc -l`
|
|
|
|
if [ $SPIOK -ne 1 ]; then
|
|
|
|
mount -o remount,rw /flash
|
2016-05-05 12:55:11 +02:00
|
|
|
echo '---> RPi with OpenELEC/LibreELEC found, but SPI is not set, we write "dtparam=spi=on" to /flash/config.txt'
|
2016-03-12 03:49:19 +01:00
|
|
|
sed -i '$a dtparam=spi=on' /flash/config.txt
|
|
|
|
mount -o remount,ro /flash
|
2016-05-05 12:38:24 +02:00
|
|
|
if [ $HCInstall -ne 1 ]; then
|
|
|
|
REBOOTMESSAGE="echo Please reboot your OpenELEC/LibreELEC, we inserted dtparam=spi=on to /flash/config.txt"
|
|
|
|
fi
|
|
|
|
fi
|
2016-03-12 03:49:19 +01:00
|
|
|
fi
|
|
|
|
|
2016-06-10 18:32:39 +02:00
|
|
|
# compatibility layer to move old configs to new config dir
|
2016-06-11 00:28:55 +02:00
|
|
|
if [ -f "/opt/hyperion/bin/hyperiond" ]; then
|
2016-06-10 18:32:39 +02:00
|
|
|
echo '---> Old installation found, move configs to /etc/hyperion/ and move hyperion to /usr/share/hyperion/'
|
|
|
|
mv /opt/hyperion/config/*.json /etc/hyperion 2>/dev/null
|
|
|
|
sed -i "s|/opt/hyperion/effects|/usr/share/hyperion/effects|g" /etc/hyperion/*.json
|
2016-06-11 00:40:09 +02:00
|
|
|
CPO1=/etc/hyperion.config.json
|
|
|
|
CPO2=/opt/hyperion/config/hyperion.config.json
|
|
|
|
CPN=/etc/hyperion/hyperion.config.json
|
|
|
|
BPO=/opt/hyperion/bin/hyperiond
|
|
|
|
BPN=/usr/bin/hyperiond
|
2016-06-10 18:32:39 +02:00
|
|
|
if [ $USE_INITCTL -eq 1 ]; then
|
2016-06-11 00:40:09 +02:00
|
|
|
sed -i "s|$BPO|$BPN|g" $SERVICEP/hyperion.conf
|
|
|
|
sed -i "s|$CPO1|$CPN|g" $SERVICEP/hyperion.conf
|
|
|
|
sed -i "s|$CPO2|$CPN|g" $SERVICEP/hyperion.conf
|
2016-06-10 18:32:39 +02:00
|
|
|
initctl reload-configuration
|
|
|
|
elif [ $OS_OPENELEC -eq 1 ]; then
|
|
|
|
sleep 0
|
|
|
|
elif [ $USE_SYSTEMD -eq 1 ]; then
|
2016-06-11 00:40:56 +02:00
|
|
|
sed -i "s|$BPO|$BPN|g" $SERVICEP/hyperion.service
|
2016-06-11 00:40:09 +02:00
|
|
|
sed -i "s|$CPO1|$CPN|g" $SERVICEP/hyperion.service
|
|
|
|
sed -i "s|$CPO2|$CPN|g" $SERVICEP/hyperion.service
|
2016-06-10 18:32:39 +02:00
|
|
|
systemctl -q daemon-reload
|
|
|
|
elif [ $USE_SERVICE -eq 1 ]; then
|
2016-06-11 00:40:56 +02:00
|
|
|
sed -i "s|$BPO|$BPN|g" $SERVICEP/hyperion
|
2016-06-11 00:40:09 +02:00
|
|
|
sed -i "s|$CPO1|$CPN|g" $SERVICEP/hyperion
|
|
|
|
sed -i "s|$CPO2|$CPN|g" $SERVICEP/hyperion
|
2016-06-10 18:32:39 +02:00
|
|
|
update-rc.d hyperion defaults 98 02
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2016-04-26 17:21:30 +02:00
|
|
|
# Select the appropriate download path
|
|
|
|
if [ $BETA -eq 1 ]; then
|
|
|
|
HYPERION_ADDRESS=https://sourceforge.net/projects/hyperion-project/files/beta
|
|
|
|
else HYPERION_ADDRESS=https://sourceforge.net/projects/hyperion-project/files/release
|
|
|
|
fi
|
2016-03-12 03:49:19 +01:00
|
|
|
# Select the appropriate release
|
2016-05-04 18:50:40 +02:00
|
|
|
if [ $CPU_RPI -eq 1 ] && [ $OS_RASPLEX -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi_rasplex.tar.gz
|
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
|
2016-05-05 12:38:24 +02:00
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $OS_LIBREELEC -eq 1 ] && [ $RPI_1 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi_le.tar.gz
|
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
|
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $OS_LIBREELEC -eq 1 ] && [ $RPI_2 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi2_le.tar.gz
|
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
|
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $OS_LIBREELEC -eq 1 ] && [ $RPI_3 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi3_le.tar.gz
|
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
|
2016-05-04 18:50:40 +02:00
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ] && [ $RPI_1 -eq 1 ]; then
|
2016-04-26 12:27:59 +02:00
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi_oe.tar.gz
|
2016-03-12 03:49:19 +01:00
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
|
2016-04-26 12:27:59 +02:00
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ] && [ $RPI_2 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi2_oe.tar.gz
|
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
|
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ] && [ $RPI_3 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi3_oe.tar.gz
|
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
|
2016-04-26 15:54:02 +02:00
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $OS_OSMC -eq 1 ] && [ $RPI_1 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi_osmc.tar.gz
|
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $OS_OSMC -eq 1 ] && [ $RPI_2 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi2_osmc.tar.gz
|
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $OS_OSMC -eq 1 ] && [ $RPI_3 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi3_osmc.tar.gz
|
2016-04-26 12:27:59 +02:00
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $RPI_1 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi.tar.gz
|
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $RPI_2 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi2.tar.gz
|
|
|
|
elif [ $CPU_RPI -eq 1 ] && [ $RPI_3 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi3.tar.gz
|
2016-03-12 03:49:19 +01:00
|
|
|
elif [ $CPU_IMX6 -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_imx6.tar.gz
|
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-imx6.tar.gz
|
|
|
|
elif [ $CPU_WETEK -eq 1 ]; then
|
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_wetek.tar.gz
|
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
|
2016-03-15 21:27:57 +01:00
|
|
|
elif [ $CPU_X32X64 -eq 1 ]; then
|
2016-04-26 12:27:59 +02:00
|
|
|
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_x86x64.tar.gz
|
|
|
|
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-x86x64.tar.gz
|
2015-01-24 23:42:22 +01:00
|
|
|
else
|
2016-03-12 03:49:19 +01:00
|
|
|
echo "---> Critical Error: Target platform unknown -> abort"
|
|
|
|
exit 1
|
2015-01-24 23:42:22 +01:00
|
|
|
fi
|
2016-03-12 03:49:19 +01:00
|
|
|
|
|
|
|
# Get and extract the Hyperion binaries and effects
|
|
|
|
echo '---> Downloading the appropriate Hyperion release'
|
|
|
|
if [ $OS_OPENELEC -eq 1 ]; then
|
|
|
|
# OpenELEC has a readonly file system. Use alternative location
|
2016-05-05 12:38:24 +02:00
|
|
|
echo '---> Downloading Hyperion OpenELEC/LibreELEC release'
|
2016-03-12 03:49:19 +01:00
|
|
|
curl -# -L --get $HYPERION_RELEASE | tar -C /storage -xz
|
2016-05-05 12:38:24 +02:00
|
|
|
echo '---> Downloading Hyperion OpenELEC/LibreELEC dependencies'
|
2016-03-12 03:49:19 +01:00
|
|
|
curl -# -L --get $OE_DEPENDECIES | tar -C /storage/hyperion/bin -xz
|
|
|
|
#set the executen bit (failsave)
|
|
|
|
chmod +x -R /storage/hyperion/bin
|
|
|
|
else
|
2016-06-10 18:32:39 +02:00
|
|
|
BINSP=/usr/share/hyperion/bin
|
|
|
|
BINTP=/usr/bin
|
|
|
|
wget -nv $HYPERION_RELEASE -O - | tar -C /usr/share -xz
|
|
|
|
#set the executen bit (failsave) and move config to /etc/hyperion
|
|
|
|
chmod +x -R $BINSP
|
2016-03-12 03:49:19 +01:00
|
|
|
# create links to the binaries
|
2016-06-10 18:32:39 +02:00
|
|
|
ln -fs $BINSP/hyperiond $BINTP/hyperiond
|
|
|
|
ln -fs $BINSP/hyperion-remote $BINTP/hyperion-remote
|
|
|
|
ln -fs $BINSP/hyperion-v4l2 $BINTP/hyperion-v4l2
|
|
|
|
ln -fs $BINSP/hyperion-dispmanx $BINTP/hyperion-dispmanx 2>/dev/null
|
|
|
|
ln -fs $BINSP/hyperion-x11 $BINTP/hyperion-x11 2>/dev/null
|
|
|
|
ln -fs $BINSP/hyperion-aml $BINTP/hyperion-aml 2>/dev/null
|
2014-01-05 15:47:47 +01:00
|
|
|
fi
|
2013-07-26 22:38:34 +02:00
|
|
|
|
2016-06-10 18:32:39 +02:00
|
|
|
# Copy the service control configuration to /etc/init (-n to respect user modified scripts)
|
2014-01-04 14:12:33 +01:00
|
|
|
if [ $USE_INITCTL -eq 1 ]; then
|
2016-03-12 03:49:19 +01:00
|
|
|
echo '---> Installing initctl script'
|
2016-06-10 18:32:39 +02:00
|
|
|
cp -n $SERVICEL/hyperion.initctl.sh $SERVICEP/hyperion.conf 2>/dev/null
|
2016-03-12 03:49:19 +01:00
|
|
|
initctl reload-configuration
|
|
|
|
elif [ $OS_OPENELEC -eq 1 ]; then
|
2016-04-09 17:55:01 +02:00
|
|
|
#modify all old installs with a logfile output
|
2016-05-05 12:55:11 +02:00
|
|
|
sed -i 's|/dev/null|/storage/logfiles/hyperion.log|g' /storage/.config/autostart.sh 2>/dev/null
|
2014-01-05 15:47:47 +01:00
|
|
|
# only add to start script if hyperion is not present yet
|
2016-04-30 17:09:41 +02:00
|
|
|
mkdir /storage/logfiles 2>/dev/null
|
2016-04-30 17:00:29 +02:00
|
|
|
touch /storage/.config/autostart.sh 2>/dev/null
|
2014-01-05 15:47:47 +01:00
|
|
|
if [ `cat /storage/.config/autostart.sh 2>/dev/null | grep hyperiond | wc -l` -eq 0 ]; then
|
2016-05-05 12:38:24 +02:00
|
|
|
echo '---> Adding Hyperion to OpenELEC/LibreELEC autostart.sh'
|
2016-04-09 17:55:01 +02:00
|
|
|
echo "/storage/hyperion/bin/hyperiond.sh /storage/.config/hyperion.config.json > /storage/logfiles/hyperion.log 2>&1 &" >> /storage/.config/autostart.sh
|
2014-01-05 15:47:47 +01:00
|
|
|
chmod +x /storage/.config/autostart.sh
|
|
|
|
fi
|
2016-03-22 01:01:54 +01:00
|
|
|
# only add hyperion-x11 to startup, if not found and x32x64 detected
|
|
|
|
if [ $CPU_X32X64 -eq 1 ] && [ `cat /storage/.config/autostart.sh 2>/dev/null | grep hyperion-x11 | wc -l` -eq 0 ]; then
|
2016-05-05 12:38:24 +02:00
|
|
|
echo '---> Adding Hyperion-x11 to OpenELEC/LibreELEC autostart.sh'
|
2016-04-09 17:55:01 +02:00
|
|
|
echo "DISPLAY=:0.0 LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/storage/hyperion/bin /storage/hyperion/bin/hyperion-x11 </dev/null >/storage/logfiles/hyperion.log 2>&1 &" >> /storage/.config/autostart.sh
|
2016-03-22 01:01:54 +01:00
|
|
|
fi
|
2016-03-12 03:49:19 +01:00
|
|
|
elif [ $USE_SYSTEMD -eq 1 ]; then
|
|
|
|
echo '---> Installing systemd script'
|
|
|
|
#place startup script for systemd and activate
|
2016-06-10 18:32:39 +02:00
|
|
|
cp -n $SERVICEL/hyperion.systemd.sh $SERVICEP/hyperion.service
|
2016-03-12 03:49:19 +01:00
|
|
|
systemctl -q enable hyperion.service
|
2016-04-26 12:27:59 +02:00
|
|
|
if [ $OS_OSMC -eq 1 ]; then
|
|
|
|
echo '---> Modify systemd script for OSMC usage'
|
2016-06-10 18:32:39 +02:00
|
|
|
# Wait until kodi is sarted
|
|
|
|
sed -i '/After = mediacenter.service/d' $SERVICEP/hyperion.service
|
|
|
|
sed -i '/Unit/a After = mediacenter.service' $SERVICEP/hyperion.service
|
2016-04-02 01:24:08 +02:00
|
|
|
systemctl -q daemon-reload
|
2016-03-12 03:49:19 +01:00
|
|
|
fi
|
|
|
|
elif [ $USE_SERVICE -eq 1 ]; then
|
|
|
|
echo '---> Installing startup script in init.d'
|
|
|
|
# place startup script in init.d and add it to upstart (-s to respect user modified scripts)
|
2016-06-10 18:32:39 +02:00
|
|
|
ln -s $SERVICEL/hyperion.init.sh $SERVICEP/hyperion 2>/dev/null && chmod +x $SERVICEP/hyperion
|
2016-03-12 03:49:19 +01:00
|
|
|
update-rc.d hyperion defaults 98 02
|
2013-11-24 13:37:30 +01:00
|
|
|
fi
|
2013-10-02 09:44:08 +02:00
|
|
|
|
2016-06-10 18:32:39 +02:00
|
|
|
#remove unwanted files/dirs
|
|
|
|
if [ $OS_OPENELEC -eq 1 ]; then
|
|
|
|
rm -r /storage/hyperion/services
|
|
|
|
else
|
|
|
|
rm -r /usr/share/hyperion/services
|
|
|
|
rm -r /opt/hyperion 2>/dev/null
|
|
|
|
fi
|
|
|
|
|
2016-04-26 12:27:59 +02:00
|
|
|
#chown the /config/ dir and all configs inside for hypercon config upload for non-root logins
|
|
|
|
if [ $OS_OSMC -eq 1 ]; then
|
2016-06-11 00:47:28 +02:00
|
|
|
chown -R osmc:osmc /etc/hyperion
|
2016-04-26 12:27:59 +02:00
|
|
|
elif [ $OS_RASPBIAN -eq 1 ]; then
|
2016-06-11 00:47:28 +02:00
|
|
|
chown -R pi:pi /etc/hyperion
|
2016-04-26 12:27:59 +02:00
|
|
|
fi
|
|
|
|
|
2013-10-02 09:44:08 +02:00
|
|
|
# Start the hyperion daemon
|
2016-03-12 03:49:19 +01:00
|
|
|
echo '---> Starting Hyperion'
|
|
|
|
if [ $OS_OPENELEC -eq 1 ]; then
|
2016-04-26 12:27:59 +02:00
|
|
|
/storage/.config/autostart.sh > /dev/null 2>&1 &
|
2016-03-12 03:49:19 +01:00
|
|
|
elif [ $USE_INITCTL -eq 1 ]; then
|
2014-01-04 14:12:33 +01:00
|
|
|
/sbin/initctl start hyperion
|
2014-01-05 15:47:47 +01:00
|
|
|
elif [ $USE_SERVICE -eq 1 ]; then
|
2014-01-04 14:12:33 +01:00
|
|
|
/usr/sbin/service hyperion start
|
2016-03-12 03:49:19 +01:00
|
|
|
elif [ $USE_SYSTEMD -eq 1 ]; then
|
|
|
|
service hyperion start
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo '*******************************************************************************'
|
|
|
|
echo 'Hyperion Installation/Update finished!'
|
2016-04-26 17:21:30 +02:00
|
|
|
echo 'Please download the latest HyperCon version to benefit from new features!'
|
|
|
|
echo 'To create a config, follow the HyperCon Guide at our Wiki (EN/DE)!'
|
|
|
|
echo 'Wiki: wiki.hyperion-project.org Webpage: www.hyperion-project.org'
|
2016-03-12 03:49:19 +01:00
|
|
|
$REBOOTMESSAGE
|
|
|
|
echo '*******************************************************************************'
|
|
|
|
## Force reboot and prevent prompt if spi is added during a HyperCon Install
|
2016-04-26 12:27:59 +02:00
|
|
|
if [ $HCInstall -eq 1 ] && [ $CPU_RPI -eq 1 ] && [ $SPIOK -ne 1 ]; then
|
|
|
|
echo "Rebooting now, we added dtparam=spi=on to config.txt"
|
2016-03-12 03:49:19 +01:00
|
|
|
reboot
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
#Prompt for reboot, if spi added to config.txt
|
2016-04-26 12:27:59 +02:00
|
|
|
if [ $CPU_RPI -eq 1 ] && [ $SPIOK -ne 1 ]; then
|
2016-03-12 03:49:19 +01:00
|
|
|
while true
|
|
|
|
do
|
|
|
|
echo -n "---> Do you want to reboot your Raspberry Pi now? (y or n) :"
|
|
|
|
read CONFIRM
|
|
|
|
case $CONFIRM in
|
|
|
|
y|Y|YES|yes|Yes) break ;;
|
|
|
|
n|N|no|NO|No)
|
|
|
|
echo "---> No reboot - you entered \"$CONFIRM\""
|
|
|
|
exit
|
|
|
|
;;
|
|
|
|
*) echo "-> Please enter only y or n"
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
echo "---> You entered \"$CONFIRM\". Rebooting now..."
|
|
|
|
reboot
|
|
|
|
fi
|
|
|
|
|
2016-06-10 18:32:39 +02:00
|
|
|
exit 0
|