Skip to content

Commit 2a2cb72

Browse files
committed
Fix shellcheck issues
- Added shebang to all the scripts - Adjusted all the scripts to make them compatible with a POSIX shell
1 parent 5a65fec commit 2a2cb72

20 files changed

+111
-68
lines changed

easytest.sh

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
#!/bin/sh
2+
23
status="0"
34
OUTPUT_FREQ=434.0
45
LAST_ITEM="0 Tune"
56
do_freq_setup()
67
{
78

8-
FREQ=$(whiptail --inputbox "Choose output Frequency (in MHZ) Default is 434MHZ" 8 78 $OUTPUT_FREQ --title "Rpitx transmit Frequency" 3>&1 1>&2 2>&3)
9-
if [ $? -eq 0 ]; then
9+
if FREQ=$(whiptail --inputbox "Choose output Frequency (in MHZ) Default is 434MHZ" 8 78 $OUTPUT_FREQ --title "Rpitx transmit Frequency" 3>&1 1>&2 2>&3); then
1010
OUTPUT_FREQ=$FREQ
1111
fi
1212

@@ -20,10 +20,10 @@ do_stop_transmit()
2020
sudo killall pifmrds 2>/dev/null
2121
sudo killall sendiq 2>/dev/null
2222
sudo killall pocsag 2>/dev/null
23-
sudo killall piopera 2>/dev/null
23+
sudo killall piopera 2>/dev/null
2424
sudo killall rpitx 2>/dev/null
2525
sudo killall freedv 2>/dev/null
26-
sudo killall pisstv 2>/dev/null
26+
sudo killall pisstv 2>/dev/null
2727
}
2828

2929
do_status()
@@ -36,7 +36,7 @@ do_status()
3636

3737
do_freq_setup
3838

39-
while [ "$status" -eq 0 ]
39+
while [ "$status" -eq 0 ]
4040
do
4141

4242
menuchoice=$(whiptail --default-item "$LAST_ITEM" --title "Rpitx on ""$OUTPUT_FREQ""MHZ" --menu "Range frequency : 50Khz-1Ghz. Choose your test" 20 82 12 \
@@ -57,10 +57,10 @@ do_freq_setup
5757
RET=$?
5858
if [ $RET -eq 1 ]; then
5959
exit 0
60-
elif [ $RET -eq 0 ]; then
60+
elif [ $RET -eq 0 ]; then
6161
case "$menuchoice" in
6262
F\ *) do_freq_setup ;;
63-
0\ *) "./testvfo.sh" "$OUTPUT_FREQ""e6" >/dev/null 2>/dev/null &
63+
0\ *) "./testvfo.sh" "$OUTPUT_FREQ""e6" >/dev/null 2>/dev/null &
6464
do_status;;
6565
1\ *) "./testchirp.sh" "$OUTPUT_FREQ""e6" >/dev/null 2>/dev/null &
6666
do_status;;
@@ -70,7 +70,7 @@ do_freq_setup
7070
do_status;;
7171
4\ *) "./testfmrds.sh" "$OUTPUT_FREQ" >/dev/null 2>/dev/null &
7272
do_status;;
73-
5\ *) "./testnfm.sh" "$OUTPUT_FREQ""e3" >/dev/null 2>/dev/null &
73+
5\ *) "./testnfm.sh" "$OUTPUT_FREQ""e3" >/dev/null 2>/dev/null &
7474
do_status;;
7575
6\ *) "./testssb.sh" "$OUTPUT_FREQ""e6" >/dev/null 2>/dev/null &
7676
do_status;;
@@ -90,7 +90,7 @@ do_freq_setup
9090
esac
9191
else
9292
exit 1
93-
fi
93+
fi
9494
done
9595
exit 0
9696

