forked from joecupano/SIGpi
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SIGpi_installer.sh
executable file
·545 lines (458 loc) · 14.7 KB
/
SIGpi_installer.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
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
#!/bin/bash
###
### SIGpi_installer
###
###
### REVISION: 20211228-0700
###
###
### Usage: SIGpi_installer
###
### Fresh install of SIGpi on a fresh OS install
###
###
###
###
### INIT VARIABLES AND DIRECTORIES
###
# SIGpi Directory tree
SIGPI_ROOT=$HOME/SIG
SIGPI_SOURCE=$SIGPI_ROOT/source
SIGPI_HOME=$SIGPI_ROOT/SIGpi
SIGPI_ETC=$SIGPI_ROOT/etc
SIGPI_SCRIPTS=$SIGPI_HOME/scripts
SIGPI_PACKAGES=$SIGPI_HOME/packages
# SigPi Install Support files
SIGPI_INSTALLER=$SIGPI_ETC/INSTALL_CONFIG
SIGPI_CONFIG=$SIGPI_ETC/INSTALLED
SIGPI_PKGLIST=$SIGPI_PACKAGES/PACKAGES
SIGPI_INSTALL_TXT1=$SIGPI_SCRIPTS/scr_install_welcome.txt
SIGPI_INSTALLSRC_TXT1=$SIGPI_SCRIPTS/scr_install-srv_welcome.txt
SIGPI_BANNER_COLOR="\e[0;104m\e[K" # blue
SIGPI_BANNER_RESET="\e[0m"
# Detect architecture (x86, x86_64, aarch64, ARMv8, ARMv7)
SIGPI_HWARCH=`lscpu|grep Architecture|awk '{print $2}'`
# Detect Operating system (Debian GNU/Linux 11 (bullseye) or Ubuntu 20.04.3 LTS)
SIGPI_OSNAME=`cat /etc/os-release|grep "PRETTY_NAME"|awk -F'"' '{print $2}'`
# Is Platform good for install- true or false - we start with false
SIGPI_CERTIFIED="false"
# Desktop Source directories
SIGPI_BACKGROUNDS=$SIGPI_HOME/backgrounds
SIGPI_ICONS=$SIGPI_HOME/icons
SIGPI_LOGO=$SIGPI_HOME/logo
SIGPI_DESKTOP=$SIGPI_HOME/desktop
# Desktop Destination Directories
DESKTOP_DIRECTORY=/usr/share/desktop-directories
DESKTOP_FILES=/usr/share/applications
DESKTOP_ICONS=/usr/share/icons
DESKTOP_XDG_MENU=/usr/share/extra-xdg-menus
# SigPi Menu category
SIGPI_MENU_CATEGORY=SigPi
HAMRADIO_MENU_CATEGORY=HamRadio
###
### Environment tests
###
# Are we the right hardware
if [ "$SIGPI_HWARCH" = "x86" ]; then
SIGPI_CERTIFIED="true"
fi
if [ "$SIGPI_HWARCH" = "x86_64" ]; then
SIGPI_CERTIFIED="true"
fi
# Raspberry Pi 3B+
if [ "$SIGPI_HWARCH" = "armv7l" ]; then
SIGPI_CERTIFIED="true"
fi
if [ "$SIGPI_HWARCH" = "armhf" ]; then
SIGPI_CERTIFIED="true"
fi
if [ "$SIGPI_HWARCH" = "aarch64" ]; then
SIGPI_CERTIFIED="true"
fi
if [ "$SIGPI_CERTIFIED" = "false" ]; then
echo "ERROR: 100 - Incorrect Hardware"
echo "ERROR:"
echo "ERROR: Hardware must be x86, x86_64, armhf, or aarch64 hardware"
echo "ERROR:"
echo "ERROR: Aborting"
exit 1;
fi
# Are we the right operating system
if [ "$SIGPI_OSNAME" = "Debian GNU/Linux 11 (bullseye)" ]; then
SIGPI_CERTIFIED="true"
fi
if [ "$SIGPI_OSNAME" = "Ubuntu 20.04.3 LTS" ]; then
SIGPI_CERTIFIED="true"
fi
if [ "$SIGPI_CERTIFIED" = "false" ]; then
echo "ERROR: 200 - Incorrect Operating System"
echo "ERROR:"
echo "ERROR: Operating system must be Debian GNU/Linux 11 (bullseye) or Ubuntu 20.04.3 LTS."
echo "ERROR:"
echo "ERROR: Aborting"
exit 1;
fi
# Are we where we should be
if [ -f /home/$USER/SIG/SIGpi/SIGpi_installer.sh ]; then
echo
else
echo "ERROR: 300 - Software install setup issue"
echo "ERROR:"
echo "ERROR: Repo must be cloned from within /home/$USER/SIG directory"
echo "ERROR: and SIGpi_installer.sh run from there."
echo "ERROR:"
echo "ERROR: Aborting"
exit 1;
fi
###
### FUNCTIONS
###
calc_wt_size() {
# NOTE: it's tempting to redirect stderr to /dev/null, so supress error
# output from tput. However in this case, tput detects neither stdout or
# stderr is a tty and so only gives default 80, 24 values
WT_HEIGHT=26
WT_WIDTH=$(tput cols)
if [ -z "$WT_WIDTH" ] || [ "$WT_WIDTH" -lt 60 ]; then
WT_WIDTH=60
fi
if [ "$WT_WIDTH" -gt 178 ]; then
WT_WIDTH=80
fi
WT_MENU_HEIGHT=$(($WT_HEIGHT-7))
}
select_startscreen(){
TERM=ansi whiptail --title "SigPi Installer" --clear --textbox $SIGPI_INSTALL_TXT1 34 100 16
}
select_devices() {
FUN=$(whiptail --title "SigPi Installer" --clear --checklist --separate-output \
"Select additional devices to install " 20 80 12 \
"ettus" "Ettus Research USRP UHD" OFF \
"rfm95w" "(RPi only) Adafruit LoRa Radio Bonnet - RFM95W @ 915 MHz " OFF \
3>&1 1>&2 2>&3)
RET=$?
if [ $RET -eq 1 ]; then
$FUN = "NONE"
fi
##echo $FUN >> $SIGPI_INSTALLER
IFS=' ' # space is set as delimiter
read -ra ADDR <<< "$FUN" # str is read into an array as tokens separated by IFS
for i in "${ADDR[@]}"; do # access each element of array
echo $FUN >> $SIGPI_INSTALLER
done
}
select_gnuradio() {
FUN=$(whiptail --title "SigPi Installer" --radiolist --clear --separate-output \
"Select a GNUradio version" 20 80 12 \
"gnuradio38" "GNU Radio 3.8 " ON \
"gnuradio39" "GNU Radio 3.9 " OFF \
3>&1 1>&2 2>&3)
RET=$?
if [ $RET -eq 1 ]; then
$FUN = "NONE"
fi
echo $FUN >> $SIGPI_INSTALLER
}
select_sdrapps() {
FUN=$(whiptail --title "SigPi Installer" --clear --checklist --separate-output \
"Select SDR Applications" 20 80 12 \
"rtl_433" "RTL_433 " OFF \
"dump1090" "Dump 1090 " OFF \
"gqrx" "SDR Receiver " OFF \
"cubicsdr" "SDR Receiver " OFF \
"sdrangel" "SDRangel " OFF \
"sdrpp" "SDR++ " OFF \
3>&1 1>&2 2>&3)
RET=$?
if [ $RET -eq 1 ]; then
$FUN = "NONE"
fi
##echo $FUN >> $SIGPI_INSTALLER
IFS=' ' # space is set as delimiter
read -ra ADDR <<< "$FUN" # str is read into an array as tokens separated by IFS
for i in "${ADDR[@]}"; do # access each element of array
echo $FUN >> $SIGPI_INSTALLER
done
}
select_amateurradio() {
FUN=$(whiptail --title "SigPi Installer" --clear --checklist --separate-output \
"Select Amateur Radio Applications" 24 120 12 \
"fldigi" "Fldigi 4.1.18 for MFSK, PSK31, CW, RTTY. WEFAX and many others " OFF \
"js8call" "js8call 2.20 for another digital mode" OFF \
"qsstv" "QSSTV 9.4.X for SSTV modes " OFF \
3>&1 1>&2 2>&3)
RET=$?
if [ $RET -eq 1 ]; then
$FUN = "NONE"
fi
##echo $FUN >> $SIGPI_INSTALLER
IFS=' ' # space is set as delimiter
read -ra ADDR <<< "$FUN" # str is read into an array as tokens separated by IFS
for i in "${ADDR[@]}"; do # access each element of array
echo $FUN >> $SIGPI_INSTALLER
done
}
select_usefulapps() {
FUN=$(whiptail --title "SigPi Installer" --clear --checklist --separate-output \
"Useful Applications" 20 120 12 \
"HASviolet" "(RPi only) LoRa and FSK transceiver project " OFF \
"cygnusrfi" "RFI) analysis tool, based on Python and GNU Radio Companion (GRC)" OFF \
"gpredict" "Satellite Tracking " OFF \
"splat" "RF Signal Propagation, Loss, And Terrain analysis tool for 20 MHz to 20 GHz " OFF \
"wireshark" "Network Traffic Analyzer " OFF \
"kismet" "Wireless sniffer and monitor " OFF \
"audacity" "Audio Editor " OFF \
"pavu" "PulseAudio Control " OFF \
"xastir" "APRS Station Tracking and Reporting " OFF \
3>&1 1>&2 2>&3)
RET=$?
if [ $RET -eq 1 ]; then
$FUN = "NONE"
fi
##echo $FUN >> $SIGPI_INSTALLER
IFS=' ' # space is set as delimiter
read -ra ADDR <<< "$FUN" # str is read into an array as tokens separated by IFS
for i in "${ADDR[@]}"; do # access each element of array
echo $FUN >> $SIGPI_INSTALLER
done
}
###
### MAIN
###
# Setup directories
mkdir $SIGPI_ETC
touch $SIGPI_CONFIG
mkdir $SIGPI_SOURCE
cd $SIGPI_SOURCE
# Server option invoked ?
if [ "$1" = "server" ]; then
TERM=ansi whiptail --title "SigPi Server Install" --clear --textbox $SIGPI_INSTALLSRV_TXT1 34 100 16
FUN=$(whiptail --title "SigPi Server Installer" --clear --checklist --separate-output \
"SDR Server Packages" 20 80 12 \
"RTLSDRsrv" "RTLSDR Server " OFF \
"SoapySDRsrv" "SoapySDR Server " OFF \
"SDRangelsrv" "SDRangel server " OFF \
3>&1 1>&2 2>&3)
RET=$?
if [ $RET -eq 1 ]; then
$FUN = "NONE"
fi
echo $FUN
TERM=ansi whiptail --title "SigPi Server Install" --clear --msgbox "Ready to Install" 12 120
echo -e "${SIGPI_BANNER_COLOR}"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR} ## System Update & Upgrade"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_RESET}"
sudo apt-get -y update
sudo apt-get -y upgrade
touch $SIGPI_CONFIG
echo "sigpi_server" >> $SIGPI_CONFIG
cd $SIGPI_SOURCE
source $SIGPI_SCRIPTS/install_core_dependencies.sh
source $SIGPI_SCRIPTS/install_core_devices.sh
# RTLSDRsrv
if grep RTLSDRsrv "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_rtlsdr-server install
fi
# SoapySDRsrv
if grep SoapySDRsrv "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_soapysdr-server install
fi
# SDRangelsrv
if grep RTLTCPsrv "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_sdrangel-server install
fi
echo -e "${SIGPI_BANNER_COLOR}"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR} ## Server Installation Complete !!"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR}"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR} ## System needs to reboot for all changes to occur"
echo -e "${SIGPI_BANNER_COLOR} ## Reboot will begin in 15 seconsds unless CTRL-C hit"
echo -e "${SIGPI_BANNER_RESET}"
sleep 17
sudo sync
sudo reboot
exit 0
fi
# Base option invoked ?
if [ "$1" = "base" ]; then
TERM=ansi whiptail --title "SigPi Base Install" --clear --msgbox "Ready to Install" 12 120
echo -e "${SIGPI_BANNER_COLOR}"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR} ## System Update & Upgrade"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_RESET}"
sudo apt-get -y update
sudo apt-get -y upgrade
touch $SIGPI_CONFIG
echo "sigpi_desktop" >> $SIGPI_CONFIG
cd $SIGPI_SOURCE
source $SIGPI_SCRIPTS/install_core_dependencies.sh
source $SIGPI_SCRIPTS/install_core_devices.sh
source $SIGPI_SCRIPTS/install_desktop-prep.sh
source $SIGPI_PACKAGES/pkg_rtl_433 install
source $SIGPI_PACKAGES/pkg_dump1090 install
source $SIGPI_PACKAGES/pkg_gqrx install
source $SIGPI_SCRIPTS/install_desktop-post.sh
echo -e "${SIGPI_BANNER_COLOR}"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR} ## Base Installation Complete !!"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR}"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR} ## System needs to reboot for all changes to occur"
echo -e "${SIGPI_BANNER_COLOR} ## Reboot will begin in 15 seconsds unless CTRL-C hit"
echo -e "${SIGPI_BANNER_RESET}"
sleep 17
sudo sync
sudo reboot
exit 0
fi
# Otherwise we are Full install
calc_wt_size
select_startscreen
select_devices
select_gnuradio
select_sdrapps
select_amateurradio
select_usefulapps
TERM=ansi whiptail --title "SigPi Installer" --clear --msgbox "Ready to Install" 12 120
echo -e "${SIGPI_BANNER_COLOR}"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR} ## System Update & Upgrade"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_RESET}"
sudo apt-get -y update
sudo apt-get -y upgrade
touch $SIGPI_CONFIG
echo "sigpi_desktop" >> $SIGPI_CONFIG
cd $SIGPI_SOURCE
#source $SIGPI_SCRIPTS/install_swapspace.sh
source $SIGPI_SCRIPTS/install_core_dependencies.sh
source $SIGPI_SCRIPTS/install_desktop-prep.sh
source $SIGPI_SCRIPTS/install_core_devices.sh
# UHD - Ettus
if grep ettus "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_ettus install
fi
# RFM95W (Adafruit RadioBonnet 900 MHz LoRa-FSK)
if grep rfm95w "$SIGPI_INSTALLER"; then
source $SIGPI_SCRIPTS/install_devices_rfm95w.sh
fi
source $SIGPI_SCRIPTS/install_libraries.sh
source $SIGPI_PACKAGES/pkg_aptdec install
source $SIGPI_PACKAGES/pkg_nrsc5 install
source $SIGPI_PACKAGES/pkg_multimon-ng install
source $SIGPI_PACKAGES/pkg_radiosonde install
source $SIGPI_PACKAGES/pkg_ubertooth-tools install
source $SIGPI_PACKAGES/pkg_direwolf install
source $SIGPI_PACKAGES/pkg_linpac install
# RTL_433
if grep rtl_433 "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_rtl_433 install
fi
# Dump1090
if grep gnuradio38 "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_dump1090 install
fi
# GNU Radio
if grep gnuradio38 "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_gnuradio38 install
fi
if grep gnuradio39 "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_gnuradio39 install
fi
# gqrx
if grep gqrx "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_gqrx install
fi
# CubicSDR
if grep cubicsdr "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_cubicsdr install
fi
# SDRangel
if grep sdrangel "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_sdrangel install
fi
# SDR++
if grep sdrpp "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_sdrpp install
fi
# Fldigi
if grep fldigi "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_fldigi install
fi
# WSJT-X
#if grep wsjtx "$SIGPI_INSTALLER"; then
# source $SIGPI_PACKAGES/pkg_wsjtx install
#fi
# Xastir
if grep xastir "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_xastir install
fi
# QSSTV
if grep qsstv "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_qsstv install
fi
# QSSTV 9.5.X
#if grep qsstv95 "$SIGPI_INSTALLER"; then
# source $SIGPI_PACKAGES/pkg_qsstv95 install
#fi
# JS8CALL
if grep js8call "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_js8call install
fi
# Gpredict
if grep gpredict "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_gpredict install
fi
# HASviolet
if grep HASviolet "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_hasviolet install
fi
# CygnusRFI
if grep cygnusrfi "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_cygnusrfi install
fi
# Wireshark
if grep wireshark "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_wireshark install
fi
# Kismet
if grep kismet "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_kismet install
fi
# Audacity
if grep audacity "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_audacity install
fi
# PAVU
if grep pavu "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_pavucontrol install
fi
# splat
if grep splat "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_splat install
fi
# Artemis
if grep artemis "$SIGPI_INSTALLER"; then
source $SIGPI_PACKAGES/pkg_artemis install
fi
# SIGpi Menus
source $SIGPI_SCRIPTS/install_desktop-post.sh
echo -e "${SIGPI_BANNER_COLOR}"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR} ## Installation Complete !!"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR}"
echo -e "${SIGPI_BANNER_COLOR} ##"
echo -e "${SIGPI_BANNER_COLOR} ## System needs to reboot for all changes to occur"
echo -e "${SIGPI_BANNER_COLOR} ## Reboot will begin in 15 seconsds unless CTRL-C hit"
echo -e "${SIGPI_BANNER_RESET}"
sleep 17
sudo sync
sudo reboot
exit 0