diff --git a/bin/copy_binaries_to_deploy.sh b/bin/copy_binaries_to_deploy.sh index f81ebbed..c2783c0c 100755 --- a/bin/copy_binaries_to_deploy.sh +++ b/bin/copy_binaries_to_deploy.sh @@ -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" diff --git a/bin/hyperion.init.sh b/bin/hyperion.init.sh new file mode 100644 index 00000000..50e7d7f8 --- /dev/null +++ b/bin/hyperion.init.sh @@ -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 diff --git a/bin/install_hyperion.sh b/bin/install_hyperion.sh index 09ecb6c5..78805721 100755 --- a/bin/install_hyperion.sh +++ b/bin/install_hyperion.sh @@ -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 - wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/ +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 + wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf + fi else - wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf + # 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 diff --git a/deploy/hyperion.tar.gz b/deploy/hyperion.tar.gz deleted file mode 100644 index 39e9e46b..00000000 Binary files a/deploy/hyperion.tar.gz and /dev/null differ diff --git a/deploy/hyperion.tar.gz.REMOVED.git-id b/deploy/hyperion.tar.gz.REMOVED.git-id new file mode 100644 index 00000000..be713fa4 --- /dev/null +++ b/deploy/hyperion.tar.gz.REMOVED.git-id @@ -0,0 +1 @@ +56066aa4faf396198264beccf090b9551b8359d4 \ No newline at end of file