fm2ssb.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1-
echo fm2ssb.sh freq gain
2-
rtl_fm -f $1 -s 250k -r 48k -g $2 - | csdr convert_i16_f | csdr fir_interpolate_cc 2| csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | buffer | sudo ./sendiq -i /dev/stdin -s 96000 -f $3 -t float
3-
# | sox -traw -r48k -es -b16 - -c1 -r 48k -traw -
1+
#!/bin/sh
2+
3+
echo "FREQ_IN=value-in_MHz GAIN=value-0_to_45 FREQ_OUT=value-in_MHz fm2ssb"
4+
rtl_fm -f "$FREQ_IN" -s 250k -r 48k -g "$GAIN" - | csdr convert_i16_f \
5+
| csdr fir_interpolate_cc 2 | csdr dsb_fc \
6+
| csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | buffer \
7+
| sudo ./sendiq -i /dev/stdin -s 96000 -f "FREQ_OUT" -t float
8+
# | sox -traw -r48k -es -b16 - -c1 -r 48k -traw -

install.sh

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#!/bin/sh
2+
13
echo Install rpitx - some package need internet connection -
24

35
sudo apt-get update
@@ -8,26 +10,27 @@ sudo apt-get install -y rtl-sdr buffer
810
# We use CSDR as a dsp for analogs modes thanks to HA7ILM
911
git clone https://github.com/simonyiszk/csdr
1012
patch -i csdrpizero.diff csdr/Makefile
11-
cd csdr
13+
cd csdr || exit
1214
make && sudo make install
13-
cd ../
15+
cd ../ || exit
1416

15-
cd src
17+
cd src || exit
1618
git clone https://github.com/F5OEO/librpitx
17-
cd librpitx/src
19+
cd librpitx/src || exit
20+
make
21+
cd ../../ || exit
1822
make
19-
cd ../../
20-
make
2123
sudo make install
22-
cd ..
24+
cd .. || exit
2325

24-
echo "\n\n"
25-
read -p "In order to run properly, rpitx need to modify /boot/config.txt. Are you sure (y/n) " CONT
26+
printf "\n\n"
27+
printf "In order to run properly, rpitx need to modify /boot/config.txt. Are you sure (y/n) "
28+
read -r CONT
2629

2730
if [ "$CONT" = "y" ]; then
2831
echo "Set GPU to 250Mhz in order to be stable"
2932
LINE='gpu_freq=250'
30-
FILE='/boot/config.txt'
33+
FILE='/boot/config.txt'
3134
grep -qF "$LINE" "$FILE" || echo "$LINE" | sudo tee --append "$FILE"
3235
echo "Installation completed !"
3336
else

