From e58007ee18e7c8c80283668b105f5749b8eca7d3 Mon Sep 17 00:00:00 2001 From: Sumit Ghosh Date: Sat, 3 Jun 2017 06:32:34 +0530 Subject: [PATCH 1/4] Add support for capitalised proxy environment variables Fixes #22 --- environment.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/environment.sh b/environment.sh index 06acbe0..10ae3a5 100644 --- a/environment.sh +++ b/environment.sh @@ -73,6 +73,7 @@ unset_proxy() { return fi sed -i "/proxy\=/d" /etc/environment + sed -i "/PROXY\=/d" /etc/environment } set_proxy() { @@ -91,6 +92,9 @@ set_proxy() { echo "http_proxy=\"http$newvar\"" >> bash_config.tmp echo "https_proxy=\"https$newvar\"" >> bash_config.tmp echo "ftp_proxy=\"ftp$newvar\"" >> bash_config.tmp + echo "HTTP_PROXY=\"http$newvar\"" >> bash_config.tmp + echo "HTTPS_PROXY=\"https$newvar\"" >> bash_config.tmp + echo "FTP_PROXY=\"ftp$newvar\"" >> bash_config.tmp cat bash_config.tmp | tee -a /etc/environment > /dev/null rm bash_config.tmp @@ -100,6 +104,9 @@ set_proxy() { echo "http_proxy=\"http://$var$1:$2\"" >> bash_config.tmp echo "https_proxy=\"https://$var$7:$8\"" >> bash_config.tmp echo "ftp_proxy=\"ftp://$var$9:$10\"" >> bash_config.tmp + echo "HTTP_PROXY=\"http://$var$1:$2\"" >> bash_config.tmp + echo "HTTPS_PROXY=\"https://$var$7:$8\"" >> bash_config.tmp + echo "FTP_PROXY=\"ftp://$var$9:$10\"" >> bash_config.tmp fix_new_line "/etc/environment" cat bash_config.tmp | tee -a /etc/environment > /dev/null From 7f8db216529663eb94f46f5b598d4e778a4a3c6a Mon Sep 17 00:00:00 2001 From: Sumit Ghosh Date: Sat, 3 Jun 2017 17:52:49 +0530 Subject: [PATCH 2/4] Modify bash.sh --- bash.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/bash.sh b/bash.sh index 47935c6..5f2f1af 100644 --- a/bash.sh +++ b/bash.sh @@ -72,6 +72,7 @@ unset_proxy() { return fi sed -i "/proxy\=/d" $HOME/.bashrc + sed -i "/PROXY\=/d" $HOME/.bashrc } set_proxy() { @@ -90,6 +91,9 @@ set_proxy() { echo "http_proxy=\"http$newvar\"" >> bash_config.tmp echo "https_proxy=\"https$newvar\"" >> bash_config.tmp echo "ftp_proxy=\"ftp$newvar\"" >> bash_config.tmp + echo "HTTP_PROXY=\"http$newvar\"" >> bash_config.tmp + echo "HTTPS_PROXY=\"https$newvar\"" >> bash_config.tmp + echo "FTP_PROXY=\"ftp$newvar\"" >> bash_config.tmp fix_new_line $HOME/.bashrc cat bash_config.tmp | tee -a $HOME/.bashrc > /dev/null @@ -100,6 +104,9 @@ set_proxy() { echo "http_proxy=\"http://$var$1:$2\"" >> bash_config.tmp echo "https_proxy=\"https://$var$7:$8\"" >> bash_config.tmp echo "ftp_proxy=\"ftp://$var$9:$10\"" >> bash_config.tmp + echo "HTTP_PROXY=\"http://$var$1:$2\"" >> bash_config.tmp + echo "HTTPS_PROXY=\"https://$var$7:$8\"" >> bash_config.tmp + echo "FTP_PROXY=\"ftp://$var$9:$10\"" >> bash_config.tmp cat bash_config.tmp | tee -a $HOME/.bashrc > /dev/null rm bash_config.tmp From b4ae66e73a9ffd664b488f9e482931892b8f18cb Mon Sep 17 00:00:00 2001 From: Sumit Ghosh Date: Wed, 21 Jun 2017 14:56:27 +0530 Subject: [PATCH 3/4] Added case insensitive grep in the list_proxy functions --- apt.sh | 1 - bash.sh | 4 ++-- environment.sh | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/apt.sh b/apt.sh index 72264a6..3431672 100644 --- a/apt.sh +++ b/apt.sh @@ -54,7 +54,6 @@ list_proxy() { if [ "$lines" -gt 0 ]; then cat /etc/apt/apt.conf | grep proxy -i | sed -e "s/Acquire//g" -e "s/\:\:/\ /g" -e "s/\;//g" else - echo -e "\e[36m None \e[0m" fi } diff --git a/bash.sh b/bash.sh index 5f2f1af..1ead12f 100644 --- a/bash.sh +++ b/bash.sh @@ -59,9 +59,9 @@ fix_new_line() { list_proxy() { echo echo -e "\e[1m Bash proxy settings \e[0m" - lines="$(cat $HOME/.bashrc | grep proxy | wc -l)" + lines="$(cat $HOME/.bashrc | grep proxy -i | wc -l)" if [ "$lines" -gt 0 ]; then - cat $HOME/.bashrc | grep proxy | sed "s/\=/\ /g" + cat $HOME/.bashrc | grep proxy -i | sed "s/\=/\ /g" else echo -e "\e[36m None \e[0m" fi diff --git a/environment.sh b/environment.sh index 10ae3a5..3bda626 100644 --- a/environment.sh +++ b/environment.sh @@ -60,9 +60,9 @@ fix_new_line() { list_proxy() { echo echo -e "\e[1m Environment proxy settings \e[0m" - lines="$(cat /etc/environment | grep proxy | wc -l)" + lines="$(cat /etc/environment | grep proxy -i | wc -l)" if [ "$lines" -gt 0 ]; then - cat "/etc/environment" | grep proxy | sed "s/\=/\ /g" + cat "/etc/environment" | grep proxy -i | sed "s/\=/\ /g" else echo -e "\e[36m None \e[0m" fi From d1fb46e8603b5b4c82949db7416c308a44538190 Mon Sep 17 00:00:00 2001 From: Sumit Ghosh Date: Thu, 22 Jun 2017 11:23:24 +0530 Subject: [PATCH 4/4] Fix the mistake in apt.sh --- apt.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/apt.sh b/apt.sh index 3431672..72264a6 100644 --- a/apt.sh +++ b/apt.sh @@ -54,6 +54,7 @@ list_proxy() { if [ "$lines" -gt 0 ]; then cat /etc/apt/apt.conf | grep proxy -i | sed -e "s/Acquire//g" -e "s/\:\:/\ /g" -e "s/\;//g" else + echo -e "\e[36m None \e[0m" fi }