pub 6.4 KB

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