rtlmenu.sh

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/bin/bash
1+
#!/bin/sh
2+
23
status="0"
34
INPUT_RTLSDR=434.0
45
INPUT_GAIN=35
@@ -8,18 +9,15 @@ LAST_ITEM="0 Record"
89
do_freq_setup()
910
{
1011

11-
FREQ=$(whiptail --inputbox "Choose input Frequency (in MHZ) Default is 434MHZ" 8 78 $INPUT_RTLSDR --title "RTL-SDR Receive Frequency" 3>&1 1>&2 2>&3)
12-
if [ $? -eq 0 ]; then
12+
if FREQ=$(whiptail --inputbox "Choose input Frequency (in MHZ) Default is 434MHZ" 8 78 $INPUT_RTLSDR --title "RTL-SDR Receive Frequency" 3>&1 1>&2 2>&3); then
1313
INPUT_RTLSDR=$FREQ
1414
fi
1515

16-
GAIN=$(whiptail --inputbox "Choose input Gain (0(AGC) or 1-45)" 8 78 $INPUT_GAIN --title "RTL-SDR Receive Frequency" 3>&1 1>&2 2>&3)
17-
if [ $? -eq 0 ]; then
16+
if GAIN=$(whiptail --inputbox "Choose input Gain (0(AGC) or 1-45)" 8 78 $INPUT_GAIN --title "RTL-SDR Receive Frequency" 3>&1 1>&2 2>&3); then
1817
INPUT_GAIN=$GAIN
1918
fi
2019

21-
FREQ=$(whiptail --inputbox "Choose output Frequency (in MHZ) Default is 434MHZ" 8 78 $OUTPUT_FREQ --title "Transmit Frequency" 3>&1 1>&2 2>&3)
22-
if [ $? -eq 0 ]; then
20+
if FREQ=$(whiptail --inputbox "Choose output Frequency (in MHZ) Default is 434MHZ" 8 78 $OUTPUT_FREQ --title "Transmit Frequency" 3>&1 1>&2 2>&3); then
2321
OUTPUT_FREQ=$FREQ
2422
fi
2523

@@ -28,8 +26,8 @@ fi
2826
do_stop()
2927
{
3028
sudo killall rtl_sdr 2>/dev/null
31-
sudo killall sendiq 2>/dev/null
32-
sudo killall rtl_fm 2>/dev/null
29+
sudo killall sendiq 2>/dev/null
30+
sudo killall rtl_fm 2>/dev/null
3331
}
3432
do_status()
3533
{
@@ -40,7 +38,7 @@ do_status()
4038

4139
do_freq_setup
4240

43-
while [ "$status" -eq 0 ]
41+
while [ "$status" -eq 0 ]
4442
do
4543

4644
menuchoice=$(whiptail --default-item "$LAST_ITEM" --title "Rpitx with RTLSDR" --menu "Choose your test" 20 82 12 \
@@ -54,18 +52,16 @@ do_freq_setup
5452
case "$menuchoice" in
5553
0\ *) rtl_sdr -s 250000 -g "$INPUT_GAIN" -f "$INPUT_RTLSDR"e6 record.iq >/dev/null 2>/dev/null &
5654
do_status;;
57-
1\ *) sudo ./sendiq -s 250000 -f "$OUTPUT_FREQ"e6 -t u8 -i record.iq >/dev/null 2>/dev/null &
55+
1\ *) sudo ./sendiq -s 250000 -f "$OUTPUT_FREQ"e6 -t u8 -i record.iq >/dev/null 2>/dev/null &
5856
do_status;;
59-
2\ *) source $"$PWD/transponder.sh" "$INPUT_RTLSDR"M $INPUT_GAIN $OUTPUT_FREQ"e6" >/dev/null 2>/dev/null &
57+
2\ *) FREQ_IN="$INPUT_RTLSDR"M GAIN="$INPUT_GAIN" FREQ_OUT="$OUTPUT_FREQ"e6 . "$PWD/transponder.sh" >/dev/null 2>/dev/null &
6058
do_status;;
61-
3\ *) source $"$PWD/fm2ssb.sh" "$INPUT_RTLSDR"M $INPUT_GAIN $OUTPUT_FREQ"e6" >/dev/null 2>/dev/null &
59+
3\ *) FREQ_IN="$INPUT_RTLSDR"M GAIN="$INPUT_GAIN" FREQ_OUT="$OUTPUT_FREQ"e6 . "$PWD/fm2ssb.sh" >/dev/null 2>/dev/null &
6260
do_status;;
6361
4\ *)
6462
do_freq_setup;;
6563
*) status=1
66-
whiptail --title "Bye bye" --msgbox "Thx for using rpitx" 8 78
64+
whiptail --title "Bye bye" --msgbox "Thanks for using rpitx!" 8 78
6765
;;
6866
esac
69-
7067
done
71-

snap2spectrum.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
#!/bin/sh
2+
13
raspistill -w 320 -h 256 -o picture.jpg -t 1
24
#convert picture.jpg -flip -colors 16 -colorspace gray -dither -colorspace YUV picture.yuv
35
#convert picture.jpg -flip -colors 16 -colorspace gray -colorspace YUV picture.yuv
46
#convert BBC-Test-Card-F320x256.jpg -flip -quantize YUV -dither FloydSteinberg -colors 4 -interlace partition picture.yuv
5-
convert picture.jpg -flip -quantize YUV -dither FloydSteinberg -colors 4 -interlace partition picture.yuv
6-
sudo ./spectrumpaint picture.Y $1 100000
7+
convert picture.jpg -flip -quantize YUV -dither FloydSteinberg -colors 4 \
8+
-interlace partition picture.yuv
9+
sudo ./spectrumpaint picture.Y "$1" 100000
710

