-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.sh
executable file
·116 lines (101 loc) · 2.65 KB
/
setup.sh
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
source 'lib/apt-lib.sh'
runAptGetUpdate
installAptPackages libtool libusb-dev librtlsdr-dev rtl-sdr build-essential autoconf cmake pkg-config mosquitto git ruby rtl-433
if [ $? -eq 0 ]; then
echo "Tools &dependancies installed"
else
echo "Failed to install apt dependancies"
fi
function install_rtl_433() {
if [ ! -d rtl_433 ]; then
git clone https://github.com/merbanan/rtl_433.git
fi
cd rtl_433
if [ ! -d build ]; then
mkdir build
fi
pushd .
cd build
cmake ../
if [ $? -eq 1 ]; then
echo "cmake failed - debug that"
exit 1
fi
make
if [ $? -eq 1 ]; then
echo "make failed - debug that"
exit 1
fi
sudo make install
if [ $? -eq 1 ]; then
echo "make install failed - debug that"
exit 1
else
echo "rtl_433 tools installed into /usr/local/"
fi
popd
if [ ! -f /etc/modprobe.d/blacklist-rtl.conf ]; then
echo "blacklist dvb_usb_rtl28xxu" | sudo tee -a /etc/modprobe.d/blacklist-rtl.conf
echo "blacklist file added - you need to reboot later"
fi
}
if have_command rtl_433; then
if [ "$1" == "--source" ]; then
echo "install from source requested"
install_rtl_433
else
echo "rtl_433 detected - skipping install"
fi
else
echo "rtl_433 not detected - attempting installing from source"
install_rtl_433
fi
if [ ! -f Gemfile.lock ]; then
if have_command bundle; then
setup_and_run_bundle
if [ $? -eq 0 ]; then
echo "bundle success"
else
echo "BUNDLE INSTALL FAILED"
echo "debug and try again"
exit 1
fi
else
if have_command gem; then
sudo gem install bundler
if bundle; then
echo "bundle success"
else
echo "Unabled to bundle"
exit 1
fi
else
echo "ERROR: missing gem command needed to install bundler"
exit 1
fi
fi
fi
echo "install completed"
sleep 0.2
crontab -l | grep tmux-launch > /dev/null 2>&1
if [ $? -eq 0 ]; then
info "tmux-launch.sh already setup in crontab"
else
echo "#### HINT ###################################"; sleep 0.2
echo "# Setup the following for autolaunch after #";
echo "# a reboot by adding the following line to #";
echo "# your crontab using: crontab -e #"; sleep 0.2
info " @reboot ${PWD}/tmux-launch.sh"
echo "#############################################"; sleep 0.2
echo
sleep 0.2
fi
echo "setup.sh completed"; sleep 0.5
echo "#### NOTE ################################### "; sleep 0.2
echo " If this is the first time setup you will "
echo " need to reboot your computer."
echo ; sleep 0.2
echo " hint: Just type 'reboot' now"; sleep 0.2
echo "############################################# "
sleep 1