#PRJS="PRJ_XIAN_AC_I1_O1_P4" #PRJS="PRJ_XIAN_AC_I1_O1_P8" #PRJS="PRJ_ITK_AC_I1_O1" #PRJS="PRJ_ITK_AC_I3_O1" #PRJS="PRJ_LITECH_AC_I1_O1" #PRJS="PRJ_LITECH_AC_I3_O1" #PRJS="PRJ_ANDERSON_AC_I3_O3" #PRJS="PRJ_USASL_AC_I3_O1" #PRJS="PRJ_USASL_AC_I3_O3" #PRJS="PRJ_HYPERTEC_AC_I3_O1" #PRJS="PRJ_INSPUR_DC_I_DC_O" #PRJS="PRJ_RELEASE_DC_I_DC_O" #PRJS="PRJ_RELEASE_AC_I1_O1" #PRJS="PRJ_RELEASE_AC_I3_O1" #PRJS="PRJ_RELEASE_AC_I3_O3" #PRJS="PRJ_STSC_I3_O3" #PRJS="PRJ_SG_I3_O3" PRJS="PRJ_TEST" #PRJS="PRJ_TEST_AC_I1_O1" #PRJS="PRJ_TEST_AC_I3_O1" #PRJS="PRJ_USASL_AC_I3_O1 PRJ_USASL_AC_I3_O3" #PRJS="PRJ_XIAN_AC_I1_O1_P4 PRJ_XIAN_AC_I1_O1_P8" #PRJS="PRJ_ITK_AC_I1_O1 PRJ_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" fulldir=$(realpath $0) curdir=$(dirname $fulldir) custdir=$curdir/cust_data name=null function prj_enable() { fcfg=$curdir/pro/config/cfg.h #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 ... flag=0 rm -f $curdir/output/t113i/etc/network/interfaces mkdir -p $curdir/output/t113i/root/run/app/image mkdir -p $curdir/output/t113i/root/run/app/cert cp -f $custdir/cert/server.* $curdir/output/t113i/root/run/app/cert/ cp -f $custdir/changes.txt $curdir/output/t113i/root/run/app/ cp -f $custdir/db/pdu_dat.db $curdir/output/t113i/root/run/app/pdu_dat.db if [ "$1" = "PRJ_XIAN_AC_I1_O1_P4" ]; then name=ac_in1_out1_p4_xian cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_XIAN_AC_I1_O1_P8" ]; then name=ac_in1_out1_p8_xian cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_ITK_AC_I1_O1" ]; then name=ac_in1_out1_russia_itk cp -f $custdir/db/pdu_dat_itk.db $curdir/output/t113i/root/run/app/pdu_dat.db cp -f $custdir/logo/logo_itk.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_ITK_AC_I3_O1" ]; then name=ac_in3_out1_russia_itk cp -f $custdir/logo/logo_itk.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_RELEASE_DC_I_DC_O" ]; then name=dc_in_dc_out_release cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_RELEASE_AC_I1_O1" ]; then name=ac_in1_out1_release cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_RELEASE_AC_I3_O1" ]; then name=ac_in3_out1_release cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_RELEASE_AC_I3_O3" ]; then name=ac_in3_out3_release cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_LITECH_AC_I1_O1" ]; then name=ac_in1_out1_litech cp -f $custdir/logo/logo_litech.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_LITECH_AC_I3_O1" ]; then name=ac_in3_out1_litech cp -f $custdir/logo/logo_litech.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_ANDERSON_AC_I3_O3" ]; then name=ac_in3_out3_anderson flag=1 cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_USASL_AC_I3_O1" ]; then name=ac_in3_out1_usa_sl cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_USASL_AC_I3_O3" ]; then name=ac_in3_out3_usa_sl cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_HYPERTEC_AC_I3_O1" ]; then name=ac_in3_out1_hypertec cp -f $custdir/logo/logo_hypertec.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_INSPUR_DC_I_DC_O" ]; then name=dc_in1_out1_inspur cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_STSC_I3_O3" ]; then name=ac_in3_out3_stsc cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_SG_I3_O3" ]; then name=ac_in2_out1_sg24016 cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_TEST" ]; then name=ac_in3_out1_test cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_TEST_AC_I1_O1" ]; then name=ac_in1_out1_test cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_TEST_AC_I3_O1" ]; then name=ac_in3_out1_test cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png elif [ "$1" = "PRJ_TEST" ]; then name=ac_in3_out1_test cp -f $custdir/logo/logo_neuter.png $curdir/output/t113i/root/run/app/image/logo.png else echo error! $RPJ not define!!! exit 1 fi rm -rf $curdir/output/t113i/root/run/web if [ $flag -eq 0 ]; then cp -rf $custdir/web/general $curdir/output/t113i/root/run/web else cp -rf $custdir/web/anderson $curdir/output/t113i/root/run/web fi prj_enable $1 } function do_compile() { echo do_compile ... cd $curdir/pro rm -rf build; mkdir build; cd build cmake .. && make if [ $? -gt 0 ]; then exit 1 fi } function do_pack() { echo do_pack ... $curdir/output/pack.sh } function do_zip() { echo do_zip ... ztm=`date +%Y%m%d_%H%M%S` zname="upgrade_"$ztm"_$name" zdir=$curdir/output/push files="push.bat pdutar tools/*" cd $zdir; zip -q $zname.zip $files mv $zname.zip $curdir/output/ } function do_one() { do_copy $1 do_compile do_pack do_zip } function do_all() { for s in $PRJS; do do_one $s done } do_all