pub 9.1 KB

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