Skip to content

Commit 28aa6a6

Browse files
Paulchen-PantherPaulchen-Panther
Paulchen-Panther
authored and
Paulchen-Panther
committed
Fixes
1 parent 2cda2a1 commit 28aa6a6

File tree

8 files changed

+175
-73
lines changed

8 files changed

+175
-73
lines changed

.travis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ matrix:
2020
- DOCKER_TAG=cross-qemu-rpistretch
2121
- DOCKER_NAME="Raspberry Pi"
2222
- os: osx
23-
osx_image: xcode7.3
23+
osx_image: xcode8.3
2424
env:
2525
- HOMEBREW_CACHE=$HOME/brew-cache
2626
before_install:

.travis/travis_install.sh

+6-6
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
if [[ $TRAVIS_OS_NAME == 'osx' || $TRAVIS_OS_NAME == 'darwin' ]]
88
then
99
echo "Install OSX deps"
10-
time brew update
11-
time brew install qt5 || true
12-
time brew install python3 || true
13-
time brew install libusb || true
14-
time brew install cmake || true
15-
time brew install doxygen || true
10+
brew update
11+
brew install qt5 || true
12+
brew upgrade python3 || true
13+
brew upgrade libusb || true
14+
brew upgrade cmake || true
15+
brew install doxygen || true
1616

1717
# install linux deps for hyperion compile
1818
elif [[ $TRAVIS_OS_NAME == 'linux' ]]

CMakeLists.txt

+4-4
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ endif()
4848

