mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Systemd changes | root script | URL support for gif effects (#1319)
* Systemd changes and URL option for Gif Effects * Add grayscale to gif effect * WebUI adjustments * Rename version to .version * Copy runHyperionAsRoot.sh to rpi packages * Pack script into all unix packages * Start hyperion only after network is available * Snap builds removed due to poor server connection * Flexible updateHyperionUser.sh * updateHyperionUser script entered in the package * Print help on none sudo execute * Corrected embedded Python location * Replacement for the QWindowsScreen grabWindow function * Updated to latest 2.x mbedtls version 2.27 Co-authored-by: LordGrey <lordgrey.emmel@gmail.com>
This commit is contained in:
158
cmake/package-scripts/postinst
Normal file
158
cmake/package-scripts/postinst
Normal file
@@ -0,0 +1,158 @@
|
||||
#!/bin/sh
|
||||
|
||||
echo "--- postinst called with args= " $1 $2
|
||||
|
||||
# If $1=configure and $2 is set, this is an upgrade
|
||||
if [ "$1" = configure ] && [ "$2" != "" ]; then
|
||||
IS_UPGRADE=true
|
||||
else
|
||||
IS_UPGRADE=false
|
||||
fi
|
||||
|
||||
install_file()
|
||||
{
|
||||
src="$1"
|
||||
dest="$2"
|
||||
|
||||
if [ ! -e "$dest" ]
|
||||
then
|
||||
cp "$src" "${dest}"
|
||||
return 1
|
||||
else
|
||||
echo "--> Service file already exists, skip creation"
|
||||
return 0
|
||||
fi
|
||||
}
|
||||
|
||||
echo "--- Hyperion ambient light postinstall ---"
|
||||
|
||||
#check system
|
||||
CPU_RPI=`grep -m1 -c 'BCM2708\|BCM2709\|BCM2710\|BCM2835\|BCM2836\|BCM2837\|BCM2711' /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 -m1 '^\w*\b'` || "root"
|
||||
|
||||
start_msg=""
|
||||
restart_msg=""
|
||||
|
||||
# service registration if no gui is present (only on initial installation and not upgrade)
|
||||
if [ "$IS_UPGRADE" = false ]; then
|
||||
if [ -z "${DISPLAY}" ] && [ -z "${WAYLAND_DISPLAY}" ] && [ -z "${XDG_CURRENT_DESKTOP}" ]; then
|
||||
STARTUP_MSG="echo ---> Hyperion has been installed as service, it will start on each system startup"
|
||||
|
||||
if grep -m1 systemd /proc/1/comm > /dev/null
|
||||
then
|
||||
# systemd
|
||||
echo "---> init deamon: systemd"
|
||||
install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/hyperion@.service
|
||||
systemctl enable hyperion"@${FOUND_USR}".service
|
||||
start_msg="--> systemctl start hyperion for user ${FOUND_USR}"
|
||||
systemctl start hyperion"@${FOUND_USR}"
|
||||
elif [ -e /sbin/initctl ]
|
||||
then
|
||||
# upstart
|
||||
echo "---> init deamon: upstart"
|
||||
install_file /usr/share/hyperion/service/hyperion.initctl /etc/init/hyperion.conf && initctl reload-configuration
|
||||
start_msg="--> initctl start hyperion"
|
||||
initctl start hyperion
|
||||
else
|
||||
# sysV
|
||||
echo "---> init deamon: sysV"
|
||||
install_file /usr/share/hyperion/service/hyperion.init /etc/init.d/hyperion && chmod +x /etc/init.d/hyperion && update-rc.d hyperion defaults 98 02
|
||||
start_msg="---> service hyperion start"
|
||||
service hyperion start
|
||||
fi
|
||||
else
|
||||
STARTUP_MSG="echo ---> You can start Hyperion from your menu now"
|
||||
fi
|
||||
fi
|
||||
|
||||
#cleanup
|
||||
rm -r /usr/share/hyperion/service
|
||||
|
||||
#link binarys and set exec bit
|
||||
BINSP=/usr/share/hyperion
|
||||
BINTP=/usr/bin
|
||||
chmod +x -R $BINSP/bin
|
||||
ln -fs $BINSP/bin/hyperiond $BINTP/hyperiond
|
||||
ln -fs $BINSP/bin/hyperion-remote $BINTP/hyperion-remote
|
||||
ln -fs $BINSP/bin/hyperion-v4l2 $BINTP/hyperion-v4l2
|
||||
ln -fs $BINSP/bin/hyperion-framebuffer $BINTP/hyperion-framebuffer 2>/dev/null
|
||||
ln -fs $BINSP/bin/hyperion-dispmanx $BINTP/hyperion-dispmanx 2>/dev/null
|
||||
ln -fs $BINSP/bin/hyperion-x11 $BINTP/hyperion-x11 2>/dev/null
|
||||
ln -fs $BINSP/bin/hyperion-xcb $BINTP/hyperion-xcb 2>/dev/null
|
||||
ln -fs $BINSP/bin/hyperion-aml $BINTP/hyperion-aml 2>/dev/null
|
||||
ln -fs $BINSP/bin/hyperion-qt $BINTP/hyperion-qt 2>/dev/null
|
||||
|
||||
#create symlink for updateHyperionUser.sh script
|
||||
ln -fs $BINSP/scripts/updateHyperionUser.sh $BINTP/updateHyperionUser 2>/dev/null
|
||||
|
||||
# install desktop icons (only on initial installation and not upgrade)
|
||||
if [ "$IS_UPGRADE" = false ]; then
|
||||
if hash desktop-file-install 2>/dev/null; then
|
||||
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
|
||||
fi
|
||||
fi
|
||||
|
||||
# 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"
|
||||
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 "-----------------------------------------------------------------------------"
|
||||
if [ "$IS_UPGRADE" = true ]; then
|
||||
echo "---> Hyperion has been upgraded!"
|
||||
else
|
||||
echo "---> Hyperion has been installed!"
|
||||
fi
|
||||
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 "Forum: www.hyperion-project.org"
|
||||
echo "Documenation: docs.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
|
Reference in New Issue
Block a user