811
#convert -depth 8 picture.jpg picture.rgb
912

snapsstv.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
#!/bin/sh
2+
13
raspistill -w 320 -h 256 -o picture.jpg -t 1
24
convert -depth 8 picture.jpg picture.rgb
35

4-
sudo ./pisstv picture.rgb $1
6+
sudo ./pisstv picture.rgb "$1"
57

68

sv1afnfilter.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1-
#COMMAND A BANDPATH FILTER FROM SV1AFN
1+
#!/bin/sh
2+
3+
#COMMAND A BANDPATH FILTER FROM SV1AFN
24

35
#GPIO Declaration
46
if [ ! -f /sys/class/gpio/gpio26 ]; then
57
echo "Create GPIOs"
68

79
echo GPIO declaration
8-
echo 26 > /sys/class/gpio/export
9-
echo 19 > /sys/class/gpio/export
10-
echo 13 > /sys/class/gpio/export
11-
echo 6 > /sys/class/gpio/export
10+
echo 26 > /sys/class/gpio/export
11+
echo 19 > /sys/class/gpio/export
12+
echo 13 > /sys/class/gpio/export
13+
echo 6 > /sys/class/gpio/export
1214

1315

1416
#GPIO out
@@ -24,8 +26,7 @@ fi
2426
#Initialization : All at zero (disable filter)
2527
reset_all()
2628
{
27-
28-
echo 0 > /sys/class/gpio/gpio26/value
29+
echo 0 > /sys/class/gpio/gpio26/value
2930
echo 0 > /sys/class/gpio/gpio19/value
3031
echo 0 > /sys/class/gpio/gpio13/value
3132
echo 0 > /sys/class/gpio/gpio6/value
@@ -36,13 +37,13 @@ case "$1" in
3637
"10m")
3738
echo 1 > /sys/class/gpio/gpio26/value
3839
;;
39-
"15m")
40+
"15m")
4041
echo 1 > /sys/class/gpio/gpio19/value
4142
;;
42-
"20m")
43+
"20m")
4344
echo 1 > /sys/class/gpio/gpio13/value
4445
;;
45-
"40m")
46+
"40m")
4647
echo 1 > /sys/class/gpio/gpio6/value
4748
;;
4849

testam.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
#!/bin/sh
2+
13
#TODO using the AM mode from librpitx
24
echo Need to implement
3-
(while true; do cat sampleaudio.wav; done) | csdr convert_i16_f | csdr gain_ff 4.0 | csdr dsb_fc | sudo ./rpitx -i - -m IQFLOAT -f $1 -s 48000
5+
(while true; do cat sampleaudio.wav; done) | csdr convert_i16_f \
6+
| csdr gain_ff 4.0 | csdr dsb_fc \
7+
| sudo ./rpitx -i - -m IQFLOAT -f "$1" -s 48000

testchirp.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1-
sudo ./pichirp $1 100000 5
1+
#!/bin/sh
2+
3+
sudo ./pichirp "$1" 100000 5
24

testfmrds.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
sudo ./pifmrds -freq $1 -audio src/pifmrds/stereo_44100.wav
1+
#!/bin/sh
2+
3+
sudo ./pifmrds -freq "$1" -audio src/pifmrds/stereo_44100.wav

testfreedv.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
sudo ./freedv src/freedv/VCO800XA.rf $1 400
1+
#!/bin/sh
22

3+
sudo ./freedv src/freedv/VCO800XA.rf "$1" 400

