Merge pull request #6 from tvdzwan/master

updating my fork again
This commit is contained in:
penfold42 2016-03-13 13:21:59 +11:00
commit 0014a1280d
11 changed files with 292 additions and 128 deletions

View File

@ -1,6 +1,6 @@
# Install the required tools and dependencies
sudo apt-get update
sudo apt-get install git cmake build-essential libQt4-dev libusb-1.0-0-dev python-dev
sudo apt-get install git cmake build-essential libQt4-dev libusb-1.0-0-dev python-dev libxrender-dev
# RPI ONLY: when you build on the rapberry pi and include the dispmanx grabber (which is the default)
# you also need the firmware including headers installed. This downloads the firmware from the raspberrypi github

View File

@ -1,51 +1,62 @@
ON TARGET
--------------
sudo apt-get install libQt4-dev libusb-1.0-0-dev python-dev rsync
#!/bin/bash
#Updated: 13 March 2016, by TPmodding
#Just use a clean Ubunut 14.04 and run this script
##############
#ON TARGET
#--------------
#sudo apt-get install libQt4-dev libusb-1.0-0-dev python-dev rsync
#############
ON HOST
---------
export TARGET_IP=192.168.1.17
#ON HOST
#---------
sudo apt-get update
sudo apt-get upgrade
#TO-DO verify what is really required
sudo apt-get install git rsync cmake build-essential libQt4-dev libusb-1.0-0-dev python-dev libxrender-dev protobuf-compiler lib32z1 lib32ncurses5 lib32bz2-1.0 zlib1g-dev
echo 'PATH=$PATH:$HOME/raspberrypi/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin' >> .bashrc
#---------
export TARGET_IP=192.168.0.103
export TARGET_USER=pi
export RASCROSS_DIR="$HOME/raspberrypi"
export ROOTFS_DIR="RASCROSS_DIR/rootfs"
export ROOTFS_DIR="$RASCROSS_DIR/rootfs"
export HYPERION_DIR="$HOME/hyperion"
#export IMX6_DIR="$HOME/hummingboard"
export TOOLCHAIN_FILE="$HYPERION_DIR/Toolchain-RaspberryPi.cmake"
export NATIVE_BUILD_DIR="$HYPERION_DIR/build"
export TARGET_BUILD_DIR=HYPERION_DIR="$HYPERION_DIR/build-rpi"
export TARGET_BUILD_DIR="$HYPERION_DIR/build-rpi"
# install required packages
sudo apt-get install git rsync cmake build-essential libQt4-dev libusb-1.0-0-dev python-dev libxrender-dev
sudo apt-get install git rsync cmake ia32-libs protobuf-compiler
# On newer version of Ubuntu (and maybe other distros) the ia32-libs is not available, the following
# install solved this for me (TODO: verify what is really required)
sudo apt-get install libc6:i386 libgcc1:i386 gcc-4.6-base:i386 libstdc++5:i386 libstdc++6:i386
# create the rootfs by copying it from an target
mkdir -p "$ROOTFS_DIR"
rsync -rl --delete-after --copy-unsafe-links $TARGET_USER@$TARGET_IP:/{lib,usr} "$ROOTFS_DIR"
######## RPi specific #########
# get the raspberry pi firmware and add it to the rootfs
mkdir -p "$RASCROSS_DIR/firmware"
git clone https://github.com/raspberrypi/firmware.git "$RASCROSS_DIR/firmware"
ln -s "$RASCROSS_DIR/firmware/hardfp/opt" "$ROOTFS_DIR/opt"
# get the compile tools
git clone git://github.com/raspberrypi/tools.git "$RASCROSS_DIR/tools"
##### End of RPi specific ######
######## NOT TESTED ONLY INFOs #########
######## IMX6 specific #########
#export IMX6_DIR="$HOME/hummingboard"
#mkdir -p "$IMX6_Dir"
#cd "$IMX6_Dir"
#wget https://launchpad.net/linaro-toolchain-binaries/trunk/2013.10/+download/gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.bz2
#tar -xvjf gcc-linaro-arm-linux-gnueabihf-4.8-2013.10_linux.tar.bz2
#cd
##### End of IMX6 specific ######
######## NOT TESTED #########
# get the Hyperion sources
git clone --recursive https://github.com/tvdzwan/hyperion.git "$HYPERION_DIR"
# if you forget the --resursive in above statement or you are updating an existing clone you need
# to clone the protobuf submodule by runnning the follwing two statements:
git submodule init
git submodule update
# do a native build (to build the protobuf compiler for the native platform)
mkdir -p "$NATIVE_BUILD_DIR"
cmake -DENABLE_DISPMANX=OFF --build "$NATIVE_BUILD_DIR" "$HYPERION_DIR"
@ -55,9 +66,17 @@ cmake -DENABLE_DISPMANX=OFF --build "$NATIVE_BUILD_DIR" "$HYPERION_DIR"
mkdir -p "$TARGET_BUILD_DIR"
cmake -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN_FILE" -DIMPORT_PROTOC=$NATIVE_BUILD_DIR/protoc_export.cmake --build "$TARGET_BUILD_DIR" "$HYPERION_DIR"
# For hummingboard (imx6) the following package is required
sudo apt-get install lib32z1
#compile
cd "$HYPERION_DIR/deploy"
rm -rf hummingboard_prerelease.tar.gz hyperion.deps.openelec-imx6.tar.gz hyperion.deps.openelec-rpi.tar.gz hyperion_imx6.tar.gz hyperion_rpi.tar.gz hyperion_wetek.tar.gz hyperion_x32.tar.gz hyperion_x64.tar.gz
cd
cd "$HYPERION_DIR/bin"
chmod +x *
cp "$HYPERION_DIR/bin/create_all_releases.sh" "$HYPERION_DIR"
cd "$HYPERION_DIR"
./create_all_releases.sh
------------------------------------------------------------------------------
These instructions are based on the guide given by:
http://airwiki.ws.dei.polimi.it/index.php/Cross-compiling_for_the_RaspberryPi
######END
#------------------------------------------------------------------------------
#These instructions are based on tvdzwan and on the guide given by:
#http://airwiki.ws.dei.polimi.it/index.php/Cross-compiling_for_the_RaspberryPi

