pub 6.3 KB

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