pub 7.5 KB

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