pub 9.9 KB

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