View File

@ -1,37 +1,37 @@
#!/bin/sh
# create all directly for release with -DCMAKE_BUILD_TYPE=Release -Wno-dev
# Create the x64 build
mkdir build-x64
cd build-x64
cmake -DENABLE_DISPMANX=OFF -DENABLE_X11=ON ..
cmake -DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev ..
make -j 4
cd ..
# Create the x32 build
mkdir build-x32
cd build-x32
cmake -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DENABLE_DISPMANX=OFF -DENABLE_X11=ON ..
cmake -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DENABLE_DISPMANX=OFF -DENABLE_X11=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev ..
make -j 4
cd ..
# Create the RPI build
mkdir build-rpi
cd build-rpi
cmake -DCMAKE_TOOLCHAIN_FILE="../Toolchain-rpi.cmake" -DIMPORT_PROTOC=../build-x64/protoc_export.cmake ..
cmake -DCMAKE_TOOLCHAIN_FILE="../Toolchain-rpi.cmake" -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DCMAKE_BUILD_TYPE=Release -Wno-dev ..
make -j 4
cd ..
# Create the WETEK build
mkdir build-wetek
cd build-wetek
cmake -DCMAKE_TOOLCHAIN_FILE="../Toolchain-rpi.cmake" -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DENABLE_DISPMANX=OFF -DENABLE_FB=ON -DENABLE_AMLOGIC=ON ..
cmake -DCMAKE_TOOLCHAIN_FILE="../Toolchain-rpi.cmake" -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DENABLE_DISPMANX=OFF -DENABLE_FB=ON -DENABLE_AMLOGIC=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev ..
make -j 4
cd ..
# Create the IMX6 build
mkdir build-imx6
cd build-imx6
cmake -DCMAKE_TOOLCHAIN_FILE="../Toolchain-imx6.cmake" -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DENABLE_DISPMANX=OFF -DENABLE_FB=ON ..
cmake -DCMAKE_TOOLCHAIN_FILE="../Toolchain-imx6.cmake" -DIMPORT_PROTOC=../build-x64/protoc_export.cmake -DENABLE_DISPMANX=OFF -DENABLE_FB=ON -DCMAKE_BUILD_TYPE=Release -Wno-dev ..
make -j 4
cd ..

