pub 11 KB

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