From a42aae44d12d82acb6ba88e319ae2831edd6b218 Mon Sep 17 00:00:00 2001 From: Paulchen Panther <16664240+Paulchen-Panther@users.noreply.github.com> Date: Tue, 24 Nov 2020 21:28:02 +0000 Subject: [PATCH] Codespace updated Debian pre/post scripts modified for HyperBian --- .devcontainer.json | 2 +- bin/service/hyperion.systemd.RO | 16 ---------------- cmake/debian/postinst | 32 +++++++++++++++++++++----------- cmake/debian/preinst | 2 +- cmake/debian/prerm | 6 +++--- 5 files changed, 26 insertions(+), 32 deletions(-) delete mode 100644 bin/service/hyperion.systemd.RO diff --git a/.devcontainer.json b/.devcontainer.json index 27f667d9..04de050b 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -16,5 +16,5 @@ }, }, "forwardPorts": [8090, 8092], - "postCreateCommand": "git submodule update --recursive --init && sudo apt-get install -y git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-image0-dev libxcb-util0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libssl-dev zlib1g-dev" + "postCreateCommand": "git submodule update --recursive --init && sudo apt-get update && sudo apt-get install -y git cmake build-essential qtbase5-dev libqt5serialport5-dev libqt5sql5-sqlite libqt5svg5-dev libqt5x11extras5-dev libusb-1.0-0-dev python3-dev libcec-dev libxcb-image0-dev libxcb-util0-dev libxcb-shm0-dev libxcb-render0-dev libxcb-randr0-dev libxrandr-dev libxrender-dev libavahi-core-dev libavahi-compat-libdnssd-dev libjpeg-dev libturbojpeg0-dev libssl-dev zlib1g-dev" } diff --git a/bin/service/hyperion.systemd.RO b/bin/service/hyperion.systemd.RO deleted file mode 100644 index 179871c6..00000000 --- a/bin/service/hyperion.systemd.RO +++ /dev/null @@ -1,16 +0,0 @@ -[Unit] -Description=Hyperion ambient light systemd service for OpenELEC/LibreELEC/RasPlex -After=graphical.target -After=network.target - -[Service] -WorkingDirectory=/storage/hyperion/bin/ -Environment=LD_LIBRARY_PATH=$LD_LIBRARY_PATH:. -ExecStart=./hyperiond /storage/.config/hyperion/hyperion.config.json -TimeoutStopSec=5 -KillMode=mixed -Restart=on-failure -RestartSec=2 - -[Install] -WantedBy=default.target diff --git a/cmake/debian/postinst b/cmake/debian/postinst index 0527c94d..140a6962 100644 --- a/cmake/debian/postinst +++ b/cmake/debian/postinst @@ -21,6 +21,7 @@ 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` +OS_HYPERBIAN=`grep ID /etc/os-release | grep -m1 -c HyperBian` #Check for a bootloader as Berryboot BOOT_BERRYBOOT=$(grep -m1 -c '\(/var/media\|/media/pi\)/berryboot' /etc/mtab) @@ -47,12 +48,19 @@ if grep -m1 systemd /proc/1/comm > /dev/null then echo "---> init deamon: systemd" # systemd - install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/hyperiond@.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?! - if [ $ENABLE_SERVICE -eq 1 ]; then - systemctl enable hyperiond"@${FOUND_USR}".service - start_msg="--> systemctl start hyperiond for user ${FOUND_USR}" - systemctl start hyperiond"@${FOUND_USR}" + if [ $OS_HYPERBIAN -eq 1 ]; then + # start service only + echo "--> Service file already exists, skip creation" + start_msg="--> systemctl start hyperion" + systemctl start hyperion + else + install_file /usr/share/hyperion/service/hyperion.systemd /etc/systemd/system/hyperiond@.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?! + if [ $ENABLE_SERVICE -eq 1 ]; then + systemctl enable hyperiond"@${FOUND_USR}".service + start_msg="--> systemctl start hyperiond for user ${FOUND_USR}" + systemctl start hyperiond"@${FOUND_USR}" + fi fi elif [ -e /sbin/initctl ] @@ -92,11 +100,13 @@ ln -fs $BINSP/hyperion-xcb $BINTP/hyperion-xcb 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 +# install desktop icons / not on HyperBian +if [ $OS_HYPERBIAN -ne 1 ]; 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 # cleanup desktop icons rm -r /usr/share/hyperion/desktop 2>/dev/null diff --git a/cmake/debian/preinst b/cmake/debian/preinst index 5559dca8..4aa8f037 100644 --- a/cmake/debian/preinst +++ b/cmake/debian/preinst @@ -12,7 +12,7 @@ then then echo "--> stop init deamon: systemd" # systemd - systemctl stop hyperiond"@${FOUND_USR}" 2> /dev/null + systemctl stop hyperion hyperiond"@${FOUND_USR}" 2> /dev/null elif [ -e /sbin/initctl ] then diff --git a/cmake/debian/prerm b/cmake/debian/prerm index ceb8c5a4..f43561cf 100644 --- a/cmake/debian/prerm +++ b/cmake/debian/prerm @@ -13,10 +13,10 @@ 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 + $HYPERION_RUNNING && systemctl stop hyperion hyperiond"@${FOUND_USR}" 2> /dev/null + # disable user specific symlink / not on HyperBian echo "---> Disable service and remove entry" - systemctl -q disable hyperiond"@${FOUND_USR}" + systemctl -q disable hyperiond"@${FOUND_USR}" 2> /dev/null rm -v /etc/systemd/system/hyperiond@.service 2>/dev/null elif [ -e /sbin/initctl ]