moved proxy_config to seperate file

This commit is contained in:
tke
2019-11-19 14:49:58 +01:00
parent ff0d64284b
commit 3cccfb530d
3 changed files with 30 additions and 18 deletions

21
proxy/get_proxy.sh Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/bash
proxy_ip=$(env | grep http_proxy | grep -Pio '[^@/:]+(?=:\d+/?$)')
proxy_port=$(env | grep http_proxy | grep -Pio '(?<=:)(\d+)(?=/?$)')
if [ -z "${proxy_ip}" ]; then
echo "Enter Proxy IP or Hostname (no port): "
read proxy_ip
else
echo "Using >>${proxy_ip}<< as Proxy-Address"
fi
if [ -z "${proxy_port}" ]; then
echo -n "Proxy-Port: "
read proxy_port
else
echo "Using >>${proxy_port}<< as Proxy-Port"
fi
echo "Using ${proxy_ip}:${proxy_port} as Proxy!"

View File

@@ -1,18 +1,6 @@
#!/bin/bash #!/bin/bash
path=$(dirname $(readlink -f "${0}"))
proxy_ip=$(env | grep http_proxy | grep -Pio '[^@/:]+(?=:\d+/?$)') . "${path}/get_proxy.sh"
proxy_port=$(env | grep http_proxy | grep -Pio '(?<=:)(\d+)(?=/?$)')
if [ -z "${proxy_ip}" ]; then
echo "Enter Proxy IP or Hostname (no port): "
read proxy_ip
fi
if [ -z "${proxy_ip}" ]; then
echo -n "Proxy-Port: "
read proxy_port
fi
echo "Using ${proxy_ip}:${proxy_port} as Proxy!"
echo -n "Username: " echo -n "Username: "
read username read username

View File

@@ -1,9 +1,12 @@
#!/bin/bash #!/bin/bash
#proxy_ip="192.168.x.x"
proxy_port="8080"
echo -n "Proxy_IP: "
read proxy_ip
#populate proxy_ip and proxy_port variables
path=$(dirname $(readlink -f "${0}"))
. "${path}/get_proxy.sh"
echo -n "Username: " echo -n "Username: "
read username read username
echo -n "Password: " echo -n "Password: "