2
0

unpack_gsm0610_data.sh 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. #!/bin/sh
  2. #
  3. # SpanDSP - a series of DSP components for telephony
  4. #
  5. # unpack_gsm0610_data.sh
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU Lesser General Public License version 2.1,
  9. # as published by the Free Software Foundation.
  10. #
  11. # This program is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU Lesser General Public
  17. # License along with this program; if not, write to the Free Software
  18. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. # The ETSI distribution file extracts to 5 ZIP files, called DISK1.ZIP to DISK5.ZIP
  20. # These were originally the contents of 5 floppy disks. Disks 1 to 3 contain data
  21. # files. However, disks 4 and 5 contain .EXE files, which unpack.... but only in an
  22. # MS environment. These files need to be executed in a Windows or DOS environment,
  23. # or a good emulation like FreeDOS or Wine.
  24. ETSIDATA="../../../en_300961v080101p0.zip"
  25. cd test-data
  26. if [ -d etsi ]
  27. then
  28. cd etsi
  29. else
  30. mkdir etsi
  31. RETVAL=$?
  32. if [ $RETVAL != 0 ]
  33. then
  34. echo Cannot create test-data/etsi!
  35. exit $RETVAL
  36. fi
  37. cd etsi
  38. fi
  39. if [ -d gsm0610 ]
  40. then
  41. cd gsm0610
  42. else
  43. mkdir gsm0610
  44. RETVAL=$?
  45. if [ $RETVAL != 0 ]
  46. then
  47. echo Cannot create test-data/etsi/gsm0610!
  48. exit $RETVAL
  49. fi
  50. cd gsm0610
  51. fi
  52. if [ $1x = --no-exe-runx ]
  53. then
  54. # Run the .exe files, which should be here
  55. ./FR_A.EXE
  56. ./FR_HOM_A.EXE
  57. ./FR_SYN_A.EXE
  58. ./FR_U.EXE
  59. ./FR_HOM_U.EXE
  60. ./FR_SYN_U.EXE
  61. exit 0
  62. fi
  63. # Clear out any leftovers from the past
  64. rm -rf ASN.1.txt
  65. rm -rf DISK1.ZIP
  66. rm -rf DISK2.ZIP
  67. rm -rf DISK3.ZIP
  68. rm -rf DISK4.ZIP
  69. rm -rf DISK5.ZIP
  70. rm -rf *.EXE
  71. rm -rf READ_FRA.TXT
  72. rm -rf ACTION
  73. rm -rf unpacked
  74. if [ $1x = --no-exex ]
  75. then
  76. # We need to prepare the .exe files to be run separately
  77. rm -rf *.INP
  78. rm -rf *.COD
  79. rm -rf *.OUT
  80. unzip ${ETSIDATA} >/dev/null
  81. RETVAL=$?
  82. if [ $RETVAL != 0 ]
  83. then
  84. echo Cannot unpack the ETSI test vectors for GSM 06.10!
  85. exit $RETVAL
  86. fi
  87. unzip ./DISK4.ZIP >/dev/null
  88. RETVAL=$?
  89. if [ $RETVAL != 0 ]
  90. then
  91. echo Cannot unpack the ETSI test vectors for GSM 06.10!
  92. exit $RETVAL
  93. fi
  94. unzip ./DISK5.ZIP >/dev/null
  95. RETVAL=$?
  96. if [ $RETVAL != 0 ]
  97. then
  98. echo Cannot unpack the ETSI test vectors for GSM 06.10!
  99. exit $RETVAL
  100. fi
  101. rm -rf ASN.1.txt
  102. rm -rf DISK1.ZIP
  103. rm -rf DISK2.ZIP
  104. rm -rf DISK3.ZIP
  105. rm -rf DISK4.ZIP
  106. rm -rf DISK5.ZIP
  107. rm -rf READ_FRA.TXT
  108. # An environment which is emulating an MS one will probably need
  109. # to make the .EXE files actually executable.
  110. chmod 755 *.EXE
  111. echo "Now copy the files from the test-data/etsi/gsm0610 directory to a Windows,"
  112. echo "DOS or other machine which can run .exe files. Run each of the .exe"
  113. echo "files (there are 6 of them), and copy the whole directory back here."
  114. echo "You can then complete the creation of the working data directories"
  115. echo "with the command:"
  116. echo $0 "--no-exe-continue"
  117. exit 0
  118. fi
  119. unzip ${ETSIDATA} >/dev/null
  120. RETVAL=$?
  121. if [ $RETVAL != 0 ]
  122. then
  123. echo Cannot unpack the ETSI test vectors for GSM 06.10!
  124. exit $RETVAL
  125. fi
  126. #rm ${ETSIDATA}
  127. rm -rf ASN.1.txt
  128. if [ $1x != --no-exe-continuex ]
  129. then
  130. # We need to extract and run the .exe files right now. For this to succeed
  131. # we must be running in an environment which can run .exe files. This has been
  132. # tested with Cygwin on a Windows XP machine.
  133. rm -rf *.INP
  134. rm -rf *.COD
  135. rm -rf *.OUT
  136. unzip ./DISK4.ZIP >/dev/null
  137. RETVAL=$?
  138. if [ $RETVAL != 0 ]
  139. then
  140. echo Cannot unpack the ETSI test vectors for GSM 06.10!
  141. exit $RETVAL
  142. fi
  143. unzip ./DISK5.ZIP >/dev/null
  144. RETVAL=$?
  145. if [ $RETVAL != 0 ]
  146. then
  147. echo Cannot unpack the ETSI test vectors for GSM 06.10!
  148. exit $RETVAL
  149. fi
  150. # An environment which is emulating an MS one will probably need
  151. # to make the .EXE files actually executable.
  152. chmod 755 *.EXE
  153. ./FR_HOM_A.EXE >/dev/null
  154. RETVAL=$?
  155. if [ $RETVAL != 0 ]
  156. then
  157. echo Cannot run ./FR_HOM_A.EXE
  158. exit $RETVAL
  159. fi
  160. ./FR_SYN_A.EXE >/dev/null
  161. RETVAL=$?
  162. if [ $RETVAL != 0 ]
  163. then
  164. echo Cannot run ./FR_HOM_A.EXE
  165. exit $RETVAL
  166. fi
  167. ./FR_A.EXE >/dev/null
  168. RETVAL=$?
  169. if [ $RETVAL != 0 ]
  170. then
  171. echo Cannot run ./FR_HOM_A.EXE
  172. exit $RETVAL
  173. fi
  174. ./FR_HOM_U.EXE >/dev/null
  175. RETVAL=$?
  176. if [ $RETVAL != 0 ]
  177. then
  178. echo Cannot run ./FR_HOM_A.EXE
  179. exit $RETVAL
  180. fi
  181. ./FR_SYN_U.EXE >/dev/null
  182. RETVAL=$?
  183. if [ $RETVAL != 0 ]
  184. then
  185. echo Cannot run ./FR_HOM_A.EXE
  186. exit $RETVAL
  187. fi
  188. ./FR_U.EXE >/dev/null
  189. RETVAL=$?
  190. if [ $RETVAL != 0 ]
  191. then
  192. echo Cannot run ./FR_HOM_A.EXE
  193. exit $RETVAL
  194. fi
  195. rm -rf READ_FRA.TXT
  196. fi
  197. rm -rf DISK4.ZIP
  198. rm -rf DISK5.ZIP
  199. rm -rf *.EXE
  200. chmod 644 *.INP
  201. chmod 644 *.OUT
  202. chmod 644 *.COD
  203. # Create the directories where we want to put the test data files.
  204. mkdir unpacked
  205. mkdir unpacked/fr_A
  206. mkdir unpacked/fr_L
  207. mkdir unpacked/fr_U
  208. mkdir unpacked/fr_homing_A
  209. mkdir unpacked/fr_homing_L
  210. mkdir unpacked/fr_homing_U
  211. mkdir unpacked/fr_sync_A
  212. mkdir unpacked/fr_sync_L
  213. mkdir unpacked/fr_sync_U
  214. # Disks 1, 2 and 3 simply unzip, and the files have sensible file names. We
  215. # just need to rearrange the directories in which they are located.
  216. unzip ./DISK1.ZIP >/dev/null
  217. RETVAL=$?
  218. if [ $RETVAL != 0 ]
  219. then
  220. echo Cannot unpack the ETSI test vectors for GSM 06.10!
  221. exit $RETVAL
  222. fi
  223. unzip ./DISK2.ZIP >/dev/null
  224. RETVAL=$?
  225. if [ $RETVAL != 0 ]
  226. then
  227. echo Cannot unpack the ETSI test vectors for GSM 06.10!
  228. exit $RETVAL
  229. fi
  230. unzip ./DISK3.ZIP >/dev/null
  231. RETVAL=$?
  232. if [ $RETVAL != 0 ]
  233. then
  234. echo Cannot unpack the ETSI test vectors for GSM 06.10!
  235. exit $RETVAL
  236. fi
  237. rm -rf DISK1.ZIP
  238. rm -rf DISK2.ZIP
  239. rm -rf DISK3.ZIP
  240. mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK1/"* ./unpacked/fr_L
  241. mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/"Sync*.cod ./unpacked/fr_sync_L
  242. mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK2/"Seq*h.* ./unpacked/fr_homing_L
  243. mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/"Seq*h.* ./unpacked/fr_homing_L
  244. mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Bitsync.inp" ./unpacked/fr_sync_L
  245. mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Seqsync.inp" ./unpacked/fr_sync_L
  246. mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Homing01.cod" ./unpacked/fr_homing_L
  247. mv "./ACTION/SMG#23/HOLD/0610_5~1/TESTSE~1/DISK3/Homing01.out" ./unpacked/fr_homing_L
  248. rm -rf ACTION
  249. # The files extracted by the .EXE files have messy naming, and are not in
  250. # a sane directory layout. We rename and move them, to make the final result of
  251. # the files extracted from all five of the original .ZIP files reasonably
  252. # consistent, and easy to follow.
  253. rm -rf READ_FRA.TXT
  254. for I in SYN*_A.COD ;
  255. do
  256. mv $I `echo $I | sed -e "s|SYN|./unpacked/fr_sync_A/Sync|" | sed -e "s/COD/cod/"`
  257. done
  258. for I in SYN*_U.COD ;
  259. do
  260. mv $I `echo $I | sed -e "s|SYN|./unpacked/fr_sync_U/Sync|" | sed -e "s/COD/cod/"`
  261. done
  262. for I in SEQ*H_A.COD ;
  263. do
  264. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_A/Seq|" | sed -e "s/COD/cod/"`
  265. done
  266. for I in SEQ*H_U.COD ;
  267. do
  268. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_U/Seq|" | sed -e "s/COD/cod/"`
  269. done
  270. for I in SEQ*H_A.INP ;
  271. do
  272. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_A/Seq|" | sed -e "s/INP/inp/"`
  273. done
  274. for I in SEQ*H_U.INP ;
  275. do
  276. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_U/Seq|" | sed -e "s/INP/inp/"`
  277. done
  278. for I in SEQ*H_A.OUT ;
  279. do
  280. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_A/Seq|" | sed -e "s/OUT/out/"`
  281. done
  282. for I in SEQ*H_U.OUT ;
  283. do
  284. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_homing_U/Seq|" | sed -e "s/OUT/out/"`
  285. done
  286. for I in SEQ*-A.COD ;
  287. do
  288. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_A/Seq|" | sed -e "s/COD/cod/"`
  289. done
  290. for I in SEQ*-U.COD ;
  291. do
  292. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_U/Seq|" | sed -e "s/COD/cod/"`
  293. done
  294. for I in SEQ*-A.INP ;
  295. do
  296. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_A/Seq|" | sed -e "s/INP/inp/"`
  297. done
  298. for I in SEQ*-U.INP ;
  299. do
  300. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_U/Seq|" | sed -e "s/INP/inp/"`
  301. done
  302. for I in SEQ*-A.OUT ;
  303. do
  304. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_A/Seq|" | sed -e "s/OUT/out/"`
  305. done
  306. for I in SEQ*-U.OUT ;
  307. do
  308. mv $I `echo $I | sed -e "s|SEQ|./unpacked/fr_U/Seq|" | sed -e "s/OUT/out/"`
  309. done
  310. mv HOM01_A.OUT ./unpacked/fr_homing_A/Homing01_A.out
  311. mv HOM01_U.OUT ./unpacked/fr_homing_U/Homing01_U.out
  312. mv SEQSYN_A.INP ./unpacked/fr_sync_A/Seqsync_A.inp
  313. mv SEQSYN_U.INP ./unpacked/fr_sync_U/Seqsync_U.inp
  314. echo "The ETSI test vectors for GSM 06.10 should now be correctly laid out in the"
  315. echo "gsm0610 directory"