-
Notifications
You must be signed in to change notification settings - Fork 3
/
sdr-installer.sh
452 lines (410 loc) · 12 KB
/
sdr-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
#! /bin/bash
# Copyright (c) 2022 by Philip Collier, radio AB9IL <webmaster@ab9il.net>
# This is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version. There is NO warranty; not even for
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# This script compiles and installs SDR drivers from source.
# To disable a specific installer, comment its reference in
# the function list near the bottom of this script.
# define working directory
export working_dir="/usr/local/src"
# get the latest release from git repos
download_last(){
wget -P "$3/" "$(lastversion --pre $1 --format assets --filter $2)"
}
export -f download_last
get_sdrplay_api() {
#get the sdrplay linux api installer manually
#from https://www.sdrplay.com/dlfinishs/p
#then enable and run it:
printf "\n\n...SDRplay MiricsAPI..."
target_file="SDRplay_RSP_API-Linux-3.07.1.run"
#printf "\nGet it manually from https://www.sdrplay.com/dlfinishs/"
#printf "\nRobots are people too."
cd "$working_dir"
[[ -f "$working_dir/$target_file" ]] \
&& chmod 755 "$target_file" \
&& ./"$target_file"
}
get_libmirisdr_4() {
printf "\n\n...LibMiriSDR-4..."
cd "$working_dir"
[[ -d "$working_dir/libmirisdr-4" ]] \
|| git clone "https://github.com/f4exb/libmirisdr-4" --depth 1 \
&& mkdir -p "$working_dir/libmirisdr-4/build"
cd "$working_dir/libmirisdr-4/build"
cmake ..
make -j4
make install
}
get_SoapySDR_core() {
printf "\n\n...SoapySDR..."
cd "$working_dir"
[[ -d "$working_dir/SoapySDR" ]] \
|| git clone "https://github.com/pothosware/SoapySDR" --depth 1 \
&& mkdir -p "$working_dir/SoapySDR/build"
cd "$working_dir/SoapySDR/build"
cmake ..
make -j4
make install
}
get_rtl_sdr_drivers() {
printf "\n\n...rtl-sdr firmware..."
cd "$working_dir"
[[ -d "$working_dir/librtlsdr" ]] \
|| git clone "https://github.com/steve-m/librtlsdr" --depth 1 \
&& mkdir -p "$working_dir/librtlsdr/build"
cd "$working_dir/librtlsdr/build"
cmake ../ -DINSTALL_UDEV_RULES=ON
make -j4
make install
}
get_gr_osmosdr() {
printf "\n\n...gr-osmosdr..."
cd "$working_dir"
[[ -d "$working_dir/gr-osmosdr" ]] \
|| git clone "https://github.com/Nuand/gr-osmosdr" --depth 1 \
&& mkdir -p "$working_dir/gr-osmosdr/build"
cd "$working_dir/gr-osmosdr/build"
cmake ..
make -j4
make install
}
get_SoapyRTLSDR() {
printf "\n\n...SoapyRTLSDR..."
cd "$working_dir"
[[ -d "$working_dir/SoapyRTLSDR" ]] \
|| git clone "https://github.com/pothosware/SoapyRTLSDR" --depth 1 \
&& mkdir -p "$working_dir/SoapyRTLSDR/build"
cd "$working_dir/SoapyRTLSDR/build"
cmake ..
make -j4
make install
}
get_SoapyRTLTCP() {
printf "\n\n...SoapyRTLTCP..."
cd "$working_dir"
[[ -d "$working_dir/SoapyRTLTCP" ]] \
|| git clone "https://github.com/pothosware/SoapyRTLTCP" --depth 1 \
&& mkdir -p "$working_dir/SoapyRTLTCP/build"
cd "$working_dir/SoapyRTLTCP/build"
cmake ..
make -j4
make install
}
get_SoapyPlutoSDR() {
printf "\n\n...ADALM-PlutoSDR"
cd "$working_dir"
[[ -d "$working_dir/SoapyPlutoSDR" ]] \
|| git clone "https://github.com/pothosware/SoapyPlutoSDR" --depth 1 \
&& mkdir -p "$working_dir/SoapyPlutoSDR/build"
cd "$working_dir/SoapyPlutoSDR/build"
cmake ..
make -j4
make install
}
get_SoapyRedPitaya() {
printf "\n\n...SoapyRedPitaya"
cd "$working_dir"
[[ -d "$working_dir/SoapyRedPitaya" ]] \
|| git clone "https://github.com/pothosware/SoapyRedPitaya" --depth 1 \
&& mkdir -p "$working_dir/SoapyRedPitaya/build"
cd "$working_dir/SoapyRedPitaya/build"
cmake ..
make -j4
make install
}
get_SoapySDRPlay3() {
printf "\n\n...SoapySDRPlay3..."
cd "$working_dir"
[[ -d "$working_dir/SoapySDRPlay3" ]] \
|| git clone "https://github.com/pothosware/SoapySDRPlay3" --depth 1 \
&& mkdir -p "$working_dir/SoapySDRPlay3/build"
cd "$working_dir/SoapySDRPlay3/build"
cmake ..
make -j4
make install
}
get_Airspy() {
printf "\n\n...LibAirspy..."
cd "$working_dir"
[[ -d "$working_dir/airspyone_host-master" ]] \
|| mkdir -p "$working_dir/airspyone_host-master/build"
# get the archived source for linux
target_file="master.zip"
cd "$working_dir/airspyone_host-master"
wget "https://github.com/airspy/airspyone_host/archive/master.zip"
unzip master.zip
rm master.zip
cd "$working_dir/airspyone_host-master/build"
cmake ../ -DINSTALL_UDEV_RULES=ON
make -j4
make install
}
get_SoapyAirspy() {
printf "\n\n...SoapyAirspy..."
cd "$working_dir"
[[ -d "$working_dir/SoapyAirspy" ]] \
|| git clone "https://github.com/pothosware/SoapyAirspy" --depth 1 \
&& mkdir -p "$working_dir/SoapyAirspy/build"
cd "$working_dir/SoapyAirspy/build"
cmake ..
make -j4
make install
}
get_SoapyAirspyHF() {
printf "\n\n...SoapyAirspyHF..."
cd "$working_dir"
[[ -d "$working_dir/SoapyAirspyHF" ]] \
|| git clone "https://github.com/pothosware/SoapyAirspyHF" --depth 1 \
&& mkdir -p "$working_dir/SoapyAirspyHF/build"
cd "$working_dir/SoapyAirspyHF/build"
cmake ..
make -j4
make install
}
get_SoapyAudio() {
printf "\n\n...soapy audio"
cd "$working_dir"
[[ -d "$working_dir/SoapyAudio" ]] \
|| git clone "https://github.com/pothosware/SoapyAudio" --depth 1 \
&& mkdir -p "$working_dir/SoapyAudio/build"
cd "$working_dir/SoapyAudio/build"
cmake ..
make -j4
make install
}
get_SoapyBladeRF() {
printf "\n\n...SoapyBladeRF"
cd "$working_dir"
[[ -d "$working_dir/SoapyBladeRF" ]] \
|| git clone "https://github.com/pothosware/SoapyBladeRF" --depth 1 \
&& mkdir -p "$working_dir/SoapyBladeRF/build"
cd "$working_dir/SoapyBladeRF/build"
cmake ..
make -j4
make install
}
get_SoapyFCDPP() {
printf "\n\n...SoapyFCDPP"
cd "$working_dir"
[[ -d "$working_dir/SoapyFCDPP" ]] \
|| git clone "https://github.com/pothosware/SoapyFCDPP" --depth 1 \
&& mkdir -p "$working_dir/SoapyFCDPP/build"
cd "$working_dir/SoapyFCDPP/build"
cmake ../
make -j4
make install
}
get_SoapyHackRF() {
printf "\n\n...SoapyHackRF"
cd "$working_dir"
[[ -d "$working_dir/SoapyHackRF" ]] \
|| git clone "https://github.com/pothosware/SoapyHackRF" --depth 1 \
&& mkdir -p "$working_dir/SoapyHackRF/build"
cd "$working_dir/SoapyHackRF/build"
cmake ..
make -j4
make install
}
get_SoapyLMS7() {
printf "\n\n...SoapyLMS7"
cd "$working_dir"
[[ -d "$working_dir/LimeSuite" ]] \
|| git clone "https://github.com/myriadrf/LimeSuite" --depth 1 \
&& mkdir -p "$working_dir/LimeSuite/build"
cd "$working_dir/LimeSuite/build"
cmake ..
make -j4
make install
}
get_SoapyOsmo() {
printf "\n\n...SoapyOsmo"
cd "$working_dir"
[[ -d "$working_dir/SoapyOsmo" ]] \
|| git clone "https://github.com/pothosware/SoapyOsmo" --depth 1 \
&& mkdir -p "$working_dir/SoapyOsmo/build"
cd "$working_dir/SoapyOsmo/build"
cmake ..
make -j4
make install
}
get_SoapyRadioberrySDR() {
printf "\n\n...SoapyRadioberrySDR"
cd "$working_dir"
[[ -d "$working_dir/SBC/rpi-4/SoapyRadioberrySDR" ]] \
|| git clone "https://github.com/pa3gsb/Radioberry-2.x" --depth 1 \
&& mkdir -p "$working_dir/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build"
cd "$working_dir/Radioberry-2.x/SBC/rpi-4/SoapyRadioberrySDR/build"
cmake ..
make -j4
make install
}
get_SoapyRemote() {
printf "\n\n...SoapyRemote"
cd "$working_dir"
[[ -d "$working_dir/SoapyRemote" ]] \
|| git clone "https://github.com/pothosware/SoapyRemote" --depth 1 \
&& mkdir -p "$working_dir/SoapyRemote/build"
cd "$working_dir/SoapyRemote/build"
cmake ..
make -j4
make install
}
get_SoapyUHD() {
printf "\n\n...SoapyUHD"
cd "$working_dir"
[[ -d "$working_dir/SoapyUHD" ]] \
|| git clone "https://github.com/pothosware/SoapyUHD" --depth 1 \
&& mkdir -p "$working_dir/SoapyUHD/build"
cd "$working_dir/SoapyUHD/build"
cmake ..
make -j4
make install
}
get_gqrx() {
printf "\n\n...Gqrx"
cd "$working_dir"
[[ -d "$working_dir/gqrx" ]] \
|| git clone "https://github.com/csete/gqrx" --depth 1 \
&& mkdir -p "$working_dir/gqrx/build"
cd "$working_dir/gqrx/build"
cd build
cmake ..
make -j4
make install
#create the launcher file
printf "\n\n creating the .desktop file..."
printf '[Desktop Entry]
Type=Application
Name=Gqrx
GenericName=Software Defined Radio
Comment=Software defined radio receiver implemented using GNU Radio and the Qt GUI toolkit
# FIXME add comments in other languages
GenericName[ru]=Программно-определённое радио
Comment[ru]=Приемник для программно-определенного радио (SDR) использующий GNU Radio и библиотеку Qt.
GenericName[nl]=Software Defined Radio
Comment[nl]=Software defined radio ontvanger geïmplementeerd met GNU Radio en de Qt GUI toolkit
Comment[de]=Software defined Radio auf Basis von GNU Radio und dem Qt GUI Toolkit
Exec=gqrx
Terminal=false
Icon=gqrx
Categories=HamRadio;
Keywords=SDR;Radio;HAM;
' > "$HOME/.local/share/applications/gqrx.desktop"
}
get_gqrx_scanner() {
printf "\n\n...Gqrx-Scanner..."
cd "$working_dir"
[[ -d "$working_dir/gqrx-scanner" ]] \
|| git clone "https://github.com/neural75/gqrx-scanner" --depth 1 \
&& mkdir -p "$working_dir/gqrx-scanner"
cd "$working_dir/gqrx-scanner"
cmake .
make -j4
#uncomment the symlinker if necessary (first install)
#ln -s "$working_dir/gqrx-scanner/bin/gqrx-scanner" "/usr/local/bin/gqrx-scanner"
#create the launcher file
printf "\n\n creating the .desktop file..."
printf '[Desktop Entry]
Type=Application
Name=Gqrx-Scanner
GenericName=SDR Scanner
Comment=Software defined radio scanner using Gqrx
Exec=sdr-scanner
Terminal=false
Icon=utilities-terminal
Categories=HamRadio;
Keywords=SDR;Radio;HAM;
' > "$HOME/.local/share/applications/gqrx-scanner.desktop"
}
get_SDRpp() {
printf "\n\n...SDRplusplus"
cd "$working_dir"
[[ -d "$working_dir/SDRPlusPlus" ]] \
&& mkdir -p "$working_dir/SDRPlusPlus"
# download from github
target_file="sdrpp_ubuntu_focal_amd64.deb"
git_repo="AlexandreRouma/SDRPlusPlus"
dl_dir="$working_dir/SDRPlusPlus"
cd "$dl_dir"
download_last $git_repo $target_file $dl_dir
dpkg -i $target_file
# clean up
rm $target_file
}
get_CubicSDR() {
printf "\n\n...CubicSDR..."
cd "$working_dir"
git_repo="cjcliffe/CubicSDR"
target_file="CubicSDR-.*-x86_64.AppImage"
app_dir="/opt/CubicSDR"
dl_dir="$working_dir"
[[ -d "$app_dir" ]] || mkdir -p $app_dir
download_last $git_repo $target_file $dl_dir
app_img_file="$(find . -maxdepth 1 -name "$(echo "$target_file" | sed 's|\.||')")"
chmod +x "$app_img_file"
mv "$app_img_file" "$app_dir/CubicSDR.AppImage"
}
# Install gnuradio dependencies
apt -o DPkg::Lock::Timeout=-1 update
apt -o DPkg::Lock::Timeout=-1 install -y libgnuradio-analog3.8.1 \
libgnuradio-audio3.8.1 libgnuradio-blocks3.8.1 libgnuradio-digital3.8.1 \
libgnuradio-fft3.8.1 libgnuradio-filter3.8.1 libgnuradio-iqbalance3.8.0 \
libgnuradio-pmt3.8.1 libgnuradio-runtime3.8.1 libgnuradio-uhd3.8.1 \
libgnuradio-fcdproplus3.8.0 libfftw3-dev libglfw3-dev libglew-dev \
libvolk2-dev libiio-dev libad9361-dev librtaudio-dev
# use find (unless you already have fd)
find -type d -name '.git' | xargs -n1 -P4 -I {} \
bash -c 'pushd "${0%/*}" \
&& ( git pull --depth 1; \
git tag -d $(git tag -l); \
git reflog expire --expire=all --all;
git gc --prune=all ) \
&& popd' {} \;
# use fd if you have it
#fd -HIFt d '.git' | xargs -n1 -P4 -I {} \
# bash -c 'pushd "$0" \
# && ( git pull --depth 1; \
# git tag -d $(git tag -l); \
# git reflog expire --expire=all --all; \
# git gc --prune=all ) \
# && popd' {}
# compile the software as separate processes
list="get_sdrplay_api \
get_libmirisdr_4 \
get_SoapySDR_core \
get_rtl_sdr_drivers \
get_gr_osmosdr \
get_SoapyRTLSDR \
get_SoapyPlutoSDR \
get_SoapyRTLTCP \
get_SoapyRedPitaya \
get_SoapySDRPlay3 \
get_Airspy \
get_SoapyAirspy \
get_SoapyAirspyHF \
get_SoapyAudio \
get_SoapyBladeRF \
get_SoapyHackRF \
get_SoapyLMS7 \
get_SoapyOsmo \
get_SoapyRadioberrySDR \
get_SoapyRemote \
get_SoapyUHD \
get_gqrx \
get_gqrx_scanner \
get_SDRpp \
get_CubicSDR"
for job in $list;do
export -f "$job"
sem -j+0 "$job"
done
printf "\n\nWorking... Please stand by.\n\n"
printf "\n\nPlease be patient... Downloading and compiling may be slow.\n\n"
sem --wait
# update the links for shared libraries
ldconfig
printf "\n\nEnd of script. Good luck / have fun.\n"