-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup.sh
executable file
·330 lines (290 loc) · 11.2 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
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
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
#!/usr/bin/bash
# This shell scripts sets up the t-watch application
# python modules and images are uploaded to the t-watch
# Demo program for the course on the Internet of Things (IoT) at the
# University of Cape Coast (Ghana)
# Copyright (c) U. Raich April 2020
# This program is released under the MIT license
echo "Setting up the file system for the t-watch program"
dirs="$(ampy ls)"
echo $dirs
#
# check if /lib already exists, create it if not
#
if [[ $dirs == *"/lib"* ]]
then
echo "/lib directory already exists"
else
echo "Creating /lib directory"
ampy mkdir /lib
fi
if [[ $dirs == *"/gui"* ]]
then
echo "/gui directory already exists"
else
echo "Creating /gui directory"
ampy mkdir /gui
fi
echo "Uploading the constants"
ampy put src/constants.py constants.py
echo "-----------------------------"
echo "Uploading python code to /gui"
echo "-----------------------------"
echo "Uploading src/gui/app.py"
ampy put src/gui/app.py /gui/app.py
echo "Uploading src/gui/gui.py"
ampy put src/gui/gui.py /gui/gui.py
echo "Uploading src/gui/splashscreen.py"
ampy put src/gui/splashscreen.py /gui/splashscreen.py
echo "Uploading src/gui/statusbar.py"
ampy put src/gui/statusbar.py /gui/statusbar.py
echo "Uploading src/gui/__init__.py"
ampy put src/gui/__init__.py /gui/__init__.py
if [[ $dirs == *"/app"* ]]
then
echo "/app directory already exists"
else
echo "Creating /app directory"
ampy mkdir /app
fi
#
# check if the /images folder exists, create it if not
#
if [[ $dirs == *"/images"* ]]
then
echo "/images directory already exists"
images="$(ampy ls /images)"
else
echo "Creating /images directory"
ampy mkdir /images
images=""
fi
#
# check it images have already been uploaded, upload them if not
#
if echo $images | grep -w "hedgehog143x81_argb565.bin" > /dev/null ; then
echo "hedgehog143x81_argb565.bin has already been uploaded"
else
echo "Uploading hedgehog143x81_argb565.bin"
ampy put src/images/hedgehog143x81_argb565.bin /images/hedgehog143x81_argb565.bin
fi
#
# wallpapers
#
echo "uploading wallpapers"
if echo $images | grep -w "bg1_240px_rgb565.bin" > /dev/null ; then
echo "bg1_240px_rgb565.bin has already been uploaded"
else
echo "Uploading bg1_240px_rgb565.bin"
ampy put src/images/bg1_240px_rgb565.bin /images/bg1_240px_rgb565.bin
fi
if echo $images | grep -w "bg2_240px_rgb565.bin" > /dev/null ; then
echo "bg2_240px_rgb565.bin has already been uploaded"
else
echo "Uploading bg2_240px_rgb565.bin"
ampy put src/images/bg2_240px_rgb565.bin /images/bg2_240px_rgb565.bin
fi
if echo $images | grep -w "bg3_240px_rgb565.bin" > /dev/null ; then
echo "bg3_240px_rgb565.bin has already been uploaded"
else
echo "Uploading bg3_240px_rgb565.bin"
ampy put src/images/bg3_240px_rgb565.bin /images/bg3_240px_rgb565.bin
fi
echo "---------------------------"
echo "uploading application icons"
echo "---------------------------"
if echo $images | grep -w "message_64px_argb565.bin" > /dev/null ; then
echo "message_64pxargb565.bin has already been uploaded"
else
echo "Uploading message_argb565.bin"
ampy put src/images/message_64px_argb565.bin /images/message_64px_argb565.bin
fi
if echo $images | grep -w "weather_64px_argb565.bin" > /dev/null ; then
echo "weather_64px_argb565.bin has already been uploaded"
else
echo "Uploading weather_argb565.bin"
ampy put src/images/weather_64px_argb565.bin /images/weather_64px_argb565.bin
fi
if echo $images | grep -w "mondaine_clock_64px_argb565.bin" > /dev/null ; then
echo "mondaine_clock_64px_argb565.bin has already been uploaded"
else
echo "Uploading mondaine_clock_64px_argb565.bin"
ampy put src/images/mondaine_clock_64px_argb565.bin /images/mondaine_clock_64px_argb565.bin
fi
if echo $images | grep -w "stopwatch_64px_argb565.bin" > /dev/null ; then
echo "stopwatch_64px_argb565.bin has already been uploaded"
else
echo "Uploading stopwatch_64px_argb565.bin"
ampy put src/images/stopwatch_64px_argb565.bin /images/stopwatch_64px_argb565.bin
fi
if echo $images | grep -w "alarm_clock_64px_argb565.bin" > /dev/null ; then
echo "alarm_clock_64px_argb565.bin has already been uploaded"
else
echo "Uploading alarm_clock_64px_argb565.bin"
ampy put src/images/alarm_clock_64px_argb565.bin /images/alarm_clock_64px_argb565.bin
fi
if echo $images | grep -w "calendar_64px_argb565.bin" > /dev/null ; then
echo "calendar_64px_argb565.bin has already been uploaded"
else
echo "Uploading calendar_64px_argb565.bin"
ampy put src/images/calendar_64px_argb565.bin /images/calendar_64px_argb565.bin
fi
if echo $images | grep -w "powermeter_64px_argb565.bin" > /dev/null ; then
echo "powermeter_argb565.bin has already been uploaded"
else
echo "Uploading powermeter_64px_argb565.bin"
ampy put src/images/powermeter_64px_argb565.bin /images/powermeter_64px_argb565.bin
fi
if echo $images | grep -w "calculator_64px_argb565.bin" > /dev/null ; then
echo "calculator_64px_argb565.bin has already been uploaded"
else
echo "Uploading calculator_64px_argb565.bin"
ampy put src/images/calculator_64px_argb565.bin /images/calculator_64px_argb565.bin
fi
if echo $images | grep -w "status_64px_argb565.bin" > /dev/null ; then
echo "status_64px_argb565.bin has already been uploaded"
else
echo "Uploading status_64px_argb565.bin"
ampy put src/images/status_64px_argb565.bin /images/status_64px_argb565.bin
fi
echo "---------------------"
echo "uploading setup icons"
echo "---------------------"
if echo $images | grep -w "battery_icon_64px_argb565.bin" > /dev/null ; then
echo "battery_icon_65px_argb565.bin has already been uploaded"
else
echo "Uploading battery_icon_64px_argb565.bin"
ampy put src/images/battery_icon_64px_argb565.bin /images/battery_icon_64px_argb565.bin
fi
if echo $images | grep -w "brightness_64px_argb565.bin" > /dev/null ; then
echo "brightness_64px_argb565.bin has already been uploaded"
else
echo "Uploading brightness_64px_argb565.bin"
ampy put src/images/brightness_64px_argb565.bin images/brightness_64px_argb565.bin
fi
if echo $images | grep -w "move_64px_argb565.bin" > /dev/null ; then
echo "move_64px_argb565.bin has already been uploaded"
else
echo "Uploading move_64px_argb565.bin"
ampy put src/images/move_64px_argb565.bin images/move_64px_argb565.bin
fi
if echo $images | grep -w "wifi_64px_argb565.bin" > /dev/null ; then
echo "wifi_64px_argb565.bin has already been uploaded"
else
echo "Uploading wifi_64px_argb565.bin"
ampy put src/images/wifi_64px_argb565.bin images/wifi_64px_argb565.bin
fi
if echo $images | grep -w "bluetooth_64px_argb565.bin" > /dev/null ; then
echo "bluetooth_64_px_argb565.bin has already been uploaded"
else
echo "Uploading bluetooth_argb565.bin"
ampy put src/images/bluetooth_64px_argb565.bin images/bluetooth_64px_argb565.bin
fi
if echo $images | grep -w "time_64px_argb565.bin" > /dev/null ; then
echo "time_64px_argb565.bin has already been uploaded"
else
echo "Uploading time_64px_argb565.bin"
ampy put src/images/time_64px_argb565.bin images/time_64px_argb565.bin
fi
if echo $images | grep -w "update_64px_argb565.bin" > /dev/null ; then
echo "update_64px_argb565.bin has already been uploaded"
else
echo "Uploading update_64px_argb565.bin"
ampy put src/images/update_64px_argb565.bin images/update_64px_argb565.bin
fi
if echo $images | grep -w "utilities_64px_argb565.bin" > /dev/null ; then
echo "utilities_64px_argb565.bin has already been uploaded"
else
echo "Uploading utilities_64px_argb565.bin"
ampy put src/images/utilities_64px_argb565.bin images/utilities_64px_argb565.bin
fi
if echo $images | grep -w "sound_64px_argb565.bin" > /dev/null ; then
echo "sound_64px_argb565.bin has already been uploaded"
else
echo "Uploading sound_64px_argb565.bin"
ampy put src/images/sound_64px_argb565.bin images/sound_64px_argb565.bin
fi
if echo $images | grep -w "exit_32px_argb565.bin" > /dev/null ; then
echo "exit_32px_argb565.bin has already been uploaded"
else
echo "Uploading exit_32px_argb565.bin"
ampy put src/images/exit_32px_argb565.bin images/exit_32px_argb565.bin
fi
if echo $images | grep -w "setup_32px_argb565.bin" > /dev/null ; then
echo "setup_32px_argb565.bin has already been uploaded"
else
echo "Uploading setup_32px_argb565.bin"
ampy put src/images/setup_32px_argb565.bin images/setup_32px_argb565.bin
fi
if echo $images | grep -w "foot_16px_argb565.bin" > /dev/null ; then
echo "foot_16px_argb565.bin has already been uploaded"
else
echo "Uploading foot_16px_argb565.bin"
ampy put src/images/foot_16px_argb565.bin images/foot_16px_argb565.bin
fi
dirs="$(ampy ls /gui)"
echo "dirs in /gui:"
echo dirs
if [[ $dirs == *"/mainbar"* ]]
then
echo "/gui/mainbar directory already exists"
else
echo "Creating /gui/mainbar directory"
ampy mkdir /gui/mainbar
fi
echo "--------------------------------------"
echo "uploading python code to /gui/mainbar "
echo "--------------------------------------"
echo "uploading src/gui/mainbar/mainbar.py"
ampy put src/gui/mainbar/mainbar.py /gui/mainbar/mainbar.py
echo "uploading src/gui/mainbar/__init__.py"
ampy put src/gui/mainbar/__init__.py /gui/mainbar/__init__
dirs="$(ampy ls /gui/mainbar)"
if [[ $dirs == *"/app_tile"* ]]
then
echo "/gui/mainbar/app_tile directory already exists"
else
echo "Creating /gui/mainbar/app_tile directory"
ampy mkdir /gui/mainbar/app_tile
fi
echo "Uploading src/gui/mainbar/app_tile/app_tile.py"
ampy put src/gui/mainbar/app_tile/app_tile.py /gui/mainbar/app_tile/app_tile.py
if [[ $dirs == *"/main_tile"* ]]
then
echo "/gui/mainbar/main_tile directory already exists"
else
echo "Creating /gui/mainbar/main_tile directory"
ampy mkdir /gui/mainbar/main_tile
fi
echo "Uploading src/gui/mainbar/main_tile/main_tile.py"
ampy put src/gui/mainbar/main_tile/main_tile.py /gui/mainbar/main_tile/main_tile.py
if [[ $dirs == *"/note_tile"* ]]
then
echo "/gui/mainbar/note_tile directory already exists"
else
echo "Creating /gui/mainbar/note_tile directory"
ampy mkdir /gui/mainbar/note_tile
fi
echo "Uploading src/gui/mainbar/note_tile/note_tile.py"
ampy put src/gui/mainbar/note_tile/note_tile.py /gui/mainbar/note_tile/note_tile.py
if [[ $dirs == *"/setup_tile"* ]]
then
echo "/gui/mainbar/setup_tile directory already exists"
else
echo "Creating /gui/mainbar/setup_tile directory"
ampy mkdir /gui/mainbar/setup_tile
fi
echo "Uploading src/gui/mainbar/setup_tile/setup_tile.py"
ampy put src/gui/mainbar/setup_tile/setup_tile.py /gui/mainbar/setup_tile/setup_tile.py
dirs="$(ampy ls /gui/mainbar/setup_tile)"
if [[ $dirs == *"/battery_settings"* ]]
then
echo "/gui/mainbar/setup_tile/battery_settings directory already exists"
else
echo "Creating /gui/mainbar/setup_tile/battery_settings directory"
ampy mkdir /gui/mainbar/setup_tile/battery_settings
fi
echo "Uploading src/gui/mainbar/setup_tile/battery_settings/battery_settings.py"
ampy put src/gui/mainbar/setup_tile/battery_settings/battery_settings.py /gui/mainbar/setup_tile/battery_settings/battery_settings.py
echo "Uploading src/gui/mainbar/setup_tile/battery_settings/battery_view.py"
ampy put src/gui/mainbar/setup_tile/battery_settings/battery_view.py /gui/mainbar/setup_tile/battery_settings/battery_view.py