Skip to content

Instantly share code, notes, and snippets.

@marrobHD
Last active March 14, 2020 23:00
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save marrobHD/176dbcade1927db26121d65a66fa0aef to your computer and use it in GitHub Desktop.
Save marrobHD/176dbcade1927db26121d65a66fa0aef to your computer and use it in GitHub Desktop.
Installs Hyperion.ng on Raspberry Pi 3B+ on debian
# How to use: wget -qO- https://gist.github.com/marrobHD/176dbcade1927db26121d65a66fa0aef/raw>install.sh && chmod +x install.sh && ./install.sh (var1: -i/-b) (var2: target) (var3: cfg)
# Example:
# with installation: wget -qO- https://gist.github.com/marrobHD/176dbcade1927db26121d65a66fa0aef/raw>install.sh && chmod +x install.sh && ./install.sh -i
# only build: wget -qO- https://gist.github.com/marrobHD/176dbcade1927db26121d65a66fa0aef/raw>install.sh && chmod +x install.sh && ./install.sh -b
# depraced way; WONT WORK only build: wget -qO- https://gist.github.com/marrobHD/176dbcade1927db26121d65a66fa0aef/raw | bash -s -- -b
#!/bin/sh
echo
echo
echo Script Version: V1.0.7
echo
echo
echo Setting up variables...
echo ----------------------------------------------------------
# Variablen
rm /run/shm/error.log
TARGET=${2:-hyperion}
echo Target: $TARGET
CFG="${3:-Release}"
echo Cfg: ${CFG}
if [ $1 == "-i" ] 2>/run/shm/error.log
then
INST="true" && echo "We will install Hyperion.ng after compiling!"
else
INST="false" && echo "We will only compile Hyperion.ng!"
fi
echo Inst: $INST
echo ----------------------------------------------------------
echo Success!
echo
#exit
#echo Install raspberry pi firmware...
#echo ----------------------------------------------------------
#if test -f /etc/file; then
# echo ----------------------------------------------------------
# echo Success!
# echo
# echo
#else
# There is a error. You have to fix it manually
#fi
echo
echo
echo Install required packages to build...
echo ----------------------------------------------------------
if sudo apt-get update && sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libqt5sql5-sqlite qt5-default qttools5-dev-tools qtcreator libqt5serialport5-dev python-dev libusb-1.0-0-dev libxrender-dev python git libavahi-compat-libdnssd-dev -y; then
echo ----------------------------------------------------------
echo Success!
echo
echo
else
echo Trying to fix errors...
sudo dpkg --configure -a || exit 1
sudo apt-get update && sudo apt-get dist-upgrade -y && sudo apt-get install git cmake build-essential qtbase5-dev libqt5serialport5-dev libusb-1.0-0-dev python3-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libqt5sql5-sqlite qt5-default qttools5-dev-tools qtcreator libqt5serialport5-dev python-dev libusb-1.0-0-dev libxrender-dev python git libavahi-compat-libdnssd-dev -y || exit 1
fi
if [ -e /dev/vc-cma -a -e /dev/vc-mem ]
then
echo installing libraspberrypi-dev
sudo apt-get install libraspberrypi-dev || exit 1
fi
echo Cloneing Hyperion.ng and its dependencies...
echo ----------------------------------------------------------
git clone --recursive https://github.com/hyperion-project/hyperion.ng.git ${TARGET} || exit 1
#while true; do
# read -p "It looks like there is already a folder called "$TARGET". Do you want to remove it?: " yn
# case $yn in
# [Yy]* ) sudo rm -r $TARGET; git clone --recursive https://github.com/hyperion-project/hyperion.ng.git ${TARGET} || exit 1; break;;
# [Nn]* ) echo We cant work if a folder called "$TARGET" is there already!; exit 1;;
# * ) echo "Please answer yes or no.";;
# esac
#done
echo ----------------------------------------------------------
echo Success!
echo
echo
echo
echo Building Hyperion.ng...
echo ----------------------------------------------------------
rm -rf $TARGET/build
mkdir -p $TARGET/build || exit 1
cd $TARGET/build || exit 1
cmake -DCMAKE_BUILD_TYPE=$CFG .. || exit 1
make -j $(nproc) || exit 1
echo ----------------------------------------------------------
echo Success!
echo
# optional: install into your system
if [ "$INST" = "true" ]
then
echo Installing Hyperion.ng on your System...
echo ----------------------------------------------------------
$INST && sudo make install/strip
echo "to uninstall (not very well tested, please keep that in mind):"
echo "sudo make uninstall"
echo ----------------------------------------------------------
echo
else
echo Build finished!
echo ----------------------------------------------------------
echo Exit now
echo ----------------------------------------------------------
echo
exit
fi
sudo cp -v /usr/local/share/hyperion/service/hyperion.init /etc/init.d/hyperion.init
sudo chmod 755 /etc/init.d/hyperion.init
sudo chown root:root /etc/init.d/hyperion.init
while true; do
read -p "Do you wish to run Hyperion.ng now and add autostart?" yn
case $yn in
[Yy]* ) sudo /etc/init.d/hyperion.init restart && sleep 5 && sudo /etc/init.d/hyperion.init status && sudo update-rc.d hyperion.init defaults && echo to remove autostart you have to run: sudo update-rc.d hyperion.init remove; break;;
[Nn]* ) exit;;
* ) echo "Please answer yes or no.";;
esac
done
echo Success! You can now open your Browser: http://127.0.0.1:8090/
echo ..Install script by marrobHD...
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment