-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·266 lines (194 loc) · 6.54 KB
/
install.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
#!/bin/sh
# Switch Chromium Hardware Acceleration Off
chromeHardwareAccelerationOff()
{
CONFIG_FILE="/home/pi/.config/chromium/Local State"
TMP=`/usr/bin/grep '"hardware_acceleration_mode":{"enabled":true}' "$CONFIG_FILE"`
if [ ! -z "$TMP" ]; then
echo "Switching Hardware Acceleration OFF for Chromium"
/usr/bin/sed 's/\"hardware_acceleration_mode\"\:{\"enabled\"\:true}/\"hardware_acceleration_mode\"\:{\"enabled\"\:false}/' "$CONFIG_FILE" > "$CONFIG_FILE".tmp
/usr/bin/cat "$CONFIG_FILE".tmp > "$CONFIG_FILE"
/usr/bin/rm -f "$CONFIG_FILE".tmp
fi
}
# Switch OS Upgrade Notifications Off
osUpgradeNotificationsOff()
{
LXDE_PANEL_OLD="/etc/xdg/lxpanel/LXDE-pi/panels/panel"
LXDE_PANEL_NEW="/home/pi/astrid/install/lxde-panel"
TMP=`/usr/bin/grep "type=updater" "$LXDE_PANEL_OLD"`
if [ ! -z "$TMP" ]; then
echo "Switching OS Upgrade Notifications OFF"
sudo sh -c "/usr/bin/cat \"$LXDE_PANEL_NEW\" > \"$LXDE_PANEL_OLD\""
fi
}
# Switch Auto Launch File Manager when USB Flash Drive Inserted Off
fileManagerAutoLaunchOff()
{
LXDE_PCMANFM_BKP="/home/pi/.config/pcmanfm/LXDE-pi/pcmanfm.conf~"
LXDE_PCMANFM_NEW="/home/pi/.config/pcmanfm/LXDE-pi/pcmanfm.conf"
TMP=`/usr/bin/grep "autorun=1" "$LXDE_PCMANFM_NEW"`
if [ ! -z "$TMP" ]; then
echo "Switching File Manager USB Drive Auto Launch OFF"
/usr/bin/sed 's/autorun=1/autorun=0/' "$LXDE_PCMANFM_NEW" > "$LXDE_PCMANFM_BKP"
/usr/bin/mv "$LXDE_PCMANFM_BKP" "$LXDE_PCMANFM_NEW"
fi
}
# Install healpix
installHealpix()
{
TMP=`/usr/bin/pip3 list | /usr/bin/grep cdshealpix`
if [ -z "$TMP" ];then
echo "Installing cdshealpix"
/usr/bin/pip3 install cdshealpix==0.6.4
fi
}
# Install pyqtree
installPyqtree()
{
TMP=`/usr/bin/pip3 list | /usr/bin/grep Pyqtree`
if [ -z "$TMP" ];then
echo "Installing pyqtree"
/usr/bin/pip3 install pyqtree==1.0.0
fi
}
# Install openpyxl
installOpenpyxl()
{
TMP=`/usr/bin/pip3 list | /usr/bin/grep openpyxl`
if [ -z "$TMP" ];then
echo "Installing openpyxl"
/usr/bin/pip3 install openpyxl==3.1.2
fi
}
# Install kmeans1d
installKmeans1d()
{
TMP=`/usr/bin/pip3 list | /usr/bin/grep kmeans1d`
if [ -z "$TMP" ];then
echo "Installing kmeans1d"
/usr/bin/pip3 install kmeans1d==0.3.1
fi
}
# Install adafruit-board-toolkit
installAdafruitBoardToolkit()
{
TMP=`/usr/bin/pip3 list | /usr/bin/grep adafruit-board-toolkit`
if [ -z "$TMP" ];then
echo "Installing adafruit-board-toolkit"
/usr/bin/pip3 install adafruit-board-toolkit==1.1.1
fi
}
# Install QCharts
installQCharts()
{
TMP=`/usr/bin/apt list --installed | /usr/bin/grep python3-pyqt5.qtchart`
if [ -z "$TMP" ];then
echo "Installing QCharts"
/usr/bin/sudo /usr/bin/apt-get install -y python3-pyqt5.qtchart
fi
}
# Install lsscsi
installLsScsi()
{
TMP=`/usr/bin/apt list --installed | /usr/bin/grep lsscsi`
if [ -z "$TMP" ];then
echo "Installing lsscsi"
/usr/bin/sudo /usr/bin/apt-get install -y lsscsi
fi
}
# Install mdio-tool
installMdioTool()
{
if [ ! -f /usr/local/bin/mdio-tool ];then
echo "Installing mdio-tool"
cd /home/pi
/usr/bin/git clone https://www.github.com/ChasinSpin/mdio-tool
cd mdio-tool
/usr/bin/mkdir build-dir
cd build-dir
/usr/bin/cmake ..
/usr/bin/make
/usr/bin/sudo /usr/bin/make install
/usr/bin/make clean
cd ..
/usr/bin/rm -rf build-dir
fi
}
# Install Autohotspot Setup
installAutoHotspot()
{
echo "Installing autohotspot changes"
/usr/bin/cp /home/pi/astrid/scripts/autohotspot-setup.sh /home/pi/Autohotspot/autohotspot-setup.sh
/usr/bin/cp /home/pi/astrid/scripts/autohotspot-direct.service /home/pi/Autohotspot/config/autohotspot-direct.service
/usr/bin/cp /home/pi/astrid/scripts/Checklist.md5 /home/pi/Autohotspot/config/Checklist.md5
sudo /usr/bin/cp /home/pi/astrid/scripts/autohotspot /usr/bin/autohotspot
sudo /usr/bin/cp /home/pi/Autohotspot/config/autohotspot-direct.service /etc/systemd/system/autohotspot.service
sudo systemctl daemon-reload
}
# Install a service, arguments = serviceFile serviceName
installService()
{
sudo /usr/bin/cp $1 /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable $2
sudo systemctl start $2
# sudo systemctl status $2 # This launches journal which uses standard input and works like "more" requiring keyboard entry... Don't use
}
# Remove AutoHotspot Crontab
autoHotspotCrontabRemove()
{
/usr/bin/crontab -l | /usr/bin/sed '/autohotspot/d' | /usr/bin/crontab -
}
ASTRID_FOLDER="/home/pi/astrid"
APP_FOLDER="$ASTRID_FOLDER/app"
OTESTAMPER_FOLDER="$ASTRID_FOLDER/OTEStamper"
echo "Updating desktop icons..."
/usr/bin/rm -rf /home/pi/Desktop/*
/usr/bin/mkdir "/home/pi/Desktop/Astrid Tools"
/usr/bin/ln -s /home/pi/astrid/desktop/AstridApp.desktop /home/pi/Desktop
/usr/bin/ln -s /home/pi/astrid/desktop/Player.desktop /home/pi/Desktop
/usr/bin/ln -s /home/pi/astrid/desktop/WifiConnect.desktop /home/pi/Desktop
/usr/bin/ln -s /home/pi/astrid/desktop/Shutdown.desktop /home/pi/Desktop
/usr/bin/ln -s /home/pi/astrid/desktop/WifiSetup.desktop "/home/pi/Desktop/Astrid Tools"
/usr/bin/ln -s /home/pi/astrid/desktop/AstridUpgrade.desktop "/home/pi/Desktop/Astrid Tools"
/usr/bin/ln -s /home/pi/astrid/desktop/TerminateAstridThreads.desktop "/home/pi/Desktop/Astrid Tools"
/usr/bin/ln -s /home/pi/astrid/desktop/FormatUSBFlashDrive.desktop "/home/pi/Desktop/Astrid Tools"
/usr/bin/ln -s /home/pi/astrid/desktop/Diagnostics.desktop "/home/pi/Desktop/Astrid Tools"
/usr/bin/ln -s /home/pi/astrid/desktop/InstallMiniDisplay.desktop "/home/pi/Desktop/Astrid Tools"
/usr/bin/ln -s /home/pi/astrid/desktop/QualifyDrive.desktop "/home/pi/Desktop/Astrid Tools"
/usr/bin/ln -s /home/pi/astrid/desktop/LightsOut.desktop "/home/pi/Desktop/Astrid Tools"
echo "Installing ravf..."
pip install --no-deps ravf
echo "Making ospi..."
cd $APP_FOLDER
./make-ospi.sh
echo "Making oteutils..."
cd "$APP_FOLDER"
./make_oteutils.sh
chromeHardwareAccelerationOff
osUpgradeNotificationsOff
fileManagerAutoLaunchOff
installHealpix
installPyqtree
installQCharts
installOpenpyxl
installKmeans1d
installAdafruitBoardToolkit
installMdioTool
installAutoHotspot
installLsScsi
echo "Installing firmware..."
cd "$OTESTAMPER_FOLDER/firmware"
/usr/bin/make clean
/usr/bin/make writefuses
/usr/bin/make install
/usr/bin/make clean
echo "Installing services..."
installService /home/pi/astrid/services/astrid-monitor.service astrid-monitor
installService /home/pi/astrid/services/wlan0-powermgmt-off.service wlan0-powermgmt-off
autoHotspotCrontabRemove
echo
echo "** Updated Astrid to version: "`/usr/bin/cat ~/astrid/version.txt`" **"
echo
exit 0