pub 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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/unique $curdir/output/t113s/root/mnt/UDISK/webb
  141. fi
  142. else
  143. cp -rf $custdir/web/unique $curdir/output/t113i/root/run/web
  144. fi
  145. prj_enable $1
  146. }
  147. function do_compile()
  148. {
  149. echo do_compile ...
  150. cd $curdir/pro
  151. rm -rf build; mkdir build; cd build
  152. cmake .. && make
  153. if [ $? -gt 0 ]; then
  154. exit 1
  155. fi
  156. }
  157. function do_pack()
  158. {
  159. echo do_pack ...
  160. if [ "$1" = "PRJ_IP_AC_I3_O3" ];then
  161. $curdir/output/t113s/pack.sh
  162. else
  163. $curdir/output/pack.sh
  164. fi
  165. }
  166. function do_zip()
  167. {
  168. echo do_zip ...
  169. ztm=`date +%Y%m%d_%H%M%S`
  170. if [ "$1" = "PRJ_IP_AC_I3_O3" ];then
  171. zname="upgrade_"$ztm"_$name"
  172. zdir=$curdir/output/t113s/push
  173. files="push.bat pdutar tools/*"
  174. cd $zdir; zip -q $zname.zip $files
  175. else
  176. zname="upgrade_"$ztm"_$name"
  177. zdir=$curdir/output/push
  178. files="push.bat pdutar tools/*"
  179. cd $zdir; zip -q $zname.zip $files
  180. mv $zname.zip $curdir/output/
  181. fi
  182. }
  183. function do_one()
  184. {
  185. do_copy $1
  186. do_compile
  187. do_pack $1
  188. do_zip $1
  189. }
  190. function do_all()
  191. {
  192. for s in $PRJS; do
  193. do_one $s
  194. done
  195. }
  196. do_all