- .deb work
- update package creation
- added hyperion package icon
- remove V4L2 warning for OSX build
This commit is contained in:
Paulchen-Panther 2019-01-19 18:35:40 +01:00
parent d609e4137b
commit 1a9433861e
16 changed files with 228 additions and 24 deletions

1
.gitignore vendored
View File

@ -6,7 +6,6 @@ CMakeFiles/
__/
# Ignoring autogenerated files
*.cmake
Makefile
qrc_*.cpp
*.qrc.depends

View File

@ -81,17 +81,9 @@ bin/hyperiond
### Download
Creates hyperion directory and checkout the code from github
You might want to add `--depth 1` to the `git` command if you only want to compile the current source and have no need for the entire git repository
```
export HYPERION_DIR="hyperion"
git clone --recursive https://github.com/hyperion-project/hyperion.ng.git "$HYPERION_DIR"
```
**Note:** If you forget the --recursive in above statement or you are updating an existing clone you need to clone the flatbuffers submodule by runnning the follwing two statements:
```
git submodule init
git submodule update
git clone --recursive --depth 1 https://github.com/hyperion-project/hyperion.ng.git "$HYPERION_DIR"
```
### Preparations
@ -113,7 +105,7 @@ cmake -DCMAKE_BUILD_TYPE=Release ..
*Developers on x86* linux should use:
```
cmake -DPLATFORM=x86-dev -DCMAKE_BUILD_TYPE=Release ..
cmake -DPLATFORM=x11-dev -DCMAKE_BUILD_TYPE=Release ..
```
To use framebuffer instead of dispmanx (for example on the *cubox-i*):

View File

@ -9,7 +9,7 @@ Environment=LD_LIBRARY_PATH=$LD_LIBRARY_PATH:.
ExecStart=./hyperiond /storage/.config/hyperion/hyperion.config.json
TimeoutStopSec=5
KillMode=mixed
Restart=always
Restart=on-failure
RestartSec=2
[Install]

View File

@ -0,0 +1,23 @@
# - Find package for .deb building
# Find the .deb building executable and extract the version number
#
# OUTPUT Variables
#
# DEB_BUILDER_FOUND
# True if the deb builder package was found
# DEB_BUILDER_EXECUTABLE
# The deb builder executable location
# DEB_BUILDER_VERSION
# A string denoting the version of deb builder that has been found
find_program ( DEB_BUILDER_EXECUTABLE dpkg-deb )
if ( DEB_BUILDER_EXECUTABLE )
SET( DEB_BUILDER_FOUND TRUE )
execute_process ( COMMAND ${DEB_BUILDER_EXECUTABLE} --version OUTPUT_VARIABLE DEB_VERSION_RAW ERROR_QUIET )
if (DEB_VERSION_RAW)
string ( REGEX REPLACE "^RPM-Version ([0-9]+.[0-9]+.[0-9]+),.*" "\\1" DEB_BUILDER_VERSION ${DEB_VERSION_RAW})
else ()
set ( DEB_BUILDER_VERSION "unknown" )
endif()
endif ()

View File

@ -0,0 +1,23 @@
# - Find package for .rpm building
# Find the .rpm building executable and extract the version number
#
# OUTPUT Variables
#
# RPM_BUILDER_FOUND
# True if the rpm package was found
# RPM_BUILDER_EXECUTABLE
# The rpm executable location
# RPM_BUILDER_VERSION
# A string denoting the version of rpm that has been found
find_program ( RPM_BUILDER_EXECUTABLE rpm )
if ( RPM_BUILDER_EXECUTABLE )
SET( RPM_BUILDER_FOUND TRUE )
execute_process ( COMMAND ${RPM_BUILDER_EXECUTABLE} --version OUTPUT_VARIABLE RPM_VERSION_RAW ERROR_QUIET )
if (RPM_VERSION_RAW)
string ( REGEX REPLACE "^RPM-Version ([0-9]+.[0-9]+.[0-9]+),.*" "\\1" RPM_BUILDER_VERSION ${RPM_VERSION_RAW})
else ()
set ( RPM_BUILDER_VERSION "unknown" )
endif()
endif ()

View File

