pub 5.7 KB

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