Adjust proxy port parsing to only return number.

A simple robustness tweak to remove any trailing character,
like a / in "http://web-proxy.example.com:8080/", from
the parsed proxy port.

Change-Id: Iac75f8ae431b923b86dbd5835b1c48ca090e14e7
This commit is contained in:
Joseph Davis 2017-01-13 08:56:38 -08:00
parent c189feeb8b
commit f34176819d
1 changed files with 1 additions and 1 deletions

View File

@ -15,7 +15,7 @@ echo Move the settings.xml into place
ACTUAL_PROXY=`echo ${http_proxy} | awk 'BEGIN { FS = "//"} ;{ print $2 }'`
PROXY_HOST=`echo $ACTUAL_PROXY | awk 'BEGIN { FS = ":"} ;{ print $1 }'`
PROXY_PORT=`echo $ACTUAL_PROXY | awk 'BEGIN { FS = ":"} ;{ print $2 }'`
PROXY_PORT=`echo $ACTUAL_PROXY | awk 'BEGIN { FS = ":"} ;{ gsub("[^0-9]", "", $2) ; print $2 }'`
echo Assuming http proxy host = ${PROXY_HOST}, port = ${PROXY_PORT}
sed -i "s/proxy_host/${PROXY_HOST}/g" /home/ubuntu/settings.xml
sed -i "s/proxy_port/${PROXY_PORT}/g" /home/ubuntu/settings.xml