4949
if ( NOT DEFINED PLATFORM )
5050
if ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "x86" )
51-
SET( PLATFORM "x86")
51+
SET( PLATFORM "x11")
5252
elseif ( "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" OR "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "aarch64")
5353
SET( PLATFORM "rpi")
5454
FILE( READ /proc/cpuinfo SYSTEM_CPUINFO )
@@ -62,7 +62,7 @@ if ( NOT DEFINED PLATFORM )
6262
if ( PLATFORM )
6363
message( STATUS "PLATFORM is not defined, evaluated platform: ${PLATFORM}")
6464
else()
65-
message( FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=<rpi|amlogic|amlogic64|x86|x86-dev|osx|osx-dev>")
65+
message( FATAL_ERROR "PLATFORM is not defined and could not be evaluated. Set -DPLATFORM=<rpi|amlogic|amlogic64|x11|x11-dev|osx|osx-dev>")
6666
endif()
6767
endif()
6868

@@ -96,9 +96,9 @@ elseif ( "${PLATFORM}" STREQUAL "amlogic" )
9696
SET ( DEFAULT_AMLOGIC ON )
9797
elseif ( "${PLATFORM}" STREQUAL "amlogic64" )
9898
SET ( DEFAULT_AMLOGIC ON )
99-
elseif ( "${PLATFORM}" MATCHES "x86" )
99+
elseif ( "${PLATFORM}" MATCHES "x11" )
100100
SET ( DEFAULT_X11 ON )
101-
if ( "${PLATFORM}" STREQUAL "x86-dev" )
101+
if ( "${PLATFORM}" STREQUAL "x11-dev" )
102102
SET ( DEFAULT_AMLOGIC ON)
103103
SET ( DEFAULT_WS281XPWM ON )
104104
endif()

cmake/debian/postinst

+37-24
Original file line numberDiff line numberDiff line change
@@ -26,45 +26,53 @@ CPU_X32X64=`uname -m | grep 'x86_32\|i686\|x86_64' | wc -l`
2626
BOOT_BERRYBOOT=$(grep -m1 -c '\(/var/media\|/media/pi\)/berryboot' /etc/mtab)
2727

2828
#get current system ip
29-
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;}'`
30-
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'`
31-
32-
#check if hyperion is running
33-
HYPERION_RUNNING=false
34-
pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
29+
NET_IP=`hostname -I | cut -d " " -f1`
3530

3631
# search for users in system, returns first entry
3732
FOUND_USR=`who | grep -o '^\w*\b'` || "root"
3833

34+
# determine if we should use a service
35+
ENABLE_SERVICE=0
36+
STARTUP_MSG="echo ---> You can start Hyperion from your menu now"
37+
38+
if [ $CPU_RPI -eq 1 ]; then
39+
ENABLE_SERVICE=1
40+
STARTUP_MSG="echo ---> Hyperion has been installed as service, it will start on each system startup"
41+
fi
42+
3943
start_msg=""
4044
restart_msg=""
4145

4246
if grep -m1 systemd /proc/1/comm > /dev/null
4347
then
44-
echo "--> init deamon: systemd"
48+
echo "---> init deamon: systemd"
4549
# systemd
46-
$HYPERION_RUNNING && systemctl stop hyperiond 2> /dev/null
4750
install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/[email protected]
48-
systemctl enable hyperiond"@${FOUND_USR}".service
49-
start_msg="--> systemctl start hyperiond for user ${FOUND_USR}"
50-
systemctl start hyperiond"@${FOUND_USR}"
51+
# 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?!
52+
if [ $ENABLE_SERVICE -eq 1 ]; then
53+
systemctl enable hyperiond"@${FOUND_USR}".service
54+
start_msg="--> systemctl start hyperiond for user ${FOUND_USR}"
55+
systemctl start hyperiond"@${FOUND_USR}"
56+
fi
5157

5258
elif [ -e /sbin/initctl ]
5359
then
54-
echo "--> init deamon: upstart"
60+
echo "---> init deamon: upstart"
5561
# upstart
56-
$HYPERION_RUNNING && initctl stop hyperiond
57-
install_file /usr/share/hyperion/service/hyperiond.initctl /etc/init/hyperion.conf && initctl reload-configuration
58-
start_msg="--> initctl start hyperiond"
59-
initctl start hyperiond
62+
if [ $ENABLE_SERVICE -eq 1 ]; then
63+
install_file /usr/share/hyperion/service/hyperiond.initctl /etc/init/hyperion.conf && initctl reload-configuration
64+
start_msg="--> initctl start hyperiond"
65+
initctl start hyperiond
66+
fi
6067

6168
else
62-
echo "--> init deamon: sysV"
69+
echo "---> init deamon: sysV"
6370
# sysV
64-
$HYPERION_RUNNING && service hyperiond stop 2>/dev/null
65-
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
66-
start_msg="--> service hyperiond start"
67-
service hyperiond start
71+
if [ $ENABLE_SERVICE -eq 1 ]; then
72+
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
73+
start_msg="---> service hyperiond start"
74+
service hyperiond start
75+
fi
6876
fi
6977

7078
#cleanup
@@ -81,6 +89,7 @@ ln -fs $BINSP/hyperion-framebuffer $BINTP/hyperion-framebuffer 2>/dev/null
8189
ln -fs $BINSP/hyperion-dispmanx $BINTP/hyperion-dispmanx 2>/dev/null
8290
ln -fs $BINSP/hyperion-x11 $BINTP/hyperion-x11 2>/dev/null
8391
ln -fs $BINSP/hyperion-aml $BINTP/hyperion-aml 2>/dev/null
92+
ln -fs $BINSP/hyperion-qt $BINTP/hyperion-qt 2>/dev/null
8493

8594

8695
#Check, if dtparam=spi=on is in place
@@ -105,9 +114,11 @@ fi
105114
echo ${start_msg}
106115

107116
echo "-----------------------------------------------------------------------------"
108-
echo "--> Hyperion has been installed/updated!"
109-
echo "--> For configuration, visit with your browser: ${NET_IP}:8090"
110-
echo "--> or if already used by another service try: ${NET_IP}:8091"
117+
echo "---> Hyperion has been installed/updated!"
118+
echo "---> "
119+
$STARTUP_MSG
120+
echo "---> For configuration, visit with your browser: ${NET_IP}:8090"
121+
echo "---> or if already used by another service try: ${NET_IP}:8091"
111122
$REBOOTMESSAGE
112123
echo "-----------------------------------------------------------------------------"
113124
echo "Webpage: www.hyperion-project.org"
@@ -124,3 +135,5 @@ then
124135
echo "- please remove it to avoid problems -"
125136
echo "---------------------------------------------------------------------------------"
126137
fi
138+
139+
exit 0

cmake/debian/preinst

+5
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ then
2727
fi
2828
fi
2929

30+
# In case we don't use a service kill all instances
31+
killall hyperiond 2> /dev/null
32+
33+
# overwrite last return code
34+
exit 0
3035

3136
#$USR=hyperionIS;
3237

cmake/debian/prerm

+10-7
Original file line numberDiff line numberDiff line change
@@ -11,30 +11,33 @@ pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
1111

1212
if grep -m1 systemd /proc/1/comm > /dev/null
1313
then
14-
echo "--> stop init deamon: systemd"
14+
echo "---> stop init deamon: systemd"
1515
# systemd
1616
$HYPERION_RUNNING && systemctl stop hyperiond"@${FOUND_USR}" 2> /dev/null
1717
# disable user specific symlink
18-
echo "--> Disable service and remove entry"
18+
echo "---> Disable service and remove entry"
1919
systemctl -q disable hyperiond"@${FOUND_USR}"
2020
rm -v /etc/systemd/system/[email protected] 2>/dev/null
2121

2222
elif [ -e /sbin/initctl ]
2323
then
24-
echo "--> stop init deamon: upstart"
24+
echo "---> stop init deamon: upstart"
2525
# upstart
2626
$HYPERION_RUNNING && initctl stop hyperiond
27-
echo "--> Remove upstart service"
27+
echo "---> Remove upstart service"
2828
rm -v /etc/init/hyperion* 2>/dev/null
2929
initctl reload-configuration
3030

3131
else
32-
echo "--> stop init deamon: sysV"
32+
echo "---> stop init deamon: sysV"
3333
# sysV
3434
$HYPERION_RUNNING && service hyperiond stop 2>/dev/null
35-
echo "--> Remove sysV service"
35+
echo "---> Remove sysV service"
3636
update-rc.d -f hyperion remove
3737
rm /etc/init.d/hyperion* 2>/dev/null
3838
fi
3939

40-
return 0
40+
# In case we don't use a service kill all instances
41+
killall hyperiond 2> /dev/null
42+
43+
exit 0

cmake/rpm/postinst

+111-30
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,134 @@ install_file()
55
src="$1"
66
dest="$2"
77

8-
if [ -e "$dest" ] && ! cmp --quiet "$src" "$dest"
8+
if [ ! -e "$dest" ]
99
then
10-
cp "$src" "${dest}.new"
11-
else
1210
cp "$src" "${dest}"
11+
return 1
12+
else
13+
echo "--> Service file already exists, skip creation"
14+
return 0
1315
fi
1416
}
1517

