-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup-homebridge
executable file
·48 lines (37 loc) · 1.47 KB
/
setup-homebridge
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env awesome-bash
# vim: ft=sh:
awesome_shell_help <<_HELP_
Usage: $awesome_shell_script_name [-h|--help]
_HELP_
#awesome-shell ref:e9301cc
awesome_shell_include password
if [ "$1" = "--install-gcc-6.1.0" ];then
git clone https://bitbucket.org/sol_prog/raspberry-pi-gcc-6.1.0-binary
cd raspberry-pi-gcc-6.1.0-binary/
fatal_if_any_error 'cannot enter cloned dir'
7z e gcc-6.1.0.tar.7z
tar -xf gcc-6.1.0.tar
sudo mv gcc-6.1.0 /usr/local/gcc-6.1.0
cd ~
fatal_if_any_error 'cannot cd into home'
rm -rf raspberry-pi-gcc-6.1.0-binar
# todo link gcc binary or use alternatives
fi;
sudo apt-get update
sudo apt-get install -y p7zip-full libavahi-compat-libdnssd-dev screen
source setup-nodejs.bash
sudo npm install -g --unsafe-perm homebridge hap-nodejs node-gyp
cd /usr/local/lib/node_modules/
fatal_if_any_error 'cannot cd into node_modules'
sudo npm install --unsafe-perm bignum
cd /usr/local/lib/node_modules/hap-nodejs/node_modules/mdns
fatal_if_any_error 'cannot cd into mdns'
sudo node-gyp BUILDTYPE=Release rebuild
ask_to_confirm 'Install LiFx?' && sudo npm install --unsafe-perm -g homebridge-lifx-lan
conf_dir="$HOME/.homebridge"
if [ -f "$awesome_shell_script_dir/homebridge-example.config.json" ];then
ask_to_confirm 'Copy example config?' && sudo mkdir -p "$conf_dir" && \
sudo cp "$awesome_shell_script_dir/homebridge-example.config.json" "$conf_dir/config.json"
verbose_exit_code "Copied example config..."
fi;
header 'Done'