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_ITK_AC_I3_O1" #PRJS="PRJ_TEST_AC_I1_O1 PRJ_TEST_AC_I3_O1" #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1" #PRJS="PRJ_RELEASE_DC_I_DC_O PRJ_RELEASE_AC_I1_O1 PRJ_RELEASE_AC_I3_O1 PRJ_RELEASE_AC_I3_O3" #PRJS="PRJ_LITECH_AC_I1_O1 PRJ_LITECH_AC_I3_O1 PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8" #PRJS="PRJ_IP_AC_I3_O3" #PRJS="PRJ_IP_AC_I3_O1" #PRJS="PRJ_IP_AC_I1_O1" #PRJS="PRJ_IP_YUNNAN_AC_I1_O1" #PRJS="PRJ_IP_CHONGQING_AC_I1_O1" #PRJS="PRJ_IP_AOSENS_AC_I1_O1" #PRJS="PRJ_IP_AOSENS_DC_I_O" fulldir=$(realpath $0) curdir=$(dirname $fulldir) ip_flag=0 custdir=$curdir/cust_data name=null rootdir=$curdir/output/t113i/pack_dir appdir=$rootdir/root/run/app function prj_enable() { fcfg=$curdir/pro/config/cfg.h fmak=$curdir/pro/CMakefile.txt #clear space sed -i 's|^[[:space:]]\(#define PRJ_*\)|\1|g' $fcfg #mask all PRJ_XXX define sed -i 's|^\(.*\)\(#define PRJ_*\)|//\2|g' $fcfg #enable the needed PRJ_XXX define sed -i "s|^//\(#define $1\s*$\)|\1|g" $fcfg } function prj_unmask() { prj=$1 } function do_copy() { echo do_copy ... if [[ "$1" == "PRJ_IP_"* ]]; then ip_flag=1 fi if [ $ip_flag -eq 1 ]; then rootdir=$curdir/output/t113s/pack_dir appdir=$rootdir/mnt/UDISK/app fi rm -rf $appdir/image_qt mkdir -p $appdir/image mkdir -p $appdir/cert cp -f $custdir/cert/server.* $appdir/cert/ cp -f $custdir/changes.txt $appdir/ cp -f $custdir/db/pdu_dat.db $appdir/ cp -f $custdir/logo/logo_neuter.png $appdir/image/logo.png cp -f $custdir/qt/S90PDUApp $rootdir/etc/init.d/ cp -f $custdir/smartPDU_PhList.ini $appdir/ if [ $ip_flag -eq 1 ]; then cp -f $custdir/qt/IP/Qt_Test $appdir/ cp -f $custdir/db/pdu_dat_ip.db $appdir/pdu_dat.db else cp -f $custdir/qt/Qt_Test $appdir/ fi if [ "$1" = "PRJ_XIAN_AC_I1_O1_P4" ]; then name=ac_in1_out1_p4_xian elif [ "$1" = "PRJ_XIAN_AC_I1_O1_P8" ]; then name=ac_in1_out1_p8_xian elif [ "$1" = "PRJ_ITK_AC_I1_O1" ]; then name=ac_in1_out1_russia_itk cp -f $custdir/db/pdu_dat_itk.db $appdir/pdu_dat.db cp -f $custdir/logo/logo_itk.png $appdir/image/logo.png elif [ "$1" = "PRJ_ITK_AC_I3_O1" ]; then name=ac_in3_out1_russia_itk cp -f $custdir/logo/logo_itk.png $appdir/image/logo.png elif [ "$1" = "PRJ_RELEASE_DC_I_DC_O" ]; then name=dc_in_dc_out_release elif [ "$1" = "PRJ_RELEASE_AC_I1_O1" ]; then name=ac_in1_out1_release elif [ "$1" = "PRJ_RELEASE_AC_I3_O1" ]; then name=ac_in3_out1_release elif [ "$1" = "PRJ_RELEASE_AC_I3_O3" ]; then name=ac_in3_out3_release elif [ "$1" = "PRJ_LITECH_AC_I1_O1" ]; then name=ac_in1_out1_litech cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png elif [ "$1" = "PRJ_LITECH_AC_I3_O1" ]; then name=ac_in3_out1_litech cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png elif [ "$1" = "PRJ_ANDERSON_AC_I3_O3" ]; then name=ac_in3_out3_anderson elif [ "$1" = "PRJ_USASL_AC_I3_O1" ]; then name=ac_in3_out1_usa_sl elif [ "$1" = "PRJ_USASL_AC_I3_O3" ]; then name=ac_in3_out3_usa_sl elif [ "$1" = "PRJ_HYPERTEC_AC_I3_O1" ]; then name=ac_in3_out1_hypertec cp -f $custdir/logo/logo_hypertec.png $appdir/image/logo.png elif [ "$1" = "PRJ_INSPUR_DC_I_DC_O" ]; then name=dc_in1_out1_inspur elif [ "$1" = "PRJ_INSPUR_DC_I_DC_O_NEW_96" ]; then name=dc_in1_out1_inspur_new_96 cp -f $custdir/logo/upulsepower.png $appdir/image/logo.png elif [ "$1" = "PRJ_STSC_I3_O3" ]; then name=ac_in3_out3_stsc elif [ "$1" = "PRJ_SG_I3_O3" ]; then name=ac_in2_out1_sg24016 elif [ "$1" = "PRJ_TEST" ]; then name=ac_in3_out1_test elif [ "$1" = "PRJ_TEST_AC_I1_O1" ]; then name=ac_in1_out1_test elif [ "$1" = "PRJ_TEST_AC_I3_O1" ]; then name=ac_in3_out1_test elif [ "$1" = "PRJ_TEST_AC_I3_O3" ]; then name=ac_in3_out3_test elif [ "$1" = "PRJ_TEST" ]; then name=ac_in3_out1_test elif [ "$1" = "PRJ_IP_AC_I3_O3" ];then name=ac_in3_out3_ip elif [ "$1" = "PRJ_YST_AC_I1_O1" ];then name=ac_in1_out1_YST elif [ "$1" = "PRJ_BYD_UPS_AC_I1_O1" ];then name=ac_in1_out1_byd_ups cp -f $custdir/db/pdu_dat_byd_ups.db $appdir/pdu_dat.db elif [ "$1" = "PRJ_INST2302_DC_OLED" ];then name=dc_in_dc_out_oled rm -f $appdir/Qt_Test elif [ "$1" = "PRJ_INST2106_AC_I1_O1_OLED" ];then name=ac_in1_out1_inst2106_oled rm -f $appdir/Qt_Test elif [ "$1" = "PRJ_STSC_I3_O1_OLED" ];then name=ac_in3_out1_stsc_oled rm -f $appdir/Qt_Test elif [ "$1" = "PRJ_ESOUTH_DC_I1_O4_RGB5" ];then name=dc_in1_out4_esouth_rgb5 cp -f $custdir/qt/rgb/Qt_Test $appdir/ cp -rf $custdir/qt/rgb/image_qt $appdir/ cp -f $custdir/qt/rgb/S90PDUApp $rootdir/etc/init.d/ elif [ "$1" = "PRJ_IP_AC_I3_O1" ];then name=ip_ac_in3_out1_release elif [ "$1" = "PRJ_IP_AC_I1_O1" ];then name=ip_ac_in1_out1_release elif [ "$1" = "PRJ_IP_YUNNAN_AC_I1_O1" ];then name=ip_ac_yunnan_in1_out1_release elif [ "$1" = "PRJ_YUNNAN_AC_I1_O1" ];then name=ac_yunnan_in1_out1_release cp -f $custdir/logo/logo_gowone.png $appdir/image/logo.png elif [ "$1" = "PRJ_GOWONE_125A_AC_I3_O1" ];then name=ac_in3_out1_gowone_125A cp -f $custdir/logo/logo_gowone.png $appdir/image/logo.png elif [ "$1" = "PRJ_DUALWIRES_AC_I3_O2" ];then name=ac_DualWires_in3_out2_release elif [ "$1" = "PRJ_TIDA_AC_I3_O1" ];then name=ac_tida_in3_out1_release elif [ "$1" = "PRJ_IP_CHONGQING_AC_I1_O1" ];then cp -f $custdir/logo/logo_gowone.png $appdir/image/logo.png name=ip_ac_chongqing_in1_out1_release elif [ "$1" = "PRJ_IP_AOSENS_AC_I1_O1" ];then # cp -f $custdir/logo/logo_aosens.png $appdir/image/logo.png name=ip_ac_in1_out1_release elif [ "$1" = "PRJ_IP_AOSENS_DC_I_O" ]; then cp -f $custdir/logo/logo_aosens.png $appdir/image/logo.png name=ip_dc_aosens_in1_out1_release elif [ "$1" = "PRJ_Malaysia_AC_I3_O1" ];then name=ac_Malaysia_in3_out1_release cp -f $custdir/db/pdu_dat_malaysia_front.db $appdir/pdu_dat.db cp -f $custdir/logo/logo_litech.png $appdir/image/logo.png cp -f $custdir/qt/rgb_lcd/S90PDUApp $rootdir/etc/init.d/ elif [ "$1" = "PRJ_2405_AC_I1_O1_OLED" ];then name=ac_in1_out1_2405_OLED_release rm -f $appdir/Qt_Test elif [ "$1" = "PRJ_CHANGCHUN_AC_I1_O1_OLED" ];then name=ac_in1_out1_changchun_OLED_release rm -f $appdir/Qt_Test else echo error! $RPJ not define!!! exit 1 fi rm -rf $appdir/../web cp -rf $custdir/web/unique $appdir/../web prj_enable $1 } function do_compile() { echo do_compile ... cd $curdir/pro rm -rf build; mkdir build; cd build if [[ "$1" == "PRJ_IP_"* ]];then cmake .. -DCHIP=t113s && make else cmake .. -DCHIP=t113i && make fi if [ $? -gt 0 ]; then exit 1 fi } function do_pack() { echo do_pack ... if [[ "$1" == "PRJ_IP_"* ]];then $curdir/output/t113s/pack.sh else $curdir/output/t113i/pack.sh fi } function do_zip() { echo do_zip ... ztm=`date +%Y%m%d_%H%M%S` if [[ "$1" == "PRJ_IP_"* ]];then zname="upgrade_"$ztm"_$name" zdir=$curdir/output/t113s/push files="push.bat push_retain.bat pdutar tools/*" cd $zdir; zip -q $zname.zip $files mv $zname.zip $curdir/output/t113s/ else zname="upgrade_"$ztm"_$name" zdir=$curdir/output/t113i/push2 files="push.bat push_retain.bat pdutar tools/*" cd $zdir; zip -q $zname.zip $files mv $zname.zip $curdir/output/t113i/ fi } function do_one() { echo $PATH do_copy $1 do_compile $1 do_pack $1 do_zip $1 } function do_all() { for s in $PRJS; do do_one $s done } do_all