Skip to content
This repository was archived by the owner on May 6, 2021. It is now read-only.

Commit 762eb60

Browse files
committed
Modified install script to support standard raspbian image
1 parent d8559d1 commit 762eb60

File tree

4 files changed

+85
-6
lines changed

4 files changed

+85
-6
lines changed

bin/copy_binaries_to_deploy.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@ tar --create --verbose --gzip --absolute-names --show-transformed-names \
1818
--transform "s:$builddir/bin/:hyperion/bin/:" \
1919
--transform "s:$repodir/effects/:hyperion/effects/:" \
2020
--transform "s:$repodir/config/:hyperion/config/:" \
21+
--transform "s:$repodir/bin/hyperion.init.sh:hyperion/init.d/hyperion.init.sh:" \
2122
--transform "s://:/:g" \
2223
"$builddir/bin/hyperiond" \
2324
"$builddir/bin/hyperion-remote" \
2425
"$builddir/bin/gpio2spi" \
2526
"$builddir/bin/dispmanx2png" \
2627
"$repodir/effects/"* \
28+
"$repodir/bin/hyperion.init.sh" \
2729
"$repodir/config/hyperion.config.json"

bin/hyperion.init.sh

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
#!/bin/bash
2+
# Hyperion daemon
3+
# description: Hyperion daemon
4+
# processname: hyperiond
5+
6+
DAEMON=hyperiond
7+
DAEMONOPTS="/etc/hyperion.config.json"
8+
DAEMON_PATH="/usr/bin"
9+
10+
NAME=$DEAMON
11+
DESC="Hyperion ambilight server"
12+
PIDFILE=/var/run/$NAME.pid
13+
SCRIPTNAME=/etc/init.d/$NAME
14+
15+
case "$1" in
16+
start)
17+
printf "%-50s" "Starting $NAME..."
18+
cd $DAEMON_PATH
19+
PID=`$DAEMON $DAEMONOPTS > /dev/null 2>&1 & echo $!`
20+
#echo "Saving PID" $PID " to " $PIDFILE
21+
if [ -z $PID ]; then
22+
printf "%s\n" "Fail"
23+
else
24+
echo $PID > $PIDFILE
25+
printf "%s\n" "Ok"
26+
fi
27+
;;
28+
status)
29+
printf "%-50s" "Checking $NAME..."
30+
if [ -f $PIDFILE ]; then
31+
PID=`cat $PIDFILE`
32+
if [ -z "`ps axf | grep ${PID} | grep -v grep`" ]; then
33+
printf "%s\n" "Process dead but pidfile exists"
34+
else
35+
echo "Running"
36+
fi
37+
else
38+
printf "%s\n" "Service not running"
39+
fi
40+
;;
41+
stop)
42+
printf "%-50s" "Stopping $NAME"
43+
PID=`cat $PIDFILE`
44+
cd $DAEMON_PATH
45+
if [ -f $PIDFILE ]; then
46+
kill -HUP $PID
47+
printf "%s\n" "Ok"
48+
rm -f $PIDFILE
49+
else
50+
printf "%s\n" "pidfile not found"
51+
fi
52+
;;
53+
54+
restart)
55+
$0 stop
56+
$0 start
57+
;;
58+
59+
*)
60+
echo "Usage: $0 {status|start|stop|restart}"
61+
exit 1
62+
esac

bin/install_hyperion.sh

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,12 @@
22

33
# Script for downloading and installing the latest Hyperion release
44

5-
# Find out if we are on XBian
5+
# Find out if we are on Raspbmc
66
IS_XBIAN=`cat /etc/issue | grep XBian | wc -l`
7+
IS_RASPBMC=`cat /etc/issue | grep Raspbmc | wc -l`
8+
9+
# check which init script we should use
10+
USE_INITCTL=`which /sbin/initctl | wc -l`
711

812
# Make sure that the boblight daemon is no longer running
913
BOBLIGHT_PROCNR=$(ps -e | grep "boblight" | wc -l)
@@ -24,19 +28,30 @@ ln -fs /opt/hyperion/bin/hyperiond /usr/bin/hyperiond
2428
ln -fs /opt/hyperion/bin/hyperion-remote /usr/bin/hyperion-remote
2529

2630
# create link to the gpio changer (gpio->spi)
27-
if [ $IS_XBIAN -eq 0 ]; then
31+
if [ $IS_RASPBMC -eq 1 ]; then
2832
ln -fs /opt/hyperion/bin/gpio2spi /usr/bin/gpio2spi
2933
fi
3034

3135
# Copy a link to the hyperion configuration file to /etc
3236
ln -s /opt/hyperion/config/hyperion.config.json /etc/hyperion.config.json
3337

3438
# Copy the service control configuration to /etc/int
35-
if [ $IS_XBIAN -eq 0 ]; then
36-
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
39+
if [ $USE_INITCTL -eq 1 ]; then
40+
if [ $IS_RASPBMC -eq 1 ]; then
41+
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
42+
else
43+
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
44+
fi
3745
else
38-
wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
46+
# place startup script in init.d and add it to upstart
47+
ln -fs /opt/hyperion/init.d/hyperion.init.sh /etc/hyperion/init.d/hyperion
48+
chmod +x /etc/init.d/hyperion
49+
update-rc.d hyperion defaults 98 02
3950
fi
4051

4152
# Start the hyperion daemon
42-
/sbin/initctl start hyperion
53+
if [ $USE_INITCTL -eq 1 ]; then
54+
/sbin/initctl start hyperion
55+
else
56+
/usr/sbin/service hyperion start
57+
fi

deploy/hyperion.tar.gz

396 KB
Binary file not shown.

0 commit comments

Comments
 (0)