1618

17-
echo "--- hyperion ambilight postinstall ---"
18-
echo "- install configuration template"
19-
mkdir -p /etc/hyperion
20-
install_file /usr/share/hyperion/config/hyperion.config.json /etc/hyperion/hyperion.config.json
19+
echo "---Hyperion ambient light postinstall ---"
20+
21+
#check system
22+
CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710\|BCM2835' /proc/cpuinfo`
23+
CPU_X32X64=`uname -m | grep 'x86_32\|i686\|x86_64' | wc -l`
24+
25+
#Check for a bootloader as Berryboot
26+
BOOT_BERRYBOOT=$(grep -m1 -c '\(/var/media\|/media/pi\)/berryboot' /etc/mtab)
27+
28+
#get current system ip
29+
NET_IP=`hostname -I | cut -d " " -f1`
30+
31+
# search for users in system, returns first entry
32+
FOUND_USR=`who | grep -o '^\w*\b'` || "root"
33+
34+
# determine if we should use a service
35+
ENABLE_SERVICE=0
36+
STARTUP_MSG="echo ---> You can start Hyperion from your menu now"
2137

38+
if [ $CPU_RPI -eq 1 ]; then
39+
ENABLE_SERVICE=1
40+
STARTUP_MSG="echo ---> Hyperion has been installed as service, it will start on each system startup"
41+
fi
42+
43+
start_msg=""
44+
restart_msg=""
2245

2346
if grep -m1 systemd /proc/1/comm > /dev/null
2447
then
48+
echo "---> init deamon: systemd"
2549
# systemd
26-
echo
27-
systemctl stop hyperion 2> /dev/null
28-
install_file /usr/share/hyperion/service/hyperion.systemd.sh /etc/systemd/system/hyperion.service
29-
systemctl -q enable hyperion.service
30-
# if [ $OS_OSMC -eq 1 ]; then
31-
# echo '---> Modify systemd script for OSMC usage'
32-
# # Wait until kodi is sarted (for kodi checker)
33-
# sed -i '/After = mediacenter.service/d' /etc/systemd/system/hyperion.service
34-
# sed -i '/Unit/a After = mediacenter.service' /etc/systemd/system/hyperion.service
35-
# sed -i 's/User=osmc/User=root/g' /etc/systemd/system/hyperion.service
36-
# sed -i 's/Group=osmc/Group=root/g' /etc/systemd/system/hyperion.service
37-
# systemctl -q daemon-reload
38-
# fi
39-
systemctl start hyperion
50+
install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/[email protected]
51+
# 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?!
52+
if [ $ENABLE_SERVICE -eq 1 ]; then
53+
systemctl enable hyperiond"@${FOUND_USR}".service
54+
start_msg="--> systemctl start hyperiond for user ${FOUND_USR}"
55+
systemctl start hyperiond"@${FOUND_USR}"
56+
fi
4057

4158
elif [ -e /sbin/initctl ]
4259
then
60+
echo "---> init deamon: upstart"
4361
# upstart
44-
install_file /usr/share/hyperion/service/hyperion.initctl.sh /etc/init/hyperion.conf
45-
initctl reload-configuration
46-
initctl start hyperion
62+
if [ $ENABLE_SERVICE -eq 1 ]; then
63+
install_file /usr/share/hyperion/service/hyperiond.initctl /etc/init/hyperion.conf && initctl reload-configuration
64+
start_msg="--> initctl start hyperiond"
65+
initctl start hyperiond
66+
fi
4767

