mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Add the service files and new hyperion conf
Former-commit-id: 2083ce117791e6ad22037f91618af917fe99d40b
This commit is contained in:
@@ -24,6 +24,8 @@ tar --create --verbose --gzip --absolute-names --show-transformed-names --ignore
|
||||
--transform "s:$repodir/effects/:hyperion/effects/:" \
|
||||
--transform "s:$repodir/config/:hyperion/config/:" \
|
||||
--transform "s:$repodir/bin/hyperion.init.sh:hyperion/init.d/hyperion.init.sh:" \
|
||||
--transform "s:$repodir/bin/hyperion.systemd.sh:hyperion/init.d/hyperion.systemd.sh:" \
|
||||
--transform "s:$repodir/bin/hyperion.initctl.sh:hyperion/init.d/hyperion.initctl.sh:" \
|
||||
--transform "s://:/:g" \
|
||||
"$builddir/bin/hyperiond" \
|
||||
"$builddir/bin/hyperion-remote" \
|
||||
@@ -32,5 +34,7 @@ tar --create --verbose --gzip --absolute-names --show-transformed-names --ignore
|
||||
"$builddir/bin/dispmanx2png" \
|
||||
"$repodir/effects/"* \
|
||||
"$repodir/bin/hyperion.init.sh" \
|
||||
"$repodir/bin/hyperion.systemd.sh" \
|
||||
"$repodir/bin/hyperion.initctl.sh" \
|
||||
"$repodir/config/hyperion.config.json"
|
||||
|
||||
|
@@ -1,7 +1,16 @@
|
||||
#!/bin/bash
|
||||
# Hyperion daemon
|
||||
# Hyperion daemon service
|
||||
# description: Hyperion daemon
|
||||
# processname: hyperiond
|
||||
### BEGIN INIT INFO
|
||||
# Provides: Hyperion
|
||||
# Required-Start: $remote_fs $syslog
|
||||
# Required-Stop: $remote_fs $syslog
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Hyperion Ambilight init.d Service.
|
||||
# Description: Hyperion Ambilight init.d Service.
|
||||
### END INIT INFO
|
||||
|
||||
DAEMON=hyperiond
|
||||
DAEMONOPTS="/etc/hyperion.config.json"
|
||||
|
17
bin/hyperion.initctl.sh
Normal file
17
bin/hyperion.initctl.sh
Normal file
@@ -0,0 +1,17 @@
|
||||
## Hyperion daemon initctl script
|
||||
|
||||
description "hyperion"
|
||||
author "poljvd & tvdzwan"
|
||||
|
||||
start on (runlevel [2345])
|
||||
stop on (runlevel [!2345])
|
||||
|
||||
respawn
|
||||
|
||||
pre-start script
|
||||
#comment out the following 2 lines for x32/64
|
||||
modprobe spidev
|
||||
/usr/bin/gpio2spi
|
||||
end script
|
||||
|
||||
exec /usr/bin/hyperiond /etc/hyperion.config.json
|
15
bin/hyperion.systemd.sh
Normal file
15
bin/hyperion.systemd.sh
Normal file
@@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Hyperion Systemd service
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
User=root
|
||||
Group=root
|
||||
UMask=007
|
||||
ExecStart=/opt/hyperion/bin/hyperiond /etc/hyperion.config.json
|
||||
ExecReload=/bin/kill -HUP $MAINPID
|
||||
Restart=on-failure
|
||||
TimeoutStopSec=10
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
105
bin/remove_hyperion.sh
Normal file
105
bin/remove_hyperion.sh
Normal file
@@ -0,0 +1,105 @@
|
||||
#!/bin/sh
|
||||
# Script to remove Hyperion and all services
|
||||
|
||||
# Make sure /sbin is on the path (for service to find sub scripts)
|
||||
PATH="/sbin:$PATH"
|
||||
|
||||
#Check if HyperCon is logged in as root
|
||||
if [ $(id -u) != 0 ] && [ "$1" = "HyperConRemove" ]; then
|
||||
echo '---> Critical Error: Please connect as user "root" through HyperCon'
|
||||
echo '---> We need admin privileges to remove your Hyperion! -> abort'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Check, if script is running as root
|
||||
if [ $(id -u) != 0 ]; then
|
||||
echo '---> Critical Error: Please run the script as root (sudo sh ./remove_hyperion.sh)'
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#Welcome message
|
||||
echo '*******************************************************************************'
|
||||
echo 'This script will remove Hyperion and it<69>s services'
|
||||
echo '-----> Please BACKUP your hyperion.config.json if necessary <-----'
|
||||
echo '*******************************************************************************'
|
||||
|
||||
#Skip the prompt if HyperCon Remove
|
||||
if [ "$1" = "" ]; then
|
||||
#Prompt for confirmation to proceed
|
||||
while true
|
||||
do
|
||||
echo -n "---> Do you really want to remove Hyperion and it<69>s services? (y or n) :"
|
||||
read CONFIRM
|
||||
case $CONFIRM in
|
||||
y|Y|YES|yes|Yes) break ;;
|
||||
n|N|no|NO|No)
|
||||
echo "---> Aborting - you entered \"$CONFIRM\""
|
||||
exit
|
||||
;;
|
||||
*) echo "-> Please enter only y or n"
|
||||
esac
|
||||
done
|
||||
echo "---> You entered \"$CONFIRM\". Remove Hyperion!"
|
||||
fi
|
||||
# Find out if we are on OpenElec
|
||||
OS_OPENELEC=`grep -m1 -c OpenELEC /etc/issue`
|
||||
|
||||
# check which init script we should use
|
||||
USE_SYSTEMD=`grep -m1 -c systemd /proc/1/comm`
|
||||
USE_INITCTL=`which /sbin/initctl | wc -l`
|
||||
USE_SERVICE=`which /usr/sbin/service | wc -l`
|
||||
|
||||
# Stop hyperion daemon if it is running
|
||||
echo '---> Stop Hyperion, if necessary'
|
||||
if [ $OS_OPENELEC -eq 1 ]; then
|
||||
killall hyperiond 2>/dev/null
|
||||
elif [ $USE_INITCTL -eq 1 ]; then
|
||||
/sbin/initctl stop hyperion 2>/dev/null
|
||||
elif [ $USE_SERVICE -eq 1 ]; then
|
||||
/usr/sbin/service hyperion stop 2>/dev/null
|
||||
elif [ $USE_SYSTEMD -eq 1 ]; then
|
||||
service hyperion stop 2>/dev/null
|
||||
fi
|
||||
|
||||
#Disabling and delete service files
|
||||
if [ $USE_INITCTL -eq 1 ]; then
|
||||
echo '---> Delete and disable Hyperion initctl script'
|
||||
rm -v /etc/init/hyperion 2>/dev/null
|
||||
initctl reload-configuration
|
||||
elif [ $OS_OPENELEC -eq 1 ]; then
|
||||
# Remove Hyperion from OpenELEC autostart.sh
|
||||
echo "---> Remove Hyperion from OpenELEC autostart.sh"
|
||||
sed -i "/hyperiond/d" /storage/.config/autostart.sh 2>/dev/null
|
||||
elif [ $USE_SYSTEMD -eq 1 ]; then
|
||||
# Delete and disable Hyperion systemd script
|
||||
echo '---> Delete and disable Hyperion systemd script'
|
||||
systemctl disable hyperion.service
|
||||
rm -v /etc/systemd/system/hyperion.service 2>/dev/null
|
||||
elif [ $USE_SERVICE -eq 1 ]; then
|
||||
# Delete and disable Hyperion init.d script
|
||||
echo '---> Delete and disable Hyperion init.d script'
|
||||
update-rc.d -f hyperion remove
|
||||
rm /etc/init.d/hyperion 2>/dev/null
|
||||
fi
|
||||
|
||||
# Delete Hyperion binaries
|
||||
if [ $OS_OPENELEC -eq 1 ]; then
|
||||
# Remove OpenELEC Hyperion binaries and configs
|
||||
echo '---> Remove the OpenELEC Hyperion binaries and hyperion.config.json'
|
||||
rm -rv /storage/hyperion 2>/dev/null
|
||||
rm -v /storage/.config/hyperion.config.json 2>/dev/null
|
||||
else
|
||||
#Remove binaries on all distributions/systems (not OpenELEC)
|
||||
echo "---> Remove links to the binaries"
|
||||
rm -v /usr/bin/hyperiond 2>/dev/null
|
||||
rm -v /usr/bin/hyperion-remote 2>/dev/null
|
||||
rm -v /usr/bin/hyperion-v4l2 2>/dev/null
|
||||
rm -v /etc/hyperion.config.json 2>/dev/null
|
||||
echo "---> Remove binaries"
|
||||
rm -rv /opt/hyperion 2>/dev/null
|
||||
fi
|
||||
echo '*******************************************************************************'
|
||||
echo 'Hyperion successful removed!'
|
||||
echo '*******************************************************************************'
|
||||
exit 0
|
||||
|
Reference in New Issue
Block a user