blob: 771743fde8b328c507b38b6c9aec9b13414aa829 [file] [log] [blame]
Gertjan Van Droogenbroecke0c9acb2017-11-16 16:54:22 +01001#!/bin/bash
2if [ -f mvn_settings.custom.xml ] ; then
3 cp mvn_settings.custom.xml mvn_settings.xml
4 exit 0
5fi
6
7if [ "$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
31fi
32
33if [ -f mvn_settings.extra.xml ] ; then
34 sed -i 's/<!--EXTRA-->/r mvn_settings.extra.xml' mvn_settings.xml
35fi