testfsq.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
sudo ./pifsq "Test" $1
1+
#!/bin/sh
2+
3+
sudo ./pifsq "Test" "$1"

testnfm.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1+
#!/bin/sh
2+
13
#This is only a Narraw Band FM modulator, for FM broadcast modulation , use PiFMRDS
24
# Need to use a direct FM modulation with librpitx and not using IQ : TODO
3-
echo "If you need to test broadcast FM , use PiFMRDS"
5+
echo "If you need to test broadcast FM, use PiFMRDS"
46
#(while true; do cat sampleaudio.wav; done) | csdr convert_i16_f | csdr gain_ff 2500 | sudo ./sendiq -i /dev/stdin -s 24000 -f 434e6 -t float 1
5-
(while true; do cat sampleaudio.wav; done) | csdr convert_i16_f | csdr gain_ff 7000 | csdr convert_f_samplerf 20833 | sudo ./rpitx -i- -m RF -f $1
7+
(while true; do cat sampleaudio.wav; done) | csdr convert_i16_f \
8+
| csdr gain_ff 7000 | csdr convert_f_samplerf 20833 \
9+
| sudo ./rpitx -i- -m RF -f "$1"
610

testopera.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1-
sudo ./piopera F5OEO 0.5 $1
1+
#!/bin/sh
2+
3+
sudo ./piopera F5OEO 0.5 "$1"
24

35

testpocsag.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
echo -e "1:YOURCALL\n2: Hello world" | sudo ./pocsag -f $1
1+
#!/bin/sh
2+
3+
printf "1:YOURCALL\n2: Hello world" | sudo ./pocsag -f "$1"

testspectrum.sh

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
1-
convert BBC.jpg -flip -quantize YUV -dither FloydSteinberg -colors 4 -interlace partition picture.yuv
2-
sudo ./spectrumpaint picture.Y $1 100000
1+
#!/bin/sh
2+
3+
convert BBC.jpg -flip -quantize YUV -dither FloydSteinberg -colors 4 \
4+
-interlace partition picture.yuv
5+
sudo ./spectrumpaint picture.Y "$1" 100000

testssb.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1-
(while true; do cat sampleaudio.wav; done) | csdr convert_i16_f | csdr fir_interpolate_cc 2| csdr dsb_fc | csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff | sudo ./sendiq -i /dev/stdin -s 96000 -f $1 -t float
1+
#!/bin/sh
2+
3+
(while true; do cat sampleaudio.wav; done) | csdr convert_i16_f \
4+
| csdr fir_interpolate_cc 2 | csdr dsb_fc \
5+
| csdr bandpass_fir_fft_cc 0.002 0.06 0.01 | csdr fastagc_ff \
6+
| sudo ./sendiq -i /dev/stdin -s 96000 -f "$1" -t float
27

testsstv.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
1+
#!/bin/sh
2+
13
convert -depth 8 BBC.jpg picture.rgb
2-
sudo ./pisstv picture.rgb $1
4+
sudo ./pisstv picture.rgb "$1"

testvfo.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1-
sudo tune -f $1
1+
#!/bin/sh
2+
3+
sudo tune -f "$1"

transponder.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
#You need a rtl-sdr dongle in order to run this
2-
echo "transponder FreqIn(Mhz) Gain(0-45)"
3-
rtl_sdr -s 250000 -g "$2" -f "$1" - | buffer | sudo ./sendiq -s 250000 -f $3 -t u8 -i -
1+
#!/bin/sh
42

3+
#You need a rtl-sdr dongle in order to run this
4+
echo "FREQ_IN=value-in_MHz GAIN=value-0_to_45 FREQ_OUT=value-in_MHz transponder"
5+
rtl_sdr -s 250000 -g "$GAIN" -f "$FREQ_IN" - | buffer \
6+
| sudo ./sendiq -s 250000 -f "FREQ_OUT" -t u8 -i -

0 commit comments

Comments
 (0)