This commit is contained in:
Paulchen-Panther 2019-01-07 23:33:27 +01:00
parent 2cda2a11e0
commit 28aa6a6954
8 changed files with 175 additions and 73 deletions

View File

@ -20,7 +20,7 @@ matrix:
- DOCKER_TAG=cross-qemu-rpistretch - DOCKER_TAG=cross-qemu-rpistretch
- DOCKER_NAME="Raspberry Pi" - DOCKER_NAME="Raspberry Pi"
- os: osx - os: osx
osx_image: xcode7.3 osx_image: xcode8.3
env: env:
- HOMEBREW_CACHE=$HOME/brew-cache - HOMEBREW_CACHE=$HOME/brew-cache
before_install: before_install:

View File

@ -7,12 +7,12 @@
if [[ $TRAVIS_OS_NAME == 'osx' || $TRAVIS_OS_NAME == 'darwin' ]] if [[ $TRAVIS_OS_NAME == 'osx' || $TRAVIS_OS_NAME == 'darwin' ]]
then then
echo "Install OSX deps" echo "Install OSX deps"
time brew update brew update
time brew install qt5 || true brew install qt5 || true
time brew install python3 || true brew upgrade python3 || true
time brew install libusb || true brew upgrade libusb || true
time brew install cmake || true brew upgrade cmake || true
time brew install doxygen || true brew install doxygen || true
# install linux deps for hyperion compile # install linux deps for hyperion compile
elif [[ $TRAVIS_OS_NAME == 'linux' ]] elif [[ $TRAVIS_OS_NAME == 'linux' ]]

View File

@ -48,7 +48,7 @@ endif()
if ( NOT DEFINED PLATFORM ) if ( NOT DEFINED PLATFORM )
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" ) if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )
SET( PLATFORM "x86") SET( PLATFORM "x11")
elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64") elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64")
SET( PLATFORM "rpi") SET( PLATFORM "rpi")
FILE( READ /proc/cpuinfo SYSTEM_CPUINFO ) FILE( READ /proc/cpuinfo SYSTEM_CPUINFO )
@ -62,7 +62,7 @@ if ( NOT DEFINED PLATFORM )
if ( PLATFORM ) if ( PLATFORM )
message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}") message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}")
else() else()
message( FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=<rpi|amlogic|amlogic64|x86|x86-dev|osx|osx-dev>") message( FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=<rpi|amlogic|amlogic64|x11|x11-dev|osx|osx-dev>")
endif() endif()
endif() endif()
@ -96,9 +96,9 @@ elseif ( "${PLATFORM}" STREQUAL "amlogic" )
SET ( DEFAULT_AMLOGIC ON ) SET ( DEFAULT_AMLOGIC ON )
elseif ( "${PLATFORM}" STREQUAL "amlogic64" ) elseif ( "${PLATFORM}" STREQUAL "amlogic64" )
SET ( DEFAULT_AMLOGIC ON ) SET ( DEFAULT_AMLOGIC ON )
elseif ( "${PLATFORM}" MATCHES "x86" ) elseif ( "${PLATFORM}" MATCHES "x11" )
SET ( DEFAULT_X11 ON ) SET ( DEFAULT_X11 ON )
if ( "${PLATFORM}" STREQUAL "x86-dev" ) if ( "${PLATFORM}" STREQUAL "x11-dev" )
SET ( DEFAULT_AMLOGIC ON) SET ( DEFAULT_AMLOGIC ON)
SET ( DEFAULT_WS281XPWM ON ) SET ( DEFAULT_WS281XPWM ON )
endif() endif()

View File

