ENV_TOON=`awk -F: 'BEGIN{};/toon_router_domain/{ gsub(/[[:blank:]]*/,"",$0);print $0 }' $SRCROOT/../README.MD`
ENV_CDTP=`awk -F: 'BEGIN{};/cdtp_dns_router/{ gsub(/[[:blank:]]*/,"",$0);print $0 }' $SRCROOT/../README.MD`
ENV_TOON=($ENV_TOON)
ENV_CDTP=($ENV_CDTP)
if [ ${#ENV_TOON[*]} -eq 2 -a ${#ENV_CDTP[*]} -eq 2 ]; then
ENV_TOON_DEVELOPMENT=${ENV_TOON[0]}
ENV_TOON_DEVELOPMENT=${ENV_TOON_DEVELOPMENT#*:}
ENV_TOON_RELEASE=${ENV_TOON[1]}
ENV_TOON_RELEASE=${ENV_TOON_RELEASE#*:}
ENV_CDTP_DEVELOPMENT=${ENV_CDTP[0]}
ENV_CDTP_DEVELOPMENT=${ENV_CDTP_DEVELOPMENT#*:}
ENV_CDTP_RELEASE=${ENV_CDTP[1]}
ENV_CDTP_RELEASE=${ENV_CDTP_RELEASE#*:}
else
echo 获取失败
exit 0
fi
echo $ENV_TOON_DEVELOPMENT
echo $ENV_CDTP_DEVELOPMENT
echo $ENV_TOON_RELEASE
echo $ENV_CDTP_RELEASE
info_plist=$SRCROOT/TLauncher/Info.plist
CURRENT_TOON_ENV=$(/usr/libexec/PlistBuddy -c 'Print toon_router_domain' $info_plist)
echo $CURRENT_TOON_ENV
if [ $ENV_TOON_DEVELOPMENT == $CURRENT_TOON_ENV ]; then
#echo 当前为测试环境
/usr/libexec/PlistBuddy -c "Set :toon_router_domain $ENV_TOON_RELEASE" $info_plist
/usr/libexec/PlistBuddy -c "Set :cdtp_dns_router $ENV_CDTP_RELEASE" $info_plist
echo 由之前测试环境修改为线上环境
else
#echo 当前为线上环境
/usr/libexec/PlistBuddy -c "Set :toon_router_domain $ENV_TOON_DEVELOPMENT" $info_plist
/usr/libexec/PlistBuddy -c "Set :cdtp_dns_router $ENV_CDTP_DEVELOPMENT" $info_plist
echo 由之前线上环境修改为测试环境
fi