4868
else
69+
echo "---> init deamon: sysV"
4970
# sysV
50-
service hyperion stop 2>/dev/null
51-
install_file /usr/share/hyperion/service/hyperion.init.sh /etc/init.d/hyperion
52-
chmod +x /etc/init.d/hyperion
53-
update-rc.d hyperion defaults 98 02
54-
service hyperion start
71+
if [ $ENABLE_SERVICE -eq 1 ]; then
72+
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
73+
start_msg="---> service hyperiond start"
74+
service hyperiond start
75+
fi
76+
fi
77+
78+
#cleanup
79+
rm -r /usr/share/hyperion/service
80+
81+
#link binarys and set exec bit
82+
BINSP=/usr/share/hyperion/bin
83+
BINTP=/usr/bin
84+
chmod +x -R $BINSP
85+
ln -fs $BINSP/hyperiond $BINTP/hyperiond
86+
ln -fs $BINSP/hyperion-remote $BINTP/hyperion-remote
87+
ln -fs $BINSP/hyperion-v4l2 $BINTP/hyperion-v4l2
88+
ln -fs $BINSP/hyperion-framebuffer $BINTP/hyperion-framebuffer 2>/dev/null
89+
ln -fs $BINSP/hyperion-dispmanx $BINTP/hyperion-dispmanx 2>/dev/null
90+
ln -fs $BINSP/hyperion-x11 $BINTP/hyperion-x11 2>/dev/null
91+
ln -fs $BINSP/hyperion-aml $BINTP/hyperion-aml 2>/dev/null
92+
ln -fs $BINSP/hyperion-qt $BINTP/hyperion-qt 2>/dev/null
93+
94+
#Check, if dtparam=spi=on is in place
95+
if [ $CPU_RPI -eq 1 ]; then
96+
BOOT_DIR="/boot"
97+
if [ $BOOT_BERRYBOOT -eq 1 ]; then
98+
BOOT_DIR=$(sed -ne "s#/dev/mmcblk0p1 \([^ ]*\) vfat rw,.*#\1#p" /etc/mtab)
99+
fi
100+
if [ -z "$BOOT_DIR" -o ! -f "$BOOT_DIR/config.txt" ]; then
101+
echo '---> Warning: RPi using BERRYBOOT found but can not locate where config.txt is to enable SPI. (BOOT_DIR='"$BOOT_DIR)"
102+
SPIOK=1 # Not sure if OK, but don't ask to reboot
103+
else
104+
SPIOK=`grep '^\dtparam=spi=on' "$BOOT_DIR/config.txt" | wc -l`
105+
if [ $SPIOK -ne 1 ]; then
106+
echo '---> Raspberry Pi found, but SPI is not set, we write "dtparam=spi=on" to '"$BOOT_DIR/config.txt"
107+
sed -i '$a dtparam=spi=on' "$BOOT_DIR/config.txt"
108+
REBOOTMESSAGE="echo Please reboot your Raspberry Pi, we inserted dtparam=spi=on to $BOOT_DIR/config.txt"
109+
fi
110+
fi
111+
fi
112+
113+
echo ${start_msg}
114+
115+
echo "-----------------------------------------------------------------------------"
116+
echo "---> Hyperion has been installed/updated!"
117+
echo "---> "
118+
$STARTUP_MSG
119+
echo "---> For configuration, visit with your browser: ${NET_IP}:8090"
120+
echo "---> or if already used by another service try: ${NET_IP}:8091"
121+
$REBOOTMESSAGE
122+
echo "-----------------------------------------------------------------------------"
123+
echo "Webpage: www.hyperion-project.org"
124+
echo "Wiki: wiki.hyperion-project.org"
125+
echo "Forum: forum.hyperion-project.org"
126+
echo "-----------------------------------------------------------------------------"
127+
128+
129+
if [ -e /opt/hyperion/ ]
130+
then
131+
echo
132+
echo "---------------------------------------------------------------------------------"
133+
echo "- It seemd that you have an older version of hyperion installed in /opt/hyperion -"
134+
echo "- please remove it to avoid problems -"
135+
echo "---------------------------------------------------------------------------------"
55136
fi
56-
echo "- done"
57137

138+
exit 0

libsrc/ssdp/SSDPDiscover.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ const QString SSDPDiscover::getFirstService(const searchType& type, const QStrin
8888
//Info(_log, "Received msearch response from '%s:%d'. Search target: %s",QSTRING_CSTR(sender.toString()), senderPort, QSTRING_CSTR(headers.value("st")));
8989
if(type == STY_WEBSERVER)
9090
{
91-
Info(_log, "Found Hyperion server at: %s:%s", QSTRING_CSTR(url.host()), url.port());
91+
Info(_log, "Found Hyperion server at: %s:%d", QSTRING_CSTR(url.host()), url.port());
9292

9393
return url.host()+":"+QString::number(url.port());
9494
}

0 commit comments

Comments
 (0)