-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathrpt_install.sh
executable file
·175 lines (151 loc) · 5.15 KB
/
rpt_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
#!/bin/sh
cd /usr/src
# Directory of the repo.
# If we need to test old versions, easiest to clone this dir, then change this to the new name for testing.
MYDIR=app_rpt
FILE_DIR="$( cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P )"
FILE_NAME=$( basename $0 ) # grr... why is realpath not in the POSIX standard?
FILE_PATH="$FILE_DIR/$FILE_NAME"
# Download app_rpt repo if not present already
if [ ! -d $MYDIR ]; then
git clone https://github.com/AllStarLink/app_rpt.git
else
# else, update it
cd $MYDIR
# Stick to whatever branch we're on
#git checkout master
git pull
cd ..
fi
# It's possible this script itself (if run outside of the repo) is obsolete. Make sure we only run the latest one.
if [ "$1" != "updated" ]; then
printf "Updating ourself\n"
cp /usr/src/app_rpt/$FILE_NAME $FILE_PATH && exec $FILE_PATH "updated" # Replace and exec, all in one shot (important!)
fi
printf "Script is now the latest version\n"
sleep 1
# cd into Asterisk source directory
ls -d -v */ | grep "^asterisk" | tail -1
cd $( ls -d -v */ | grep "^asterisk" | tail -1 )
apt-get install -y libusb-dev # chan_simpleusb and chan_usbradio require libusb-dev on Debian
modprobe snd-pcm-oss # /dev/dsp1 needs to exist for chan_simpleusb and chan_usbradio to work
echo "snd-pcm-oss" >> /etc/modules # load module at startup for USB
cp ../$MYDIR/apps/Makefile.diff /tmp/app_Makefile.diff
git apply /tmp/app_Makefile.diff
cp ../$MYDIR/channels/Makefile.diff /tmp/channels_Makefile.diff
git apply /tmp/channels_Makefile.diff
cp ../$MYDIR/utils/Makefile.diff /tmp/utils_makefile.diff
git apply /tmp/utils_makefile.diff
git apply ../$MYDIR/res/Makefile.diff
echoerr() {
printf "\e[31;1m%s\e[0m\n" "$*" >&2;
}
rpt_add() {
if [ ! -f ../$MYDIR/$1 ]; then
echoerr "WARNING: File $1 does not exist"
fi
printf "Adding module %s\n" "$1"
cp ../$MYDIR/$1 $1
}
if [ ! -d apps/app_rpt ]; then
mkdir apps/app_rpt
fi
if [ ! -d channels/xpmr ]; then
mkdir channels/xpmr
fi
# Remove anything that may have been there before (mainly relevant for testing older HEADs)
rm -f apps/app_rpt/*
rpt_add "apps/app_rpt.c"
rpt_add "apps/app_gps.c"
rpt_add "apps/app_rpt/app_rpt.h"
rpt_add "apps/app_rpt/mdc_encode.c"
rpt_add "apps/app_rpt/mdc_encode.h"
rpt_add "apps/app_rpt/mdc_decode.c"
rpt_add "apps/app_rpt/mdc_decode.h"
rpt_add "apps/app_rpt/rpt_mdc1200.c"
rpt_add "apps/app_rpt/rpt_mdc1200.h"
rpt_add "apps/app_rpt/pocsag.c"
rpt_add "apps/app_rpt/pocsag.h"
rpt_add "apps/app_rpt/rpt_cli.c"
rpt_add "apps/app_rpt/rpt_cli.h"
rpt_add "apps/app_rpt/rpt_daq.c"
rpt_add "apps/app_rpt/rpt_daq.h"
rpt_add "apps/app_rpt/rpt_lock.c"
rpt_add "apps/app_rpt/rpt_lock.h"
rpt_add "apps/app_rpt/rpt_utils.c"
rpt_add "apps/app_rpt/rpt_utils.h"
rpt_add "apps/app_rpt/rpt_call.c"
rpt_add "apps/app_rpt/rpt_call.h"
rpt_add "apps/app_rpt/rpt_serial.c"
rpt_add "apps/app_rpt/rpt_serial.h"
rpt_add "apps/app_rpt/rpt_xcat.c"
rpt_add "apps/app_rpt/rpt_xcat.h"
rpt_add "apps/app_rpt/rpt_capabilities.c"
rpt_add "apps/app_rpt/rpt_capabilities.h"
rpt_add "apps/app_rpt/rpt_vox.c"
rpt_add "apps/app_rpt/rpt_vox.h"
rpt_add "apps/app_rpt/rpt_uchameleon.c"
rpt_add "apps/app_rpt/rpt_uchameleon.h"
rpt_add "apps/app_rpt/rpt_bridging.c"
rpt_add "apps/app_rpt/rpt_bridging.h"
rpt_add "apps/app_rpt/rpt_radio.c"
rpt_add "apps/app_rpt/rpt_radio.h"
rpt_add "apps/app_rpt/rpt_channel.c"
rpt_add "apps/app_rpt/rpt_channel.h"
rpt_add "apps/app_rpt/rpt_config.c"
rpt_add "apps/app_rpt/rpt_config.h"
rpt_add "apps/app_rpt/rpt_link.c"
rpt_add "apps/app_rpt/rpt_link.h"
rpt_add "apps/app_rpt/rpt_functions.c"
rpt_add "apps/app_rpt/rpt_functions.h"
rpt_add "apps/app_rpt/rpt_telemetry.c"
rpt_add "apps/app_rpt/rpt_telemetry.h"
rpt_add "apps/app_rpt/rpt_manager.c"
rpt_add "apps/app_rpt/rpt_manager.h"
rpt_add "apps/app_rpt/rpt_translate.c"
rpt_add "apps/app_rpt/rpt_translate.h"
rpt_add "apps/app_rpt/rpt_rig.c"
rpt_add "apps/app_rpt/rpt_rig.h"
rpt_add "channels/chan_echolink.c"
rpt_add "channels/chan_simpleusb.c"
rpt_add "channels/chan_usbradio.c"
rpt_add "channels/chan_tlb.c"
rpt_add "channels/chan_voter.c"
rpt_add "channels/chan_usrp.c"
rpt_add "channels/chan_usrp.h"
rpt_add "channels/xpmr/sinetabx.h"
rpt_add "channels/xpmr/xpmr.c"
rpt_add "channels/xpmr/xpmr.h"
rpt_add "channels/xpmr/xpmr_coef.h"
rpt_add "configs/samples/rpt_http_registrations.conf.sample"
rpt_add "configs/samples/usbradio.conf.sample"
rpt_add "configs/samples/simpleusb.conf.sample"
rpt_add "include/asterisk/res_usbradio.h"
rpt_add "res/res_rpt_http_registrations.c"
rpt_add "res/res_usbradio.c"
rpt_add "res/res_usbradio.exports.in"
rpt_add "utils/radio-tune-menu.c"
rpt_add "utils/simpleusb-tune-menu.c"
nproc
make -j$(nproc) apps
make -j$(nproc) channels
make -j$(nproc) res
# Compilation failed
if [ $? -ne 0 ]; then
exit $?
fi
make install
# Compilation failed
if [ $? -ne 0 ]; then
exit $?
fi
# If the rpt sounds don't exist yet, add them
if [ ! -d /var/lib/asterisk/sounds/en/rpt ]; then
printf "RPT sounds don't exist yet, adding them now...\n"
mkdir /var/lib/asterisk/sounds/en/rpt
cd /var/lib/asterisk/sounds/en/rpt
wget "http://downloads.allstarlink.org/asterisk-asl-sounds-en-ulaw.tar.gz"
# Sounds are extracted directly into the dir
tar -xvzf asterisk-asl-sounds-en-ulaw.tar.gz
rm asterisk-asl-sounds-en-ulaw.tar.gz
fi