|
5 | 5 | # Find out if we are on Raspbmc
|
6 | 6 | IS_XBIAN=`cat /etc/issue | grep XBian | wc -l`
|
7 | 7 | IS_RASPBMC=`cat /etc/issue | grep Raspbmc | wc -l`
|
| 8 | +IS_OPENELEC=`cat /etc/issue | grep -m 1 OpenELEC | wc -l` |
8 | 9 |
|
9 | 10 | # check which init script we should use
|
10 | 11 | USE_INITCTL=`which /sbin/initctl | wc -l`
|
| 12 | +USE_SERVICE=`which /usr/sbin/service | wc -l` |
11 | 13 |
|
12 | 14 | # Make sure that the boblight daemon is no longer running
|
13 |
| -BOBLIGHT_PROCNR=$(ps -e | grep "boblight" | wc -l) |
| 15 | +BOBLIGHT_PROCNR=$(pidof boblightd | wc -l) |
14 | 16 | if [ $BOBLIGHT_PROCNR -eq 1 ];
|
15 | 17 | then
|
16 | 18 | echo 'Found running instance of boblight. Please stop boblight via XBMC menu before installing hyperion'
|
|
21 | 23 | # Start the hyperion daemon
|
22 | 24 | if [ $USE_INITCTL -eq 1 ]; then
|
23 | 25 | /sbin/initctl stop hyperion
|
24 |
| -else |
| 26 | +elif [ $USE_SERVICE -eq 1 ]; then |
25 | 27 | /usr/sbin/service hyperion stop
|
26 | 28 | fi
|
27 | 29 |
|
28 |
| -# Get and extract the Hyperion binaries and effects to /opt |
29 |
| -wget https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz |
| 30 | +# Get and extract the Hyperion binaries and effects |
| 31 | +echo 'Downloading hyperion' |
| 32 | +if [ $IS_OPENELEC -eq 1 ]; then |
| 33 | + # OpenELEC has a readonly file system. Use alternative location |
| 34 | + curl --get https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz | tar -C /storage -xz |
| 35 | + curl --get https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.deps.openelec-rpi.tar.gz | tar -C /storage/hyperion/bin -xz |
| 36 | + |
| 37 | + # modify the default config to have a correct effect path |
| 38 | + sed -i 's:/opt:/storage:g' /storage/hyperion/config/hyperion.config.json |
| 39 | +else |
| 40 | + wget https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.tar.gz -O - | tar -C /opt -xz |
| 41 | +fi |
30 | 42 |
|
31 | 43 | # create links to the binaries
|
32 |
| -ln -fs /opt/hyperion/bin/hyperiond /usr/bin/hyperiond |
33 |
| -ln -fs /opt/hyperion/bin/hyperion-remote /usr/bin/hyperion-remote |
| 44 | +if [ $IS_OPENELEC -ne 1 ]; then |
| 45 | + ln -fs /opt/hyperion/bin/hyperiond /usr/bin/hyperiond |
| 46 | + ln -fs /opt/hyperion/bin/hyperion-remote /usr/bin/hyperion-remote |
| 47 | +fi |
34 | 48 |
|
35 | 49 | # create link to the gpio changer (gpio->spi)
|
36 | 50 | if [ $IS_RASPBMC -eq 1 ]; then
|
37 | 51 | ln -fs /opt/hyperion/bin/gpio2spi /usr/bin/gpio2spi
|
38 | 52 | fi
|
39 | 53 |
|
40 | 54 | # Copy a link to the hyperion configuration file to /etc
|
41 |
| -ln -s /opt/hyperion/config/hyperion.config.json /etc/hyperion.config.json |
| 55 | +if [ $IS_OPENELEC -eq 1 ]; then |
| 56 | + # copy to alternate location, because of readonly file system |
| 57 | + # /storage/.config is available as samba share. A symbolic link would not be working |
| 58 | + false | cp -i /storage/hyperion/config/hyperion.config.json /storage/.config/hyperion.config.json 2>/dev/null |
| 59 | +else |
| 60 | + ln -s /opt/hyperion/config/hyperion.config.json /etc/hyperion.config.json |
| 61 | +fi |
| 62 | + |
42 | 63 |
|
43 | 64 | # Copy the service control configuration to /etc/int
|
44 | 65 | if [ $USE_INITCTL -eq 1 ]; then
|
| 66 | + echo 'Installing initctl script' |
45 | 67 | if [ $IS_RASPBMC -eq 1 ]; then
|
46 | 68 | wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.conf -P /etc/init/
|
47 | 69 | else
|
48 | 70 | wget -N https://raw.github.com/tvdzwan/hyperion/master/deploy/hyperion.xbian.conf -O /etc/init/hyperion.conf
|
49 | 71 | fi
|
50 |
| -else |
| 72 | +elif [ $USE_SERVICE -eq 1 ]; then |
| 73 | + echo 'Installing startup script in init.d' |
51 | 74 | # place startup script in init.d and add it to upstart
|
52 | 75 | ln -fs /opt/hyperion/init.d/hyperion.init.sh /etc/init.d/hyperion
|
53 | 76 | chmod +x /etc/init.d/hyperion
|
54 | 77 | update-rc.d hyperion defaults 98 02
|
| 78 | +elif [ $IS_OPENELEC -eq 1 ]; then |
| 79 | + # only add to start script if hyperion is not present yet |
| 80 | + if [ `cat /storage/.config/autostart.sh 2>/dev/null | grep hyperiond | wc -l` -eq 0 ]; then |
| 81 | + echo 'Adding Hyperion to autostart script' |
| 82 | + echo "/storage/hyperion/bin/hyperiond.sh /storage/.config/hyperion.config.json > /dev/null 2>&1 &" >> /storage/.config/autostart.sh |
| 83 | + chmod +x /storage/.config/autostart.sh |
| 84 | + fi |
55 | 85 | fi
|
56 | 86 |
|
57 | 87 | # Start the hyperion daemon
|
58 | 88 | if [ $USE_INITCTL -eq 1 ]; then
|
59 | 89 | /sbin/initctl start hyperion
|
60 |
| -else |
| 90 | +elif [ $USE_SERVICE -eq 1 ]; then |
61 | 91 | /usr/sbin/service hyperion start
|
62 | 92 | fi
|
0 commit comments