pub 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  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/db/pdu_dat.db $curdir/output/t113i/root/run/app/pdu_dat.db
  55. if [ "$1" = "PRJ_XIAN_AC_I1_O1_P4" ]; then
  56. name=ac_in1_out1_p4_xian
  57. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  58. elif [ "$1" = "PRJ_XIAN_AC_I1_O1_P8" ]; then
  59. name=ac_in1_out1_p8_xian
  60. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  61. elif [ "$1" = "PRJ_ITK_AC_I1_O1" ]; then
  62. name=ac_in1_out1_russia_itk
  63. cp -f $custdir/db/pdu_dat_itk.db $curdir/output/t113i/root/run/app/pdu_dat.db
  64. cp -f $custdir/logo/logo_itk.png $curdir/output/t113i/root/run/app/image/logo.png
  65. elif [ "$1" = "PRJ_ITK_AC_I3_O1" ]; then
  66. name=ac_in3_out1_russia_itk
  67. cp -f $custdir/logo/logo_itk.png $curdir/output/t113i/root/run/app/image/logo.png
  68. elif [ "$1" = "PRJ_RELEASE_DC_I_DC_O" ]; then
  69. name=dc_in_dc_out_release
  70. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  71. elif [ "$1" = "PRJ_RELEASE_AC_I1_O1" ]; then
  72. name=ac_in1_out1_release
  73. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  74. elif [ "$1" = "PRJ_RELEASE_AC_I3_O1" ]; then
  75. name=ac_in3_out1_release
  76. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  77. elif [ "$1" = "PRJ_RELEASE_AC_I3_O3" ]; then
  78. name=ac_in3_out3_release
  79. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  80. elif [ "$1" = "PRJ_LITECH_AC_I1_O1" ]; then
  81. name=ac_in1_out1_litech
  82. cp -f $custdir/logo/logo_litech.png $curdir/output/t113i/root/run/app/image/logo.png
  83. elif [ "$1" = "PRJ_LITECH_AC_I3_O1" ]; then
  84. name=ac_in3_out1_litech
  85. cp -f $custdir/logo/logo_litech.png $curdir/output/t113i/root/run/app/image/logo.png
  86. elif [ "$1" = "PRJ_ANDERSON_AC_I3_O3" ]; then
  87. name=ac_in3_out3_anderson
  88. flag=1
  89. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  90. elif [ "$1" = "PRJ_USASL_AC_I3_O1" ]; then
  91. name=ac_in3_out1_usa_sl
  92. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  93. elif [ "$1" = "PRJ_USASL_AC_I3_O3" ]; then
  94. name=ac_in3_out3_usa_sl
  95. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  96. elif [ "$1" = "PRJ_HYPERTEC_AC_I3_O1" ]; then
  97. name=ac_in3_out1_hypertec
  98. cp -f $custdir/logo/logo_hypertec.png $curdir/output/t113i/root/run/app/image/logo.png
  99. elif [ "$1" = "PRJ_INSPUR_DC_I_DC_O" ]; then
  100. name=dc_in1_out1_inspur
  101. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  102. elif [ "$1" = "PRJ_STSC_I3_O3" ]; then
  103. name=ac_in3_out3_stsc
  104. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  105. elif [ "$1" = "PRJ_SG_I3_O3" ]; then
  106. name=ac_in2_out1_sg24016
  107. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  108. elif [ "$1" = "PRJ_TEST" ]; then
  109. name=ac_in3_out1_test
  110. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  111. elif [ "$1" = "PRJ_TEST_AC_I1_O1" ]; then
  112. name=ac_in1_out1_test
  113. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  114. elif [ "$1" = "PRJ_TEST_AC_I3_O1" ]; then
  115. name=ac_in3_out1_test
  116. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  117. elif [ "$1" = "PRJ_TEST" ]; then
  118. name=ac_in3_out1_test
  119. cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png
  120. else
  121. echo error! $RPJ not define!!!
  122. exit 1
  123. fi
  124. rm -rf $curdir/output/t113i/root/run/web
  125. if [ $flag -eq 0 ]; then
  126. cp -rf $custdir/web/general $curdir/output/t113i/root/run/web
  127. else
  128. cp -rf $custdir/web/anderson $curdir/output/t113i/root/run/web
  129. fi
  130. prj_enable $1
  131. }
  132. function do_compile()
  133. {
  134. echo do_compile ...
  135. cd $curdir/pro
  136. rm -rf build; mkdir build; cd build
  137. cmake .. && make
  138. if [ $? -gt 0 ]; then
  139. exit 1
  140. fi
  141. }
  142. function do_pack()
  143. {
  144. echo do_pack ...
  145. $curdir/output/pack.sh
  146. }
  147. function do_zip()
  148. {
  149. echo do_zip ...
  150. ztm=`date +%Y%m%d_%H%M%S`
  151. zname="upgrade_"$ztm"_$name"
  152. zdir=$curdir/output/push
  153. files="push.bat pdutar tools/*"
  154. cd $zdir; zip -q $zname.zip $files
  155. mv $zname.zip $curdir/output/
  156. }
  157. function do_one()
  158. {
  159. do_copy $1
  160. do_compile
  161. do_pack
  162. do_zip
  163. }
  164. function do_all()
  165. {
  166. for s in $PRJS; do
  167. do_one $s
  168. done
  169. }
  170. do_all