-
Notifications
You must be signed in to change notification settings - Fork 123
/
unpack_gsm0610_data.sh
executable file
·353 lines (315 loc) · 8.85 KB
/
unpack_gsm0610_data.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
#!/bin/sh
#
# SpanDSP - a series of DSP components for telephony
#
# unpack_gsm0610_data.sh
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License version 2.1,
# as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
# The ETSI distribution file extracts to 5 ZIP files, called DISK1.ZIP to DISK5.ZIP
# These were originally the contents of 5 floppy disks. Disks 1 to 3 contain data
# files. However, disks 4 and 5 contain .EXE files, which unpack.... but only in an
# MS environment. These files need to be executed in a Windows or DOS environment,
# or a good emulation like FreeDOS or Wine.
ETSIDATA="../../../en_300961v080101p0.zip"
cd test-data
if [ -d etsi ]
then
cd etsi
else
mkdir etsi
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot create test-data/etsi!
exit $RETVAL
fi
cd etsi
fi
if [ -d gsm0610 ]
then
cd gsm0610
else
mkdir gsm0610
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot create test-data/etsi/gsm0610!
exit $RETVAL
fi
cd gsm0610
fi
if [ $1x = --no-exe-runx ]
then
# Run the .exe files, which should be here
./FR_A.EXE
./FR_HOM_A.EXE
./FR_SYN_A.EXE
./FR_U.EXE
./FR_HOM_U.EXE
./FR_SYN_U.EXE
exit 0
fi
# Clear out any leftovers from the past
rm -rf ASN.1.txt
rm -rf DISK1.ZIP
rm -rf DISK2.ZIP
rm -rf DISK3.ZIP
rm -rf DISK4.ZIP
rm -rf DISK5.ZIP
rm -rf *.EXE
rm -rf READ_FRA.TXT
rm -rf ACTION
rm -rf unpacked
if [ $1x = --no-exex ]
then
# We need to prepare the .exe files to be run separately
rm -rf *.INP
rm -rf *.COD
rm -rf *.OUT
unzip ${ETSIDATA} >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot unpack the ETSI test vectors for GSM 06.10!
exit $RETVAL
fi
unzip ./DISK4.ZIP >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot unpack the ETSI test vectors for GSM 06.10!
exit $RETVAL
fi
unzip ./DISK5.ZIP >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot unpack the ETSI test vectors for GSM 06.10!
exit $RETVAL
fi
rm -rf ASN.1.txt
rm -rf DISK1.ZIP
rm -rf DISK2.ZIP
rm -rf DISK3.ZIP
rm -rf DISK4.ZIP
rm -rf DISK5.ZIP
rm -rf READ_FRA.TXT
# An environment which is emulating an MS one will probably need
# to make the .EXE files actually executable.
chmod 755 *.EXE
echo "Now copy the files from the test-data/etsi/gsm0610 directory to a Windows,"
echo "DOS or other machine which can run .exe files. Run each of the .exe"
echo "files (there are 6 of them), and copy the whole directory back here."
echo "You can then complete the creation of the working data directories"
echo "with the command:"
echo $0 "--no-exe-continue"
exit 0
fi
unzip ${ETSIDATA} >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot unpack the ETSI test vectors for GSM 06.10!
exit $RETVAL
fi
#rm ${ETSIDATA}
rm -rf ASN.1.txt
if [ $1x != --no-exe-continuex ]
then
# We need to extract and run the .exe files right now. For this to succeed
# we must be running in an environment which can run .exe files. This has been
# tested with Cygwin on a Windows XP machine.
rm -rf *.INP
rm -rf *.COD
rm -rf *.OUT
unzip ./DISK4.ZIP >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot unpack the ETSI test vectors for GSM 06.10!
exit $RETVAL
fi
unzip ./DISK5.ZIP >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot unpack the ETSI test vectors for GSM 06.10!
exit $RETVAL
fi
# An environment which is emulating an MS one will probably need
# to make the .EXE files actually executable.
chmod 755 *.EXE
./FR_HOM_A.EXE >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot run ./FR_HOM_A.EXE
exit $RETVAL
fi
./FR_SYN_A.EXE >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot run ./FR_HOM_A.EXE
exit $RETVAL
fi
./FR_A.EXE >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot run ./FR_HOM_A.EXE
exit $RETVAL
fi
./FR_HOM_U.EXE >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot run ./FR_HOM_A.EXE
exit $RETVAL
fi
./FR_SYN_U.EXE >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot run ./FR_HOM_A.EXE
exit $RETVAL
fi
./FR_U.EXE >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot run ./FR_HOM_A.EXE
exit $RETVAL
fi
rm -rf READ_FRA.TXT
fi
rm -rf DISK4.ZIP
rm -rf DISK5.ZIP
rm -rf *.EXE
chmod 644 *.INP
chmod 644 *.OUT
chmod 644 *.COD
# Create the directories where we want to put the test data files.
mkdir unpacked
mkdir unpacked/fr_A
mkdir unpacked/fr_L
mkdir unpacked/fr_U
mkdir unpacked/fr_homing_A
mkdir unpacked/fr_homing_L
mkdir unpacked/fr_homing_U
mkdir unpacked/fr_sync_A
mkdir unpacked/fr_sync_L
mkdir unpacked/fr_sync_U
# Disks 1, 2 and 3 simply unzip, and the files have sensible file names. We
# just need to rearrange the directories in which they are located.
unzip ./DISK1.ZIP >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot unpack the ETSI test vectors for GSM 06.10!
exit $RETVAL
fi
unzip ./DISK2.ZIP >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot unpack the ETSI test vectors for GSM 06.10!
exit $RETVAL
fi
unzip ./DISK3.ZIP >/dev/null
RETVAL=$?
if [ $RETVAL != 0 ]
then
echo Cannot unpack the ETSI test vectors for GSM 06.10!
exit $RETVAL
fi
rm -rf DISK1.ZIP
rm -rf DISK2.ZIP
rm -rf DISK3.ZIP
mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK1/"* ./unpacked/fr_L
mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/"Sync*.cod ./unpacked/fr_sync_L
mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK2/"Seq*h.* ./unpacked/fr_homing_L
mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/"Seq*h.* ./unpacked/fr_homing_L
mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Bitsync.inp" ./unpacked/fr_sync_L
mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Seqsync.inp" ./unpacked/fr_sync_L
mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Homing01.cod" ./unpacked/fr_homing_L
mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Homing01.out" ./unpacked/fr_homing_L
rm -rf ACTION
# The files extracted by the .EXE files have messy naming, and are not in
# a sane directory layout. We rename and move them, to make the final result of
# the files extracted from all five of the original .ZIP files reasonably
# consistent, and easy to follow.
rm -rf READ_FRA.TXT
for I in SYN*_A.COD ;
do
mv $I `echo $I | sed -e "s|SYN|./unpacked/fr_sync_A/Sync|" | sed -e "s/COD/cod/"`
done
for I in SYN*_U.COD ;
do
mv $I `echo $I | sed -e "s|SYN|./unpacked/fr_sync_U/Sync|" | sed -e "s/COD/cod/"`
done
for I in SEQ*H_A.COD ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_A/Seq|" | sed -e "s/COD/cod/"`
done
for I in SEQ*H_U.COD ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_U/Seq|" | sed -e "s/COD/cod/"`
done
for I in SEQ*H_A.INP ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_A/Seq|" | sed -e "s/INP/inp/"`
done
for I in SEQ*H_U.INP ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_U/Seq|" | sed -e "s/INP/inp/"`
done
for I in SEQ*H_A.OUT ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_A/Seq|" | sed -e "s/OUT/out/"`
done
for I in SEQ*H_U.OUT ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_U/Seq|" | sed -e "s/OUT/out/"`
done
for I in SEQ*-A.COD ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_A/Seq|" | sed -e "s/COD/cod/"`
done
for I in SEQ*-U.COD ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_U/Seq|" | sed -e "s/COD/cod/"`
done
for I in SEQ*-A.INP ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_A/Seq|" | sed -e "s/INP/inp/"`
done
for I in SEQ*-U.INP ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_U/Seq|" | sed -e "s/INP/inp/"`
done
for I in SEQ*-A.OUT ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_A/Seq|" | sed -e "s/OUT/out/"`
done
for I in SEQ*-U.OUT ;
do
mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_U/Seq|" | sed -e "s/OUT/out/"`
done
mv HOM01_A.OUT ./unpacked/fr_homing_A/Homing01_A.out
mv HOM01_U.OUT ./unpacked/fr_homing_U/Homing01_U.out
mv SEQSYN_A.INP ./unpacked/fr_sync_A/Seqsync_A.inp
mv SEQSYN_U.INP ./unpacked/fr_sync_U/Seqsync_U.inp
echo "The ETSI test vectors for GSM 06.10 should now be correctly laid out in the"
echo "gsm0610 directory"