mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
* Allow to enable/disable suspend & lock event handling * Fix Windows * Refactor event handling incl.CEC * Revert "Auxiliary commit to revert individual files from 0d9a8b8a3a4a09609a339f54c7d8a9384c561282" This reverts commit 80737d926ad151a07b2493dd1685ed502975cb2e. * Support Events for Grabbers generically * Have CECEvent to actions configurable, further clean-ups * Remove handleEvent from V4L2grabber, as grabber will be stopped on suspend * Validate that one CEC Event can only trigger one action * MacOS lock/unlock added * fast windows fix * Corrections * Fix CodeQL findings * add macos lock/unlock handler * Migration of CEC-config and have default actions * Correct target_link_libraries * Include Foundation * macOS include AppKit * Support Scheduled Events, cleanups. * Fix destructing * Fix coredump during free * Consider additional error sceanrio * Fix missing code * install desktop icons * correct bash logic --------- Co-authored-by: Paulchen-Panther <16664240+Paulchen-Panther@users.noreply.github.com>
88 lines
2.7 KiB
Bash
88 lines
2.7 KiB
Bash
#!/bin/sh
|
|
|
|
echo "---Hyperion ambient light prerm ---"
|
|
|
|
UPGRADE="$1"
|
|
if [ "$2" = "in-favour" ]; then
|
|
# Treat conflict remove as an upgrade.
|
|
UPGRADE="upgrade"
|
|
fi
|
|
|
|
# Don't clean-up just for an upgrade.`
|
|
if [ "$UPGRADE" = "upgrade" ] ; then
|
|
exit 0
|
|
fi
|
|
|
|
# search for users in system, returns first entry
|
|
FOUND_USR=`who | grep -o -m1 '^\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
|
|
# systemd
|
|
echo "---> stop init deamon: systemd"
|
|
CURRENT_SERVICE=$(systemctl list-units --all | { grep -o "hyperion*.*\.service" || true; })
|
|
if [ ! -z ${CURRENT_SERVICE} ]; then
|
|
$HYPERION_RUNNING && systemctl stop "${CURRENT_SERVICE}" 2> /dev/null
|
|
systemctl -q disable "${CURRENT_SERVICE}" 2> /dev/null
|
|
else
|
|
$HYPERION_RUNNING && systemctl stop hyperion hyperiond"@${FOUND_USR}" hyperion"@${FOUND_USR}" "hyperiond@root" "hyperion@root" 2> /dev/null
|
|
systemctl -q disable hyperion hyperiond"@${FOUND_USR}" hyperion"@${FOUND_USR}" "hyperiond@root" "hyperion@root" 2> /dev/null
|
|
fi
|
|
# disable user specific symlink
|
|
echo "---> Disable service and remove entry"
|
|
rm -v /etc/systemd/system/hyperion.service /etc/systemd/system/hyperiond@.service /etc/systemd/system/hyperion@.service 2> /dev/null
|
|
|
|
elif [ -e /sbin/initctl ]
|
|
then
|
|
# upstart
|
|
echo "---> stop init deamon: upstart"
|
|
$HYPERION_RUNNING && initctl stop hyperiond
|
|
$HYPERION_RUNNING && initctl stop hyperion
|
|
echo "---> Remove upstart service"
|
|
rm -v /etc/init/hyperion* 2>/dev/null
|
|
initctl reload-configuration
|
|
|
|
else
|
|
# sysV
|
|
echo "---> stop init deamon: sysV"
|
|
$HYPERION_RUNNING && service hyperiond stop 2> /dev/null
|
|
$HYPERION_RUNNING && service hyperion 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
|
|
|
|
# remove desktop/appstream file
|
|
rm -v /usr/share/applications/hyperion* 2> /dev/null
|
|
rm -v /usr/share/metainfo/hyperion* 2> /dev/null
|
|
|
|
# update desktop-database (if exists)
|
|
if [ -x /usr/bin/update-desktop-database ]; then
|
|
update-desktop-database -q /usr/share/applications
|
|
fi
|
|
|
|
# remove Hyperion icons
|
|
for i in 16x16 22x22 24x24 32x32 36x36 48x48 64x64 72x72 96x96 128x128 192x192 256x256 512x512; do
|
|
rm -v usr/share/icons/hicolor/$i/apps/hyperion.png 2> /dev/null
|
|
done
|
|
|
|
# update icon-cache
|
|
if [ -e /usr/share/icons/hicolor/icon-theme.cache ] ; then
|
|
# touch it, just in case we cannot find the binary...
|
|
touch --no-create /usr/share/icons/hicolor
|
|
if hash gtk-update-icon-cache 2>/dev/null; then
|
|
gtk-update-icon-cache /usr/share/icons/hicolor
|
|
fi
|
|
# ignore errors
|
|
true
|
|
fi
|
|
|
|
exit 0
|