@ -26,45 +26,53 @@ CPU_X32X64=`uname -m | grep 'x86_32\|i686\|x86_64' | wc -l`
BOOT_BERRYBOOT=$(grep -m1 -c '\(/var/media\|/media/pi\)/berryboot' /etc/mtab) BOOT_BERRYBOOT=$(grep -m1 -c '\(/var/media\|/media/pi\)/berryboot' /etc/mtab)
#get current system ip #get current system ip
NET_IF=`netstat -rn | awk '/^0.0.0.0/ {thif=substr($0,74,10); print thif;} /^default.*UG/ {thif=substr($0,65,10); print thif;}'` NET_IP=`hostname -I | cut -d " " -f1`
NET_IP=`ifconfig ${NET_IF} | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -Eo '([0-9]*\.){3}[0-9]*' | grep -v '127.0.0.1'`
#check if hyperion is running
HYPERION_RUNNING=false
pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
# search for users in system, returns first entry # search for users in system, returns first entry
FOUND_USR=`who | grep -o '^\w*\b'` || "root" FOUND_USR=`who | grep -o '^\w*\b'` || "root"
# determine if we should use a service
ENABLE_SERVICE=0
STARTUP_MSG="echo ---> You can start Hyperion from your menu now"
if [ $CPU_RPI -eq 1 ]; then
ENABLE_SERVICE=1
STARTUP_MSG="echo ---> Hyperion has been installed as service, it will start on each system startup"
fi
start_msg="" start_msg=""
restart_msg="" restart_msg=""
if grep -m1 systemd /proc/1/comm > /dev/null if grep -m1 systemd /proc/1/comm > /dev/null
then then
echo "--> init deamon: systemd" echo "---> init deamon: systemd"
# systemd # systemd
$HYPERION_RUNNING && systemctl stop hyperiond 2> /dev/null
install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/hyperiond@.service install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/hyperiond@.service
systemctl enable hyperiond"@${FOUND_USR}".service # service registration just on Raspberry Pi, probably need to ask the user how we should use the service. TODO service start in user login scope eg for x11?!
start_msg="--> systemctl start hyperiond for user ${FOUND_USR}" if [ $ENABLE_SERVICE -eq 1 ]; then
systemctl start hyperiond"@${FOUND_USR}" systemctl enable hyperiond"@${FOUND_USR}".service
start_msg="--> systemctl start hyperiond for user ${FOUND_USR}"
systemctl start hyperiond"@${FOUND_USR}"
fi
elif [ -e /sbin/initctl ] elif [ -e /sbin/initctl ]
then then
echo "--> init deamon: upstart" echo "---> init deamon: upstart"
# upstart # upstart
$HYPERION_RUNNING && initctl stop hyperiond if [ $ENABLE_SERVICE -eq 1 ]; then
install_file /usr/share/hyperion/service/hyperiond.initctl /etc/init/hyperion.conf && initctl reload-configuration install_file /usr/share/hyperion/service/hyperiond.initctl /etc/init/hyperion.conf && initctl reload-configuration
start_msg="--> initctl start hyperiond" start_msg="--> initctl start hyperiond"
initctl start hyperiond initctl start hyperiond
fi
else else
echo "--> init deamon: sysV" echo "---> init deamon: sysV"
# sysV # sysV
$HYPERION_RUNNING && service hyperiond stop 2>/dev/null if [ $ENABLE_SERVICE -eq 1 ]; then
install_file /usr/share/hyperion/service/hyperion.init /etc/init.d/hyperiond && chmod +x /etc/init.d/hyperiond && update-rc.d hyperiond defaults 98 02 install_file /usr/share/hyperion/service/hyperion.init /etc/init.d/hyperiond && chmod +x /etc/init.d/hyperiond && update-rc.d hyperiond defaults 98 02
start_msg="--> service hyperiond start" start_msg="---> service hyperiond start"
service hyperiond start service hyperiond start
fi
fi fi
#cleanup #cleanup
@ -81,6 +89,7 @@ ln -fs $BINSP/hyperion-framebuffer $BINTP/hyperion-framebuffer 2>/dev/null
ln -fs $BINSP/hyperion-dispmanx $BINTP/hyperion-dispmanx 2>/dev/null 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-x11 $BINTP/hyperion-x11 2>/dev/null
ln -fs $BINSP/hyperion-aml $BINTP/hyperion-aml 2>/dev/null ln -fs $BINSP/hyperion-aml $BINTP/hyperion-aml 2>/dev/null
ln -fs $BINSP/hyperion-qt $BINTP/hyperion-qt 2>/dev/null
#Check, if dtparam=spi=on is in place #Check, if dtparam=spi=on is in place
@ -105,9 +114,11 @@ fi
echo ${start_msg} echo ${start_msg}
echo "-----------------------------------------------------------------------------" echo "-----------------------------------------------------------------------------"
echo "--> Hyperion has been installed/updated!" echo "---> Hyperion has been installed/updated!"
echo "--> For configuration, visit with your browser: ${NET_IP}:8090" echo "---> "
echo "--> or if already used by another service try: ${NET_IP}:8091" $STARTUP_MSG
echo "---> For configuration, visit with your browser: ${NET_IP}:8090"
echo "---> or if already used by another service try: ${NET_IP}:8091"
$REBOOTMESSAGE $REBOOTMESSAGE
echo "-----------------------------------------------------------------------------" echo "-----------------------------------------------------------------------------"
echo "Webpage: www.hyperion-project.org" echo "Webpage: www.hyperion-project.org"
@ -124,3 +135,5 @@ then
echo "- please remove it to avoid problems -" echo "- please remove it to avoid problems -"
echo "---------------------------------------------------------------------------------" echo "---------------------------------------------------------------------------------"
fi fi
exit 0

View File

@ -27,6 +27,11 @@ then
fi fi
fi fi
# In case we don't use a service kill all instances
killall hyperiond 2> /dev/null
# overwrite last return code
exit 0
#$USR=hyperionIS; #$USR=hyperionIS;

