Modified install script to support standard raspbian image

Former-commit-id: 762eb60ea6707c4dd23739260ca32e11db58c8c5
This commit is contained in:
johan 2014-01-04 14:12:33 +01:00
parent 9396583551
commit 035f049775
5 changed files with 86 additions and 6 deletions

View File

@ -18,10 +18,12 @@ tar --create --verbose --gzip --absolute-names --show-transformed-names \
--transform "s:$builddir/bin/:hyperion/bin/:" \
--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://:/:g" \
"$builddir/bin/hyperiond" \
"$builddir/bin/hyperion-remote" \
"$builddir/bin/gpio2spi" \
"$builddir/bin/dispmanx2png" \
"$repodir/effects/"* \
"$repodir/bin/hyperion.init.sh" \
"$repodir/config/hyperion.config.json"

62
bin/hyperion.init.sh Normal file
View File

@ -0,0 +1,62 @@
#!/bin/bash
# Hyperion daemon
# description: Hyperion daemon
# processname: hyperiond
DAEMON=hyperiond
DAEMONOPTS="/etc/hyperion.config.json"
DAEMON_PATH="/usr/bin"
NAME=$DEAMON
DESC="Hyperion ambilight server"
PIDFILE=/var/run/$NAME.pid
SCRIPTNAME=/etc/init.d/$NAME
case "$1" in
start)
printf "%-50s" "Starting $NAME..."
cd $DAEMON_PATH
PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
#echo "Saving PID" $PID " to " $PIDFILE
if [ -z $PID ]; then
printf "%s\n" "Fail"
else
echo $PID > $PIDFILE
printf "%s\n" "Ok"
fi
;;
status)
printf "%-50s" "Checking $NAME..."
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
printf "%s\n" "Process dead but pidfile exists"
else
echo "Running"
fi
else
printf "%s\n" "Service not running"
fi
;;
stop)
printf "%-50s" "Stopping $NAME"
PID=`cat $PIDFILE`
cd $DAEMON_PATH
if [ -f $PIDFILE ]; then
kill -HUP $PID
printf "%s\n" "Ok"
rm -f $PIDFILE
else
printf "%s\n" "pidfile not found"
fi
;;
restart)
$0 stop
$0 start
;;
*)
echo "Usage: $0 {status|start|stop|restart}"
exit 1
esac

View File

@ -2,8 +2,12 @@
# Script for downloading and installing the latest Hyperion release
# Find out if we are on XBian
# Find out if we are on Raspbmc
IS_XBIAN=`cat /etc/issue | grep XBian | wc -l`
IS_RASPBMC=`cat /etc/issue | grep Raspbmc | wc -l`
# check which init script we should use
USE_INITCTL=`which /sbin/initctl | wc -l`
# Make sure that the boblight daemon is no longer running
BOBLIGHT_PROCNR=$(ps -e | grep "boblight" | wc -l)
@ -24,7 +28,7 @@ ln -fs /opt/hyperion/bin/hyperiond /usr/bin/hyperiond
ln -fs /opt/hyperion/bin/hyperion-remote /usr/bin/hyperion-remote
# create link to the gpio changer (gpio->spi)
if [ $IS_XBIAN -eq 0 ]; then
if [ $IS_RASPBMC -eq 1 ]; then
ln -fs /opt/hyperion/bin/gpio2spi /usr/bin/gpio2spi
fi
@ -32,11 +36,22 @@ fi
ln -s /opt/hyperion/config/hyperion.config.json /etc/hyperion.config.json
# Copy the service control configuration to /etc/int
if [ $IS_XBIAN -eq 0 ]; then
if [ $USE_INITCTL -eq 1 ]; then
if [ $IS_RASPBMC -eq 1 ]; then
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
else
else
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
fi
else
# place startup script in init.d and add it to upstart
ln -fs /opt/hyperion/init.d/hyperion.init.sh /etc/hyperion/init.d/hyperion
chmod +x /etc/init.d/hyperion
update-rc.d hyperion defaults 98 02
fi
# Start the hyperion daemon
/sbin/initctl start hyperion
if [ $USE_INITCTL -eq 1 ]; then
/sbin/initctl start hyperion
else
/usr/sbin/service hyperion start
fi

Binary file not shown.

View File

@ -0,0 +1 @@
56066aa4faf396198264beccf090b9551b8359d4