@ -91,6 +91,14 @@ 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
# install desktop icons
echo "---> Install Hyperion desktop icons"
mkdir /usr/share/pixmaps/hyperion 2>/dev/null
cp /usr/share/hyperion/desktop/*.png /usr/share/pixmaps/hyperion 2>/dev/null
desktop-file-install /usr/share/hyperion/desktop/hyperiond.desktop 2>/dev/null
# cleanup desktop icons
rm -r /usr/share/hyperion/desktop 2>/dev/null
#Check, if dtparam=spi=on is in place
if [ $CPU_RPI -eq 1 ]; then

View File

@ -40,4 +40,11 @@ fi
# In case we don't use a service kill all instances
killall hyperiond 2> /dev/null
# delete desktop icons; desktop-file-edit is a workaround to hide the entry and delete it afterwards manual.
# TODO Better way for deletion and keep the desktop in sync without logout/login or desktop dependend cmds?
echo "---> Delete Hyperion desktop icons"
desktop-file-edit --set-key=NoDisplay --set-value=true /usr/share/applications/hyperiond.desktop 2>/dev/null
rm -v /usr/share/applications/hyperion* 2>/dev/null
rm -rv /usr/share/pixmaps/hyperion 2>/dev/null
exit 0

View File

@ -0,0 +1,11 @@
[Desktop Entry]
Name=Hyperion
GenericName=Hyperion Ambient Lighting
Comment=Hyperion mimics the well known Ambilight from Philips
Icon=/usr/share/pixmaps/hyperion/hyperiond_128.png
Terminal=false
TryExec=hyperiond
Exec=hyperiond
Type=Application
StartupNotify=false
Categories=Application;

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

View File

@ -1,15 +1,28 @@
# cmake file for generating distribution packages
# default packages to build
IF (APPLE)
SET ( CPACK_GENERATOR "TGZ" "Bundle")
ELSEIF (UNIX)
SET ( CPACK_GENERATOR "DEB" "TGZ" "STGZ") # "RPM"
SET ( CPACK_GENERATOR "TGZ" "STGZ")
ELSEIF (WIN32)
SET ( CPACK_GENERATOR "ZIP" "NSIS")
SET ( CPACK_GENERATOR "ZIP")
ENDIF()
# Determine packages by found generator executables
find_package(RpmBuilder)
find_package(DebBuilder)
IF(RPM_BUILDER_FOUND)
message("CPACK: Found RPM builder")
SET ( CPACK_GENERATOR ${CPACK_GENERATOR} "RPM")
ENDIF()
IF(DEB_BUILDER_FOUND)
message("CPACK: Found DEB builder")
SET ( CPACK_GENERATOR ${CPACK_GENERATOR} "DEB")
ENDIF()
# Apply to all packages, some of these can be overwritten with generator specific content
# https://cmake.org/cmake/help/v3.0/module/CPack.html
# https://cmake.org/cmake/help/v3.5/module/CPack.html
SET ( CPACK_PACKAGE_NAME "Hyperion" )
SET ( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Hyperion is an open source ambient light implementation" )
@ -27,18 +40,22 @@ SET ( CPACK_CREATE_DESKTOP_LINKS "hyperiond;Hyperion" )
# Specific CPack Package Generators
# https://cmake.org/Wiki/CMake:CPackPackageGenerators
# .deb files for dpkg
# .deb files for apt
SET ( CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA "${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/preinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/postinst;${CMAKE_CURRENT_SOURCE_DIR}/cmake/debian/prerm" )
SET ( CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5core5a (>= 5.5.0), libqt5network5 (>= 5.5.0), libqt5gui5 (>= 5.5.0), libqt5serialport5 (>= 5.5.0), libqt5sql5 (>= 5.5.0), libqt5sql5-sqlite (>= 5.5.0), libavahi-core7 (>= 0.6.31), libavahi-compat-libdnssd1 (>= 0.6.31), libusb-1.0-0, libpython3.5, libc6" )
SET ( CPACK_DEBIAN_PACKAGE_SECTION "Miscellaneous" )
# .rpm for rpm
https://cmake.org/cmake/help/v3.5/module/CPackRPM.html
SET ( CPACK_RPM_PACKAGE_RELEASE 1)
SET ( CPACK_RPM_PACKAGE_LICENSE "unknown")
SET ( CPACK_RPM_PACKAGE_GROUP "unknown")
SET ( CPACK_RPM_PACKAGE_REQUIRES "libqt5core5a >= 5.5.0, libqt5network5 >= 5.5.0, libqt5gui5 >= 5.5.0, libqt5serialport5 >= 5.5.0, libqt5sql5 >= 5.5.0, libqt5sql5-sqlite >= 5.5.0, libavahi-core7 >= 0.6.31, libavahi-compat-libdnssd1 >= 0.6.31, libusb-1.0-0, libpython3.5, libc6")
SET ( CPACK_RPM_PACKAGE_LICENSE "MIT")
SET ( CPACK_RPM_PACKAGE_GROUP "Applications")
SET ( CPACK_RPM_PACKAGE_REQUIRES "qt5-qtbase >= 5.5.0, qt5-qtbase-gui >= 5.5.0, qt5-qtserialport >= 5.5.0, avahi-libs >= 0.6.31, avahi-compat-libdns_sd >= 0.6.31, libusbx, python35 >= 3.5.0")
# Notes: This is a dependency list for Fedora 27, different .rpm OSes use different names for their deps
SET ( CPACK_RPM_PRE_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpm/preinst" )
SET ( CPACK_RPM_POST_INSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpm/postinst" )
SET ( CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE "${CMAKE_CURRENT_SOURCE_DIR}/cmake/rpm/prerm" )
# OSX "Bundle" generator TODO Add more osx generators
# https://cmake.org/cmake/help/v3.10/module/CPackBundle.html

View File

@ -91,6 +91,15 @@ 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
# install desktop icons
echo "---> Install Hyperion desktop icons"
mkdir /usr/share/pixmaps/hyperion 2>/dev/null
cp /usr/share/hyperion/desktop/*.png /usr/share/pixmaps/hyperion 2>/dev/null
desktop-file-install /usr/share/hyperion/desktop/hyperiond.desktop 2>/dev/null
# cleanup desktop icons
rm -r /usr/share/hyperion/desktop 2>/dev/null
#Check, if dtparam=spi=on is in place
if [ $CPU_RPI -eq 1 ]; then
BOOT_DIR="/boot"

61
cmake/rpm/preinst Normal file
View File

@ -0,0 +1,61 @@
#!/bin/sh
echo "---Hyperion ambient light preinst ---"
# search for users in system, returns first entry
FOUND_USR=`who | grep -o '^\w*\b'` || "root"
# stop running daemon before we install
if pgrep hyperiond > /dev/null 2>&1
then
if grep -m1 systemd /proc/1/comm > /dev/null
then
echo "--> stop init deamon: systemd"
# systemd
systemctl stop hyperiond"@${FOUND_USR}" 2> /dev/null
elif [ -e /sbin/initctl ]
then
echo "--> stop init deamon: upstart"
# upstart
initctl stop hyperiond
else
echo "--> stop init deamon: sysV"
# sysV
service hyperiond stop 2>/dev/null
fi
fi
# In case we don't use a service kill all instances
killall hyperiond 2> /dev/null
exit 0
#$USR=hyperionIS;
#addToGroup()
##{
# getent group $1 && adduser $USR $1;
#}
#check if user exists
#if id $USR >/dev/null 2>&1; then
# echo "--> hyperion user exists, skip creation";
#else
## create user
# echo "--> Create Hyperion user";
# adduser --system --group $USR;
#fi
# add user to groups if required
## secondary user groups that are required to access system things
#addToGroup(dialout);
#addToGroup(video);
#addToGroup(audio);
#addToGroup(systemd-journal);
# platform specific groups
#addToGroup(i2c);
#addToGroup(spi);
#addToGroup(gpio);

50
cmake/rpm/prerm Normal file
View File

@ -0,0 +1,50 @@
#!/bin/sh
echo "---Hyperion ambient light prerm ---"
# search for users in system, returns first entry
FOUND_USR=`who | grep -o '^\w*\b'` || "root"
# stop running daemon before we delete it
HYPERION_RUNNING=false
pgrep hyperiond > /dev/null 2>&1 && HYPERION_RUNNING=true
if grep -m1 systemd /proc/1/comm > /dev/null
then
echo "---> stop init deamon: systemd"
# systemd
$HYPERION_RUNNING && systemctl stop hyperiond"@${FOUND_USR}" 2> /dev/null
# disable user specific symlink
echo "---> Disable service and remove entry"
systemctl -q disable hyperiond"@${FOUND_USR}"
rm -v /etc/systemd/system/hyperiond@.service 2>/dev/null
elif [ -e /sbin/initctl ]
then
echo "---> stop init deamon: upstart"
# upstart
$HYPERION_RUNNING && initctl stop hyperiond
echo "---> Remove upstart service"
rm -v /etc/init/hyperion* 2>/dev/null
initctl reload-configuration
else
echo "---> stop init deamon: sysV"
# sysV
$HYPERION_RUNNING && service hyperiond stop 2>/dev/null
echo "---> Remove sysV service"
update-rc.d -f hyperion remove
rm /etc/init.d/hyperion* 2>/dev/null
fi
# In case we don't use a service kill all instances
killall hyperiond 2> /dev/null
# delete desktop icons; desktop-file-edit is a workaround to hide the entry and delete it afterwards manual.
# TODO Better way for deletion and keep the desktop in sync without logout/login or desktop dependend cmds?
echo "---> Delete Hyperion desktop icons"
desktop-file-edit --set-key=NoDisplay --set-value=true /usr/share/applications/hyperiond.desktop 2>/dev/null
rm -v /usr/share/applications/hyperion* 2>/dev/null
rm -rv /usr/share/pixmaps/hyperion 2>/dev/null
exit 0

View File

@ -97,7 +97,7 @@ void FlatBufferServer::stopServer()
if(_server->isListening())
{
// close client connections
for(auto client : _openConnections)
for(const auto& client : _openConnections)
{
client->forceClose();
}

View File

@ -52,11 +52,11 @@ if (ENABLE_AMLOGIC)
endif ()
if (ENABLE_X11)
target_link_libraries(hyperiond x11-grabber )
target_link_libraries(hyperiond x11-grabber)
endif ()
if (ENABLE_QT)
target_link_libraries(hyperiond qt-grabber )
target_link_libraries(hyperiond qt-grabber)
endif ()
install ( TARGETS hyperiond DESTINATION "share/hyperion/bin/" COMPONENT "${PLATFORM}" )
@ -64,6 +64,10 @@ install ( DIRECTORY ${CMAKE_SOURCE_DIR}/bin/service DESTINATION "share/hyperion/
install ( FILES ${CMAKE_SOURCE_DIR}/effects/readme.txt DESTINATION "share/hyperion/effects" COMPONENT "${PLATFORM}" )
install ( FILES ${CMAKE_SOURCE_DIR}/resources/icons/hyperion-icon-32px.png DESTINATION "share/hyperion/icons" COMPONENT "${PLATFORM}" )
# Desktop file for hyperiond
install ( FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperiond_128.png DESTINATION "share/hyperion/desktop" COMPONENT "${PLATFORM}" )
install ( FILES ${CMAKE_SOURCE_DIR}/cmake/desktop/hyperiond.desktop DESTINATION "share/hyperion/desktop" COMPONENT "${PLATFORM}" )
if(CMAKE_HOST_UNIX)
install(CODE "EXECUTE_PROCESS(COMMAND ln -sf \"../share/hyperion/bin/hyperiond\" \"${CMAKE_BINARY_DIR}/symlink_hyperiond\" )" COMPONENT "${PLATFORM}" )
install(FILES ${CMAKE_BINARY_DIR}/symlink_hyperiond DESTINATION "bin" RENAME hyperiond COMPONENT "${PLATFORM}" )

View File

@ -371,10 +371,10 @@ void HyperionDaemon::handleSettingsUpdate(const settings::type& type, const QJso
const QJsonArray & v4lArray = config.array();
for ( signed idx=0; idx<v4lArray.size(); idx++)
{
#ifdef ENABLE_V4L2
const QJsonObject & grabberConfig = v4lArray.at(idx).toObject();
#ifdef ENABLE_V4L2
V4L2Wrapper* grabber = new V4L2Wrapper(
grabberConfig["device"].toString("auto"),
parseVideoStandard(grabberConfig["standard"].toString("no-change")),