Gertjan Van Droogenbroeck | cb3507d | 2017-11-16 16:54:22 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | if [ -f mvn_settings.custom.xml ] ; then |
| 3 | cp mvn_settings.custom.xml mvn_settings.xml |
| 4 | exit 0 |
| 5 | fi |
| 6 | |
| 7 | if [ "$http_proxy$https_proxy" != "" ] ; then |
| 8 | echo " <proxies>" >> mvn_settings.proxy.xml |
| 9 | for PROTOCOL in http https ; do |
| 10 | proxy="${PROTOCOL}_proxy" |
| 11 | proxy="${!proxy}" |
| 12 | if [ "$proxy" = "" ] ; then continue ; fi |
| 13 | |
| 14 | # username/password not yet included |
| 15 | PROXY_HOST=$(echo "$proxy" | sed "s@.*://@@;s/.*@//;s@:.*@@") |
| 16 | PROXY_PORT=$(echo "$proxy" | sed "s@.*://@@;s@.*:@@;s@/.*@@") |
| 17 | NON_PROXY=$(echo "$no_proxy" | sed "s@,@|@g") |
| 18 | |
| 19 | echo " <proxy> |
| 20 | <id>$PROTOCOL</id> |
| 21 | <active>true</active> |
| 22 | <protocol>$PROTOCOL</protocol> |
| 23 | <host>$PROXY_HOST</host> |
| 24 | <port>$PROXY_PORT</port> |
| 25 | <nonProxyHosts>$NON_PROXY</nonProxyHosts> |
| 26 | </proxy>" >> mvn_settings.proxy.xml |
| 27 | done |
| 28 | echo " </proxies>" >> mvn_settings.proxy.xml |
| 29 | |
| 30 | sed -i '/<!--PROXY-->/r mvn_settings.proxy.xml' mvn_settings.xml |
| 31 | fi |
| 32 | |
| 33 | if [ -f mvn_settings.extra.xml ] ; then |
| 34 | sed -i 's/<!--EXTRA-->/r mvn_settings.extra.xml' mvn_settings.xml |
| 35 | fi |