pub 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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_STSC_I3_O1_OLED"
  18. #PRJS="PRJ_SG_I3_O3"
  19. #PRJS="PRJ_ESOUTH_DC_I1_O4_RGB5"
  20. #PRJS="PRJ_TEST"
  21. #PRJS="PRJ_TEST_AC_I1_O1"
  22. #PRJS="PRJ_TEST_AC_I3_O1"
  23. #PRJS="PRJ_TEST_AC_I3_O3"
  24. #PRJS="PRJ_INST2302_DC_OLED"
  25. #PRJS="PRJ_INST2106_AC_I1_O1_OLED"
  26. #PRJS="PRJ_YST_AC_I1_O1"
  27. #PRJS="PRJ_YUNNAN_AC_I1_O1"
  28. #PRJS="PRJ_GOWONE_125A_AC_I3_O1"
  29. #PRJS="PRJ_DUALWIRES_AC_I3_O2"
  30. PRJS="PRJ_Malaysia_AC_I3_O1"
  31. #PRJS="PRJ_USASL_AC_I3_O1 PRJ_USASL_AC_I3_O3"
  32. #PRJS="PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8"
  33. #PRJS="PRJ_ITK_AC_I1_O1 PRJ_ITK_AC_I3_O1"
  34. #PRJS="PRJ_TEST_AC_I1_O1 PRJ_TEST_AC_I3_O1"
  35. #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1"
  36. #PRJS="PRJ_RELEASE_DC_I_DC_O PRJ_RELEASE_AC_I1_O1 PRJ_RELEASE_AC_I3_O1 PRJ_RELEASE_AC_I3_O3"
  37. #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1 PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8"
  38. #PRJS="PRJ_IP_AC_I3_O3"
  39. #PRJS="PRJ_IP_AC_I3_O1"
  40. #PRJS="PRJ_IP_AC_I1_O1"
  41. #PRJS="PRJ_IP_YUNNAN_AC_I1_O1"
  42. #PRJS="PRJ_IP_CHONGQING_AC_I1_O1"
  43. #PRJS="PRJ_IP_AOSENS_AC_I1_O1"
  44. #PRJS="PRJ_IP_AOSENS_DC_I_O"
  45. fulldir=$(realpath $0)
  46. curdir=$(dirname $fulldir)
  47. ip_flag=0
  48. custdir=$curdir/cust_data
  49. name=null
  50. rootdir=$curdir/output/t113i/pack_dir
  51. appdir=$rootdir/root/run/app
  52. function prj_enable()
  53. {
  54. fcfg=$curdir/pro/config/cfg.h
  55. fmak=$curdir/pro/CMakefile.txt
  56. #clear space
  57. sed -i 's|^[[:space:]]\(#define PRJ_*\)|\1|g' $fcfg
  58. #mask all PRJ_XXX define
  59. sed -i 's|^\(.*\)\(#define PRJ_*\)|//\2|g' $fcfg
  60. #enable the needed PRJ_XXX define
  61. sed -i "s|^//\(#define $1\s*$\)|\1|g" $fcfg
  62. }
  63. function prj_unmask()
  64. {
  65. prj=$1
  66. }
  67. function do_copy()
  68. {
  69. echo do_copy ...
  70. if [[ "$1" == "PRJ_IP_"* ]]; then
  71. ip_flag=1
  72. fi
  73. if [ $ip_flag -eq 1 ]; then
  74. rootdir=$curdir/output/t113s/pack_dir
  75. appdir=$rootdir/mnt/UDISK/app
  76. fi
  77. rm -rf $appdir/image_qt
  78. mkdir -p $appdir/image
  79. mkdir -p $appdir/cert
  80. cp -f $custdir/cert/server.* $appdir/cert/
  81. cp -f $custdir/changes.txt $appdir/
  82. cp -f $custdir/db/pdu_dat.db $appdir/
  83. cp -f $custdir/logo/logo_neuter.png $appdir/image/logo.png
  84. cp -f $custdir/qt/S90PDUApp $rootdir/etc/init.d/
  85. cp -f $custdir/smartPDU_PhList.ini $appdir/
  86. if [ $ip_flag -eq 1 ]; then
  87. cp -f $custdir/qt/IP/Qt_Test $appdir/
  88. cp -f $custdir/db/pdu_dat_ip.db $appdir/pdu_dat.db
  89. else
  90. cp -f $custdir/qt/Qt_Test $appdir/
  91. fi
  92. if [ "$1" = "PRJ_XIAN_AC_I1_O1_P4" ]; then
  93. name=ac_in1_out1_p4_xian
  94. elif [ "$1" = "PRJ_XIAN_AC_I1_O1_P8" ]; then
  95. name=ac_in1_out1_p8_xian
  96. elif [ "$1" = "PRJ_ITK_AC_I1_O1" ]; then
  97. name=ac_in1_out1_russia_itk
  98. cp -f $custdir/db/pdu_dat_itk.db $appdir/pdu_dat.db
  99. cp -f $custdir/logo/logo_itk.png $appdir/image/logo.png
  100. elif [ "$1" = "PRJ_ITK_AC_I3_O1" ]; then
  101. name=ac_in3_out1_russia_itk
  102. cp -f $custdir/logo/logo_itk.png $appdir/image/logo.png
  103. elif [ "$1" = "PRJ_RELEASE_DC_I_DC_O" ]; then
  104. name=dc_in_dc_out_release
  105. elif [ "$1" = "PRJ_RELEASE_AC_I1_O1" ]; then
  106. name=ac_in1_out1_release
  107. elif [ "$1" = "PRJ_RELEASE_AC_I3_O1" ]; then
  108. name=ac_in3_out1_release
  109. elif [ "$1" = "PRJ_RELEASE_AC_I3_O3" ]; then
  110. name=ac_in3_out3_release
  111. elif [ "$1" = "PRJ_LITECH_AC_I1_O1" ]; then
  112. name=ac_in1_out1_litech
  113. cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png
  114. elif [ "$1" = "PRJ_LITECH_AC_I3_O1" ]; then
  115. name=ac_in3_out1_litech
  116. cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png
  117. elif [ "$1" = "PRJ_ANDERSON_AC_I3_O3" ]; then
  118. name=ac_in3_out3_anderson
  119. elif [ "$1" = "PRJ_USASL_AC_I3_O1" ]; then
  120. name=ac_in3_out1_usa_sl
  121. elif [ "$1" = "PRJ_USASL_AC_I3_O3" ]; then
  122. name=ac_in3_out3_usa_sl
  123. elif [ "$1" = "PRJ_HYPERTEC_AC_I3_O1" ]; then
  124. name=ac_in3_out1_hypertec
  125. cp -f $custdir/logo/logo_hypertec.png $appdir/image/logo.png
  126. elif [ "$1" = "PRJ_INSPUR_DC_I_DC_O" ]; then
  127. name=dc_in1_out1_inspur
  128. elif [ "$1" = "PRJ_STSC_I3_O3" ]; then
  129. name=ac_in3_out3_stsc
  130. elif [ "$1" = "PRJ_SG_I3_O3" ]; then
  131. name=ac_in2_out1_sg24016
  132. elif [ "$1" = "PRJ_TEST" ]; then
  133. name=ac_in3_out1_test
  134. elif [ "$1" = "PRJ_TEST_AC_I1_O1" ]; then
  135. name=ac_in1_out1_test
  136. elif [ "$1" = "PRJ_TEST_AC_I3_O1" ]; then
  137. name=ac_in3_out1_test
  138. elif [ "$1" = "PRJ_TEST_AC_I3_O3" ]; then
  139. name=ac_in3_out3_test
  140. elif [ "$1" = "PRJ_TEST" ]; then
  141. name=ac_in3_out1_test
  142. elif [ "$1" = "PRJ_IP_AC_I3_O3" ];then
  143. name=ac_in3_out3_ip
  144. elif [ "$1" = "PRJ_YST_AC_I1_O1" ];then
  145. name=ac_in1_out1_YST
  146. elif [ "$1" = "PRJ_INST2302_DC_OLED" ];then
  147. name=dc_in_dc_out_oled
  148. rm -f $appdir/Qt_Test
  149. elif [ "$1" = "PRJ_INST2106_AC_I1_O1_OLED" ];then
  150. name=ac_in1_out1_inst2106_oled
  151. rm -f $appdir/Qt_Test
  152. elif [ "$1" = "PRJ_STSC_I3_O1_OLED" ];then
  153. name=ac_in3_out1_stsc_oled
  154. rm -f $appdir/Qt_Test
  155. elif [ "$1" = "PRJ_ESOUTH_DC_I1_O4_RGB5" ];then
  156. name=dc_in1_out4_esouth_rgb5
  157. cp -f $custdir/qt/rgb/Qt_Test $appdir/
  158. cp -rf $custdir/qt/rgb/image_qt $appdir/
  159. cp -f $custdir/qt/rgb/S90PDUApp $rootdir/etc/init.d/
  160. elif [ "$1" = "PRJ_IP_AC_I3_O1" ];then
  161. name=ip_ac_in3_out1_release
  162. elif [ "$1" = "PRJ_IP_AC_I1_O1" ];then
  163. name=ip_ac_in1_out1_release
  164. elif [ "$1" = "PRJ_IP_YUNNAN_AC_I1_O1" ];then
  165. name=ip_ac_yunnan_in1_out1_release
  166. elif [ "$1" = "PRJ_YUNNAN_AC_I1_O1" ];then
  167. name=ac_yunnan_in1_out1_release
  168. elif [ "$1" = "PRJ_GOWONE_125A_AC_I3_O1" ];then
  169. name=ac_in3_out1_gowone_125A
  170. elif [ "$1" = "PRJ_DUALWIRES_AC_I3_O2" ];then
  171. name=ac_DualWires_in3_out2_release
  172. elif [ "$1" = "PRJ_IP_CHONGQING_AC_I1_O1" ];then
  173. cp -f $custdir/logo/logo_gowone.png $appdir/image/logo.png
  174. name=ip_ac_chongqing_in1_out1_release
  175. elif [ "$1" = "PRJ_IP_AOSENS_AC_I1_O1" ];then
  176. # cp -f $custdir/logo/logo_aosens.png $appdir/image/logo.png
  177. name=ip_ac_in1_out1_release
  178. elif [ "$1" = "PRJ_IP_AOSENS_DC_I_O" ]; then
  179. cp -f $custdir/logo/logo_aosens.png $appdir/image/logo.png
  180. name=ip_dc_aosens_in1_out1_release
  181. elif [ "$1" = "PRJ_Malaysia_AC_I3_O1" ];then
  182. name=ac_Malaysia_in3_out1_release
  183. cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png
  184. cp -f $custdir/qt/rgb_lcd/Qt_Test $appdir/
  185. cp -f $custdir/qt/rgb_lcd/S90PDUApp $rootdir/etc/init.d/
  186. else
  187. echo error! $RPJ not define!!!
  188. exit 1
  189. fi
  190. rm -rf $appdir/../web
  191. cp -rf $custdir/web/unique $appdir/../web
  192. prj_enable $1
  193. }
  194. function do_compile()
  195. {
  196. echo do_compile ...
  197. cd $curdir/pro
  198. rm -rf build; mkdir build; cd build
  199. if [[ "$1" == "PRJ_IP_"* ]];then
  200. cmake .. -DCHIP=t113s && make
  201. else
  202. cmake .. -DCHIP=t113i && make
  203. fi
  204. if [ $? -gt 0 ]; then
  205. exit 1
  206. fi
  207. }
  208. function do_pack()
  209. {
  210. echo do_pack ...
  211. if [[ "$1" == "PRJ_IP_"* ]];then
  212. $curdir/output/t113s/pack.sh
  213. else
  214. $curdir/output/t113i/pack.sh
  215. fi
  216. }
  217. function do_zip()
  218. {
  219. echo do_zip ...
  220. ztm=`date +%Y%m%d_%H%M%S`
  221. if [[ "$1" == "PRJ_IP_"* ]];then
  222. zname="upgrade_"$ztm"_$name"
  223. zdir=$curdir/output/t113s/push
  224. files="push.bat pdutar tools/*"
  225. cd $zdir; zip -q $zname.zip $files
  226. mv $zname.zip $curdir/output/t113s/
  227. else
  228. zname="upgrade_"$ztm"_$name"
  229. zdir=$curdir/output/t113i/push2
  230. files="push.bat pdutar tools/*"
  231. cd $zdir; zip -q $zname.zip $files
  232. mv $zname.zip $curdir/output/t113i/
  233. fi
  234. }
  235. function do_one()
  236. {
  237. echo $PATH
  238. do_copy $1
  239. do_compile $1
  240. do_pack $1
  241. do_zip $1
  242. }
  243. function do_all()
  244. {
  245. for s in $PRJS; do
  246. do_one $s
  247. done
  248. }
  249. do_all