pub 5.6 KB

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