View File

@ -1,105 +1,255 @@
#!/bin/sh
# Script for downloading and installing the latest Hyperion release
# Make sure /sbin is on the path (for service to find sub scripts)
PATH="/sbin:$PATH"
# Script for downloading and installing the latest Hyperion release
#Check if HyperCon is logged in as root
if [ $(id -u) != 0 ] && [ "$1" = "HyperConInstall" ]; then
echo '---> Critical Error: Please connect as user "root" through HyperCon'
echo '---> We need admin privileges to install/update your Hyperion! -> abort'
exit 1
fi
# Find out if we are on Raspbmc
IS_XBIAN=`cat /etc/issue | grep XBian | wc -l`
IS_RASPBMC=`cat /etc/issue | grep Raspbmc | wc -l`
IS_OPENELEC=`cat /etc/issue | grep -m 1 OpenELEC | wc -l`
#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
#Welcome message
echo '*******************************************************************************'
echo 'This script will install/update Hyperion and it´s services'
echo 'Version 0.1'
echo '*******************************************************************************'
# Find out if we are on OpenElec / OSMC
OS_OPENELEC=`grep -m1 -c OpenELEC /etc/issue`
OS_OSMC=`grep -m1 -c OSMC /etc/issue`
# Find out if its an imx6 device
IS_IMX6=`cat /proc/cpuinfo | grep i.MX6 | wc -l`
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`
CPU_X64=`uname -m | grep x86_64 | wc -l`
CPU_X32=`uname -m | grep 'x86_32\|i686' | wc -l`
# Check that we have a known configuration
if [ $CPU_RPI -ne 1 ] && [ $CPU_IMX6 -ne 1 ] && [ $CPU_WETEK -ne 1 ] && [ $CPU_X64 -ne 1 ] && [ $CPU_X32 -ne 1 ]; then
echo '---> Critical Error: CPU information does not match any known releases -> abort'
exit 1
fi
#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
# check which init script we should use
USE_SYSTEMD=`grep -m1 -c systemd /proc/1/comm`
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
BOBLIGHT_PROCNR=$(pidof boblightd | wc -l)
if [ $BOBLIGHT_PROCNR -eq 1 ];
then
echo 'Found running instance of boblight. Please stop boblight via XBMC menu before installing hyperion'
exit
if [ $BOBLIGHT_PROCNR -eq 1 ]; then
echo '---> Critical Error: Found running instance of boblight. Please stop boblight via XBMC menu before installing hyperion -> abort'
exit 1
fi
# Stop hyperion daemon if it is running
# Start the hyperion daemon
if [ $USE_INITCTL -eq 1 ]; then
/sbin/initctl stop hyperion
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
elif [ $USE_SERVICE -eq 1 ]; then
/usr/sbin/service hyperion stop
/usr/sbin/service hyperion stop 2>/dev/null
elif [ $USE_SYSTEMD -eq 1 ]; then
service hyperion stop 2>/dev/null
#many people installed with the official script and this just uses service, if both registered -> dead
/usr/sbin/service hyperion stop 2>/dev/null
fi
#Install dependencies for Hyperion
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
fi
#Check, if dtparam=spi=on is in place (not for OPENELEC)
if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -ne 1 ]; then
SPIOK=`grep '^\dtparam=spi=on' /boot/config.txt | wc -l`
if [ $SPIOK -ne 1 ]; then
echo '---> Raspberry Pi found, but SPI is not ready, we write "dtparam=spi=on" to /boot/config.txt'
sed -i '$a dtparam=spi=on' /boot/config.txt
REBOOTMESSAGE="echo Please reboot your Raspberry Pi, we inserted dtparam=spi=on to /boot/config.txt"
fi
fi
#Check, if dtparam=spi=on is in place (just for OPENELEC)
if [ $CPU_RPI -eq 1 ] && [ $OS_OPENELEC -eq 1 ]; then
SPIOK=`grep '^\dtparam=spi=on' /flash/config.txt | wc -l`
if [ $SPIOK -ne 1 ]; then
mount -o remount,rw /flash
echo '---> Raspberry Pi with OpenELEC found, but SPI is not ready, we write "dtparam=spi=on" to /flash/config.txt'
sed -i '$a dtparam=spi=on' /flash/config.txt
mount -o remount,ro /flash
REBOOTMESSAGE="echo Please reboot your OpenELEC, we inserted dtparam=spi=on to /flash/config.txt"
fi
fi
#Backup the .conf files, if present
echo '---> Backup Hyperion configuration(s), if present'
rm -f /tmp/*.json 2>/dev/null
if [ $OS_OPENELEC -eq 1 ]; then
cp -v /storage/.config/*.json /tmp 2>/dev/null
else cp -v /opt/hyperion/config/*.json /tmp 2>/dev/null
fi
# Select the appropriate release
HYPERION_ADDRESS=https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy
if [ $CPU_RPI -eq 1 ]; then
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_rpi.tar.gz
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
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
elif [ $CPU_X64 -eq 1 ]; then
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_x64.tar.gz
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
elif [ $CPU_X32 -eq 1 ]; then
HYPERION_RELEASE=$HYPERION_ADDRESS/hyperion_x32.tar.gz
OE_DEPENDECIES=$HYPERION_ADDRESS/hyperion.deps.openelec-rpi.tar.gz
else
echo "---> Critical Error: Target platform unknown -> abort"
exit 1
fi
# Get and extract the Hyperion binaries and effects
echo 'Downloading hyperion'
if [ $IS_OPENELEC -eq 1 ]; then
echo '---> Downloading the appropriate Hyperion release'
if [ $OS_OPENELEC -eq 1 ]; then
# OpenELEC has a readonly file system. Use alternative location
if [ $IS_IMX6 -eq 1 ]; then
curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_imx6.tar.gz | tar -C /storage -xz
else
curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_rpi.tar.gz | tar -C /storage -xz
fi
curl -L --get https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.deps.openelec-rpi.tar.gz | tar -C /storage/hyperion/bin -xz
echo '---> Downloading Hyperion OpenELEC release'
curl -# -L --get $HYPERION_RELEASE | tar -C /storage -xz
echo '---> Downloading Hyperion OpenELEC dependencies'
curl -# -L --get $OE_DEPENDECIES | tar -C /storage/hyperion/bin -xz
#set the executen bit (failsave)
chmod +x -R /storage/hyperion/bin
# modify the default config to have a correct effect path
sed -i 's:/opt:/storage:g' /storage/hyperion/config/hyperion.config.json
else
if [ $IS_IMX6 -eq 1 ]; then
wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_imx6.tar.gz -O - | tar -C /opt -xz
else
wget https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion_rpi.tar.gz -O - | tar -C /opt -xz
fi
fi
# create links to the binaries
if [ $IS_OPENELEC -ne 1 ]; then
ln -fs /opt/hyperion/bin/hyperiond /usr/bin/hyperiond
ln -fs /opt/hyperion/bin/hyperion-remote /usr/bin/hyperion-remote
ln -fs /opt/hyperion/bin/hyperion-v4l2 /usr/bin/hyperion-v4l2
fi
# create link to the gpio changer (gpio->spi)
if [ $IS_RASPBMC -eq 1 ] && [ $IS_IMX6 -ne 1 ]; then
ln -fs /opt/hyperion/bin/gpio2spi /usr/bin/gpio2spi
fi
# Copy a link to the hyperion configuration file to /etc
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
wget -nv $HYPERION_RELEASE -O - | tar -C /opt -xz
#set the executen bit (failsave)
chmod +x -R /opt/hyperion/bin
# 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
ln -fs /opt/hyperion/bin/hyperion-v4l2 /usr/bin/hyperion-v4l2
ln -fs /opt/hyperion/bin/hyperion-dispmanx /usr/bin/hyperion-dispmanx 2>/dev/null
ln -fs /opt/hyperion/bin/hyperion-x11 /usr/bin/hyperion-x11 2>/dev/null
# Copy a link to the hyperion configuration file to /etc (-s for people who replaced the symlink with their config)
ln -s /opt/hyperion/config/hyperion.config.json /etc/hyperion.config.json 2>/dev/null
fi
# Restore backup of .conf files, if present
echo '---> Restore Hyperion configuration(s), if present'
if [ $OS_OPENELEC -eq 1 ]; then
mv -v /tmp/*.json /storage/.config/ 2>/dev/null
else mv -v /tmp/*.json /opt/hyperion/config/ 2>/dev/null
fi
# Copy the service control configuration to /etc/int
# Copy the service control configuration to /etc/int (-n to respect user modified scripts)
if [ $USE_INITCTL -eq 1 ]; then
echo 'Installing initctl script'
if [ $IS_RASPBMC -eq 1 ]; then
wget -N https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
else
wget -N https://raw.githubusercontent.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
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
ln -fs /opt/hyperion/init.d/hyperion.init.sh /etc/init.d/hyperion
chmod +x /etc/init.d/hyperion
update-rc.d hyperion defaults 98 02
elif [ $IS_OPENELEC -eq 1 ]; then
echo '---> Installing initctl script'
cp -n /opt/hyperion/init.d/hyperion.initctl.sh /etc/init/hyperion.conf 2>/dev/null
initctl reload-configuration
elif [ $OS_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 '---> Adding Hyperion to OpenELEC autostart.sh'
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
elif [ $USE_SYSTEMD -eq 1 ]; then
echo '---> Installing systemd script'
#place startup script for systemd and activate
#Problem with systemd to enable symlinks - Bug? Workaround cp -n (overwrite never)
#Bad workaround for Jessie users that used the official script for install
update-rc.d -f hyperion remove 2>/dev/null
rm /etc/init.d/hyperion 2>/dev/null
cp -n /opt/hyperion/init.d/hyperion.systemd.sh /etc/systemd/system/hyperion.service
systemctl -q enable hyperion.service
if [ $OS_OSMC -eq 1 ]; then
echo '---> Modify systemd script for OSMC usage'
# Wait until kodi is sarted (for xbmc checker) and replace user (for remote control through osmc)
sed -i '/After = mediacenter.service/d' /etc/systemd/system/hyperion.service
sed -i '/Unit/a After = mediacenter.service' /etc/systemd/system/hyperion.service
sed -i 's/User=root/User=osmc/g' /etc/systemd/system/hyperion.service
sed -i 's/Group=root/Group=osmc/g' /etc/systemd/system/hyperion.service
systemctl -q daemon-reload
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)
ln -s /opt/hyperion/init.d/hyperion.init.sh /etc/init.d/hyperion 2>/dev/null
chmod +x /etc/init.d/hyperion
update-rc.d hyperion defaults 98 02
fi
# Start the hyperion daemon
if [ $USE_INITCTL -eq 1 ]; then
echo '---> Starting Hyperion'
if [ $OS_OPENELEC -eq 1 ]; then
/storage/.config/autostart.sh
elif [ $USE_INITCTL -eq 1 ]; then
/sbin/initctl start hyperion
elif [ $USE_SERVICE -eq 1 ]; then
/usr/sbin/service hyperion start
elif [ $USE_SYSTEMD -eq 1 ]; then
service hyperion start
fi
#Hint for the user with path to config
if [ $OS_OPENELEC -eq 1 ];then
HINTMESSAGE="echo Path to your configuration -> /storage/.config/hyperion.config.json"
else HINTMESSAGE="echo Path to your configuration -> /etc/hyperion.config.json"
fi
echo '*******************************************************************************'
echo 'Hyperion Installation/Update finished!'
echo 'Please get a new HyperCon version to benefit from the latest features!'
echo 'Create a new config file, if you encounter problems!'
$HINTMESSAGE
$REBOOTMESSAGE
echo '*******************************************************************************'
## Force reboot and prevent prompt if spi is added during a HyperCon Install
if [ "$1" = "HyperConInstall" ] && [ $CPU_RPI -eq 1 ] && [ $SPIOK -ne 1 ]; then
echo "Rebooting now, we added dtparam=spi=on to config.txt"
reboot
exit 0
fi
#Prompt for reboot, if spi added to config.txt
if [ $CPU_RPI -eq 1 ] && [ $SPIOK -ne 1 ];then
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
exit 0

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -127,47 +127,42 @@ int main(int argc, char** argv)
// Get the parameters for the bootsequence
const std::string effectName = effectConfig["effect"].asString();
const unsigned duration_ms = effectConfig["duration_ms"].asUInt();
const int priority = effectConfig.get("priority",990).asInt();
const int priority = (duration_ms != 0) ? 0 : effectConfig.get("priority",990).asInt();
const int bootcolor_priority = (priority > 990) ? priority+1 : 990;
// clear the leds
ColorRgb boot_color = ColorRgb::BLACK;
hyperion.setColor(bootcolor_priority, boot_color, 0, false);
// start boot effect
if ( ! effectName.empty() )
{
int result;
std::cout << "Boot sequence '" << effectName << "' ";
if (effectConfig.isMember("args"))
{
std::cout << " (with user defined arguments) ";
const Json::Value effectConfigArgs = effectConfig["args"];
result = hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms);
}
else
{
result = hyperion.setEffect(effectName, priority, duration_ms);
}
std::cout << ((result == 0) ? "started" : "failed") << std::endl;
}
// static color
if ( ! effectConfig["color"].isNull() && effectConfig["color"].isArray() && effectConfig["color"].size() == 3 )
{
ColorRgb boot_color = {
boot_color = {
(uint8_t)effectConfig["color"][0].asUInt(),
(uint8_t)effectConfig["color"][1].asUInt(),
(uint8_t)effectConfig["color"][2].asUInt()
};
hyperion.setColor(bootcolor_priority, boot_color, 0, false);
}
else
{
hyperion.setColor(bootcolor_priority, ColorRgb::BLACK, duration_ms, false);
}
if (effectConfig.isMember("args"))
{
const Json::Value effectConfigArgs = effectConfig["args"];
if (hyperion.setEffect(effectName, effectConfigArgs, priority, duration_ms) == 0)
{
std::cout << "Boot sequence(" << effectName << ") with user-defined arguments created and started" << std::endl;
}
else
{
std::cout << "Failed to start boot sequence: " << effectName << " with user-defined arguments" << std::endl;
}
}
else
{
if (hyperion.setEffect(effectName, priority, duration_ms) == 0)
{
std::cout << "Boot sequence(" << effectName << ") created and started" << std::endl;
}
else
{
std::cout << "Failed to start boot sequence: " << effectName << std::endl;
}
}
hyperion.setColor(bootcolor_priority, boot_color, 0, false);
}
// create XBMC video checker if the configuration is present