pub 8.4 KB

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