View File

@ -11,30 +11,33 @@ pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
if grep -m1 systemd /proc/1/comm > /dev/null if grep -m1 systemd /proc/1/comm > /dev/null
then then
echo "--> stop init deamon: systemd" echo "---> stop init deamon: systemd"
# systemd # systemd
$HYPERION_RUNNING && systemctl stop hyperiond"@${FOUND_USR}" 2> /dev/null $HYPERION_RUNNING && systemctl stop hyperiond"@${FOUND_USR}" 2> /dev/null
# disable user specific symlink # disable user specific symlink
echo "--> Disable service and remove entry" echo "---> Disable service and remove entry"
systemctl -q disable hyperiond"@${FOUND_USR}" systemctl -q disable hyperiond"@${FOUND_USR}"
rm -v /etc/systemd/system/hyperiond@.service 2>/dev/null rm -v /etc/systemd/system/hyperiond@.service 2>/dev/null
elif [ -e /sbin/initctl ] elif [ -e /sbin/initctl ]
then then
echo "--> stop init deamon: upstart" echo "---> stop init deamon: upstart"
# upstart # upstart
$HYPERION_RUNNING && initctl stop hyperiond $HYPERION_RUNNING && initctl stop hyperiond
echo "--> Remove upstart service" echo "---> Remove upstart service"
rm -v /etc/init/hyperion* 2>/dev/null rm -v /etc/init/hyperion* 2>/dev/null
initctl reload-configuration initctl reload-configuration
else else
echo "--> stop init deamon: sysV" echo "---> stop init deamon: sysV"
# sysV # sysV
$HYPERION_RUNNING && service hyperiond stop 2>/dev/null $HYPERION_RUNNING && service hyperiond stop 2>/dev/null
echo "--> Remove sysV service" echo "---> Remove sysV service"
update-rc.d -f hyperion remove update-rc.d -f hyperion remove
rm /etc/init.d/hyperion* 2>/dev/null rm /etc/init.d/hyperion* 2>/dev/null
fi fi
return 0 # In case we don't use a service kill all instances
killall hyperiond 2> /dev/null
exit 0

View File

