pub 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. #PRJS="PRJ_XIAN_AC_I1_O1_P4"
  2. #PRJS="PRJ_XIAN_AC_I1_O1_P8"
  3. #PRJS="PRJ_ITK_AC_I1_O1"
  4. #PRJS="PRJ_ITK_AC_I3_O1"
  5. #PRJS="PRJ_LITECH_AC_I1_O1"
  6. #PRJS="PRJ_LITECH_AC_I3_O1"
  7. #PRJS="PRJ_ANDERSON_AC_I3_O3"
  8. #PRJS="PRJ_USASL_AC_I3_O1"
  9. #PRJS="PRJ_USASL_AC_I3_O3"
  10. #PRJS="PRJ_HYPERTEC_AC_I3_O1"
  11. #PRJS="PRJ_INSPUR_DC_I_DC_O"
  12. #PRJS="PRJ_RELEASE_DC_I_DC_O"
  13. #PRJS="PRJ_RELEASE_AC_I1_O1"
  14. #PRJS="PRJ_RELEASE_AC_I3_O1"
  15. #PRJS="PRJ_RELEASE_AC_I3_O3"
  16. #PRJS="PRJ_STSC_I3_O3"
  17. #PRJS="PRJ_STSC_I3_O1_OLED"
  18. #PRJS="PRJ_SG_I3_O3"
  19. PRJS="PRJ_ESOUTH_DC_I1_O4_RGB5"
  20. #PRJS="PRJ_TEST"
  21. #PRJS="PRJ_TEST_AC_I1_O1"
  22. #PRJS="PRJ_TEST_AC_I3_O1"
  23. #PRJS="PRJ_INST2302_DC_OLED"
  24. #PRJS="PRJ_INST2106_AC_I1_O1_OLED"
  25. #PRJS="PRJ_USASL_AC_I3_O1 PRJ_USASL_AC_I3_O3"
  26. #PRJS="PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8"
  27. #PRJS="PRJ_ITK_AC_I1_O1 PRJ_ITK_AC_I3_O1"
  28. #PRJS="PRJ_TEST_AC_I1_O1 PRJ_TEST_AC_I3_O1"
  29. #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1"
  30. #PRJS="PRJ_RELEASE_DC_I_DC_O PRJ_RELEASE_AC_I1_O1 PRJ_RELEASE_AC_I3_O1 PRJ_RELEASE_AC_I3_O3"
  31. #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1 PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8"
  32. #PRJS="PRJ_IP_AC_I3_O3"
  33. #PRJS="PRJ_IP_AC_I3_O1"
  34. #PRJS="PRJ_IP_AC_I1_O1"
  35. fulldir=$(realpath $0)
  36. curdir=$(dirname $fulldir)
  37. ip_flag=0
  38. custdir=$curdir/cust_data
  39. name=null
  40. rootdir=$curdir/output/t113i/pack_dir
  41. appdir=$rootdir/root/run/app
  42. function prj_enable()
  43. {
  44. fcfg=$curdir/pro/config/cfg.h
  45. fmak=$curdir/pro/CMakefile.txt
  46. #clear space
  47. sed -i 's|^[[:space:]]\(#define PRJ_*\)|\1|g' $fcfg
  48. #mask all PRJ_XXX define
  49. sed -i 's|^\(.*\)\(#define PRJ_*\)|//\2|g' $fcfg
  50. #enable the needed PRJ_XXX define
  51. sed -i "s|^//\(#define $1\s*$\)|\1|g" $fcfg
  52. }
  53. function prj_unmask()
  54. {
  55. prj=$1
  56. }
  57. function do_copy()
  58. {
  59. echo do_copy ...
  60. if [[ "$1" == "PRJ_IP_"* ]]; then
  61. ip_flag=1
  62. fi
  63. if [ $ip_flag -eq 1 ]; then
  64. rootdir=$curdir/output/t113s/pack_dir
  65. appdir=$rootdir/mnt/UDISK/app
  66. fi
  67. rm -rf $appdir/image_qt
  68. mkdir -p $appdir/image
  69. mkdir -p $appdir/cert
  70. cp -f $custdir/cert/server.* $appdir/cert/
  71. cp -f $custdir/changes.txt $appdir/
  72. cp -f $custdir/db/pdu_dat.db $appdir/
  73. cp -f $custdir/logo/logo_neuter.png $appdir/image/logo.png
  74. cp -f $custdir/qt/S90PDUApp $rootdir/etc/init.d/
  75. if [ $ip_flag -eq 1 ]; then
  76. cp -f $custdir/qt/IP/Qt_Test $appdir/
  77. else
  78. cp -f $custdir/qt/Qt_Test $appdir/
  79. fi
  80. if [ "$1" = "PRJ_XIAN_AC_I1_O1_P4" ]; then
  81. name=ac_in1_out1_p4_xian
  82. elif [ "$1" = "PRJ_XIAN_AC_I1_O1_P8" ]; then
  83. name=ac_in1_out1_p8_xian
  84. elif [ "$1" = "PRJ_ITK_AC_I1_O1" ]; then
  85. name=ac_in1_out1_russia_itk
  86. cp -f $custdir/db/pdu_dat_itk.db $appdir/pdu_dat.db
  87. cp -f $custdir/logo/logo_itk.png $appdir/image/logo.png
  88. elif [ "$1" = "PRJ_ITK_AC_I3_O1" ]; then
  89. name=ac_in3_out1_russia_itk
  90. cp -f $custdir/logo/logo_itk.png $appdir/image/logo.png
  91. elif [ "$1" = "PRJ_RELEASE_DC_I_DC_O" ]; then
  92. name=dc_in_dc_out_release
  93. elif [ "$1" = "PRJ_RELEASE_AC_I1_O1" ]; then
  94. name=ac_in1_out1_release
  95. elif [ "$1" = "PRJ_RELEASE_AC_I3_O1" ]; then
  96. name=ac_in3_out1_release
  97. elif [ "$1" = "PRJ_RELEASE_AC_I3_O3" ]; then
  98. name=ac_in3_out3_release
  99. elif [ "$1" = "PRJ_LITECH_AC_I1_O1" ]; then
  100. name=ac_in1_out1_litech
  101. cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png
  102. elif [ "$1" = "PRJ_LITECH_AC_I3_O1" ]; then
  103. name=ac_in3_out1_litech
  104. cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png
  105. elif [ "$1" = "PRJ_ANDERSON_AC_I3_O3" ]; then
  106. name=ac_in3_out3_anderson
  107. elif [ "$1" = "PRJ_USASL_AC_I3_O1" ]; then
  108. name=ac_in3_out1_usa_sl
  109. elif [ "$1" = "PRJ_USASL_AC_I3_O3" ]; then
  110. name=ac_in3_out3_usa_sl
  111. elif [ "$1" = "PRJ_HYPERTEC_AC_I3_O1" ]; then
  112. name=ac_in3_out1_hypertec
  113. cp -f $custdir/logo/logo_hypertec.png $appdir/image/logo.png
  114. elif [ "$1" = "PRJ_INSPUR_DC_I_DC_O" ]; then
  115. name=dc_in1_out1_inspur
  116. elif [ "$1" = "PRJ_STSC_I3_O3" ]; then
  117. name=ac_in3_out3_stsc
  118. elif [ "$1" = "PRJ_SG_I3_O3" ]; then
  119. name=ac_in2_out1_sg24016
  120. elif [ "$1" = "PRJ_TEST" ]; then
  121. name=ac_in3_out1_test
  122. elif [ "$1" = "PRJ_TEST_AC_I1_O1" ]; then
  123. name=ac_in1_out1_test
  124. elif [ "$1" = "PRJ_TEST_AC_I3_O1" ]; then
  125. name=ac_in3_out1_test
  126. elif [ "$1" = "PRJ_TEST" ]; then
  127. name=ac_in3_out1_test
  128. elif [ "$1" = "PRJ_IP_AC_I3_O3" ];then
  129. name=ac_in3_out3_ip
  130. elif [ "$1" = "PRJ_INST2302_DC_OLED" ];then
  131. name=dc_in_dc_out_oled
  132. rm -f $appdir/Qt_Test
  133. elif [ "$1" = "PRJ_INST2106_AC_I1_O1_OLED" ];then
  134. name=ac_in1_out1_inst2106_oled
  135. rm -f $appdir/Qt_Test
  136. elif [ "$1" = "PRJ_STSC_I3_O1_OLED" ];then
  137. name=ac_in3_out1_stsc_oled
  138. rm -f $appdir/Qt_Test
  139. elif [ "$1" = "PRJ_ESOUTH_DC_I1_O4_RGB5" ];then
  140. name=dc_in1_out4_esouth_rgb5
  141. cp -f $custdir/qt/rgb/Qt_Test $appdir/
  142. cp -rf $custdir/qt/rgb/image_qt $appdir/
  143. cp -f $custdir/qt/rgb/S90PDUApp $rootdir/etc/init.d/
  144. elif [ "$1" = "PRJ_IP_AC_I3_O1" ];then
  145. name=ip_ac_in3_out1_release
  146. elif [ "$1" = "PRJ_IP_AC_I1_O1" ];then
  147. name=ip_ac_in1_out1_release
  148. else
  149. echo error! $RPJ not define!!!
  150. exit 1
  151. fi
  152. rm -rf $appdir/../web
  153. cp -rf $custdir/web/unique $appdir/../web
  154. prj_enable $1
  155. }
  156. function do_compile()
  157. {
  158. echo do_compile ...
  159. cd $curdir/pro
  160. rm -rf build; mkdir build; cd build
  161. if [[ "$1" == "PRJ_IP_"* ]];then
  162. cmake .. -DCHIP=t113s && make
  163. else
  164. cmake .. -DCHIP=t113i && make
  165. fi
  166. if [ $? -gt 0 ]; then
  167. exit 1
  168. fi
  169. }
  170. function do_pack()
  171. {
  172. echo do_pack ...
  173. if [[ "$1" == "PRJ_IP_"* ]];then
  174. $curdir/output/t113s/pack.sh
  175. else
  176. $curdir/output/t113i/pack.sh
  177. fi
  178. }
  179. function do_zip()
  180. {
  181. echo do_zip ...
  182. ztm=`date +%Y%m%d_%H%M%S`
  183. if [[ "$1" == "PRJ_IP_"* ]];then
  184. zname="upgrade_"$ztm"_$name"
  185. zdir=$curdir/output/t113s/push
  186. files="push.bat pdutar tools/*"
  187. cd $zdir; zip -q $zname.zip $files
  188. mv $zname.zip $curdir/output/t113s/
  189. else
  190. zname="upgrade_"$ztm"_$name"
  191. zdir=$curdir/output/t113i/push2
  192. files="push.bat pdutar tools/*"
  193. cd $zdir; zip -q $zname.zip $files
  194. mv $zname.zip $curdir/output/t113i/
  195. fi
  196. }
  197. function do_one()
  198. {
  199. do_copy $1
  200. do_compile $1
  201. do_pack $1
  202. do_zip $1
  203. }
  204. function do_all()
  205. {
  206. for s in $PRJS; do
  207. do_one $s
  208. done
  209. }
  210. do_all