@ -5,53 +5,134 @@ install_file()
src="$1" src="$1"
dest="$2" dest="$2"
if [ -e "$dest" ] && ! cmp --quiet "$src" "$dest" if [ ! -e "$dest" ]
then then
cp "$src" "${dest}.new"
else
cp "$src" "${dest}" cp "$src" "${dest}"
return 1
else
echo "--> Service file already exists, skip creation"
return 0
fi fi
} }
echo "--- hyperion ambilight postinstall ---" echo "---Hyperion ambient light postinstall ---"
echo "- install configuration template"
mkdir -p /etc/hyperion
install_file /usr/share/hyperion/config/hyperion.config.json /etc/hyperion/hyperion.config.json
#check system
CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710\|BCM2835' /proc/cpuinfo`
CPU_X32X64=`uname -m | grep 'x86_32\|i686\|x86_64' | wc -l`
#Check for a bootloader as Berryboot
BOOT_BERRYBOOT=$(grep -m1 -c '\(/var/media\|/media/pi\)/berryboot' /etc/mtab)
#get current system ip
NET_IP=`hostname -I | cut -d " " -f1`
# search for users in system, returns first entry
FOUND_USR=`who | grep -o '^\w*\b'` || "root"
# determine if we should use a service
ENABLE_SERVICE=0
STARTUP_MSG="echo ---> You can start Hyperion from your menu now"
if [ $CPU_RPI -eq 1 ]; then
ENABLE_SERVICE=1
STARTUP_MSG="echo ---> Hyperion has been installed as service, it will start on each system startup"
fi
start_msg=""
restart_msg=""
if grep -m1 systemd /proc/1/comm > /dev/null if grep -m1 systemd /proc/1/comm > /dev/null
then then
echo "---> init deamon: systemd"
# systemd # systemd
echo install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/hyperiond@.service
systemctl stop hyperion 2> /dev/null # service registration just on Raspberry Pi, probably need to ask the user how we should use the service. TODO service start in user login scope eg for x11?!
install_file /usr/share/hyperion/service/hyperion.systemd.sh /etc/systemd/system/hyperion.service if [ $ENABLE_SERVICE -eq 1 ]; then
systemctl -q enable hyperion.service systemctl enable hyperiond"@${FOUND_USR}".service
# if [ $OS_OSMC -eq 1 ]; then start_msg="--> systemctl start hyperiond for user ${FOUND_USR}"
# echo '---> Modify systemd script for OSMC usage' systemctl start hyperiond"@${FOUND_USR}"
# # Wait until kodi is sarted (for kodi checker) fi
# 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=osmc/User=root/g' /etc/systemd/system/hyperion.service
# sed -i 's/Group=osmc/Group=root/g' /etc/systemd/system/hyperion.service
# systemctl -q daemon-reload
# fi
systemctl start hyperion
elif [ -e /sbin/initctl ] elif [ -e /sbin/initctl ]
then then
echo "---> init deamon: upstart"
# upstart # upstart
install_file /usr/share/hyperion/service/hyperion.initctl.sh /etc/init/hyperion.conf if [ $ENABLE_SERVICE -eq 1 ]; then
initctl reload-configuration install_file /usr/share/hyperion/service/hyperiond.initctl /etc/init/hyperion.conf && initctl reload-configuration
initctl start hyperion start_msg="--> initctl start hyperiond"
initctl start hyperiond
fi
else else
echo "---> init deamon: sysV"
# sysV # sysV
service hyperion stop 2>/dev/null if [ $ENABLE_SERVICE -eq 1 ]; then
install_file /usr/share/hyperion/service/hyperion.init.sh /etc/init.d/hyperion install_file /usr/share/hyperion/service/hyperion.init /etc/init.d/hyperiond && chmod +x /etc/init.d/hyperiond && update-rc.d hyperiond defaults 98 02
chmod +x /etc/init.d/hyperion start_msg="---> service hyperiond start"
update-rc.d hyperion defaults 98 02 service hyperiond start
service hyperion start fi
fi fi
echo "- done"
#cleanup
rm -r /usr/share/hyperion/service
#link binarys and set exec bit
BINSP=/usr/share/hyperion/bin
BINTP=/usr/bin
chmod +x -R $BINSP
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-framebuffer $BINTP/hyperion-framebuffer 2>/dev/null
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
ln -fs $BINSP/hyperion-qt $BINTP/hyperion-qt 2>/dev/null
#Check, if dtparam=spi=on is in place
if [ $CPU_RPI -eq 1 ]; then
BOOT_DIR="/boot"
if [ $BOOT_BERRYBOOT -eq 1 ]; then
BOOT_DIR=$(sed -ne "s#/dev/mmcblk0p1 \([^ ]*\) vfat rw,.*#\1#p" /etc/mtab)
fi
if [ -z "$BOOT_DIR" -o ! -f "$BOOT_DIR/config.txt" ]; then
echo '---> Warning: RPi using BERRYBOOT found but can not locate where config.txt is to enable SPI. (BOOT_DIR='"$BOOT_DIR)"
SPIOK=1 # Not sure if OK, but don't ask to reboot
else
SPIOK=`grep '^\dtparam=spi=on' "$BOOT_DIR/config.txt" | wc -l`
if [ $SPIOK -ne 1 ]; then
echo '---> Raspberry Pi found, but SPI is not set, we write "dtparam=spi=on" to '"$BOOT_DIR/config.txt"
sed -i '$a dtparam=spi=on' "$BOOT_DIR/config.txt"
REBOOTMESSAGE="echo Please reboot your Raspberry Pi, we inserted dtparam=spi=on to $BOOT_DIR/config.txt"
fi
fi
fi
echo ${start_msg}
echo "-----------------------------------------------------------------------------"
echo "---> Hyperion has been installed/updated!"
echo "---> "
$STARTUP_MSG
echo "---> For configuration, visit with your browser: ${NET_IP}:8090"
echo "---> or if already used by another service try: ${NET_IP}:8091"
$REBOOTMESSAGE
echo "-----------------------------------------------------------------------------"
echo "Webpage: www.hyperion-project.org"
echo "Wiki: wiki.hyperion-project.org"
echo "Forum: forum.hyperion-project.org"
echo "-----------------------------------------------------------------------------"
if [ -e /opt/hyperion/ ]
then
echo
echo "---------------------------------------------------------------------------------"
echo "- It seemd that you have an older version of hyperion installed in /opt/hyperion -"
echo "- please remove it to avoid problems -"
echo "---------------------------------------------------------------------------------"
fi
exit 0

View File

@ -88,7 +88,7 @@ const QString SSDPDiscover::getFirstService(const searchType& type, const QStrin
//Info(_log, "Received msearch response from '%s:%d'. Search target: %s",QSTRING_CSTR(sender.toString()), senderPort, QSTRING_CSTR(headers.value("st"))); //Info(_log, "Received msearch response from '%s:%d'. Search target: %s",QSTRING_CSTR(sender.toString()), senderPort, QSTRING_CSTR(headers.value("st")));
if(type == STY_WEBSERVER) if(type == STY_WEBSERVER)
{ {
Info(_log, "Found Hyperion server at: %s:%s", QSTRING_CSTR(url.host()), url.port()); Info(_log, "Found Hyperion server at: %s:%d", QSTRING_CSTR(url.host()), url.port());
return url.host()+":"+QString::number(url.port()); return url.host()+":"+QString::number(url.port());
} }