[debian-edu-commits] r81486 - in branches/wheezy/debian-edu-config: debian share/debian-edu-config/tools

pere at alioth.debian.org pere at alioth.debian.org
Tue Jul 9 09:22:55 UTC 2013


Author: pere
Date: 2013-07-09 09:22:55 +0000 (Tue, 09 Jul 2013)
New Revision: 81486

Modified:
   branches/wheezy/debian-edu-config/debian/changelog
   branches/wheezy/debian-edu-config/share/debian-edu-config/tools/update-proxy-from-wpad
Log:
Adjust update-proxy-from-wpad to not set proxy in /etc/environment
on Standalone and Roaming Workstation installations, as the value
inherited to user processes from this file will get quickly out of
date as the machine move from network to network.  Only APT setup
will be updated on these machines when connecting to a new
network.

Modified: branches/wheezy/debian-edu-config/debian/changelog
===================================================================
--- branches/wheezy/debian-edu-config/debian/changelog	2013-07-09 09:13:15 UTC (rev 81485)
+++ branches/wheezy/debian-edu-config/debian/changelog	2013-07-09 09:22:55 UTC (rev 81486)
@@ -3,6 +3,12 @@
   [ Petter Reinholdtsen ]
   * Adjust locale check in test suite to the fact that locale is no
     longer set in /etc/environment.
+  * Adjust update-proxy-from-wpad to not set proxy in /etc/environment
+    on Standalone and Roaming Workstation installations, as the value
+    inherited to user processes from this file will get quickly out of
+    date as the machine move from network to network.  Only APT setup
+    will be updated on these machines when connecting to a new
+    network.
 
  -- Petter Reinholdtsen <pere at debian.org>  Tue, 09 Jul 2013 11:12:46 +0200
 

Modified: branches/wheezy/debian-edu-config/share/debian-edu-config/tools/update-proxy-from-wpad
===================================================================
--- branches/wheezy/debian-edu-config/share/debian-edu-config/tools/update-proxy-from-wpad	2013-07-09 09:13:15 UTC (rev 81485)
+++ branches/wheezy/debian-edu-config/share/debian-edu-config/tools/update-proxy-from-wpad	2013-07-09 09:22:55 UTC (rev 81486)
@@ -27,6 +27,57 @@
     fi
 }
 
+# Update /etc/environment with the current proxy settings extracted
+# from the WPAD file
+update_etc_environment() {
+    file=/etc/environment
+    touch $file
+    chmod a+r $file
+    sed -e "s%^http_proxy=.*%http_proxy=$http_proxy%" \
+	-e "s%^ftp_proxy=.*%ftp_proxy=$ftp_proxy%" \
+	-e "s%^https_proxy=.*%https_proxy=$https_proxy%" \
+	< $file > $file.new && chmod a+r $file.new
+
+# Only replace if new file have content and is different from the old
+# file
+    if [ ! -s $file.new ] || cmp -s $file.new $file ; then
+	rm $file.new
+    else
+	mv $file.new $file
+    fi
+    append_if_missing $file http_proxy=$http_proxy
+    append_if_missing $file ftp_proxy=$ftp_proxy
+    append_if_missing $file https_proxy=$https_proxy
+}
+
+# Make sure APT used from cron also get the wanted proxy settings
+# /etc/apt/apt.conf is created by debian-installer if a proxy was used
+# during installation, so we update this file.
+update_apt_conf() {
+    file=/etc/apt/apt.conf
+    touch $file
+    chmod a+r $file
+    sed -e "s%^Acquire::http::Proxy .*%Acquire::http::Proxy \"$http_proxy\";%" \
+	-e "s%^Acquire::ftp::Proxy .*%Acquire::ftp::Proxy \"$ftp_proxy\";%" \
+	-e "s%^Acquire::https::Proxy .*%Acquire::https::Proxy \"$https_proxy\";%" \
+	< $file > $file.new && chmod a+r $file.new
+
+    # Only replace if new file have content and is different from the
+    # old file
+    if [ ! -s $file.new ] || cmp -s $file.new $file ; then
+	rm $file.new
+    else
+	mv $file.new $file
+    fi
+    append_if_missing $file "Acquire::http::Proxy \"$http_proxy\";"
+    append_if_missing $file "Acquire::ftp::Proxy \"$ftp_proxy\";"
+    append_if_missing $file "Acquire::ftp::Proxy \"$https_proxy\";"
+}
+
+if [ -r /etc/debian-edu/config ] ; then
+    . /etc/debian-edu/config
+fi
+
 # Make sure to fetch the wpad file without proxy settings, to behave
 # like browsers who need to get their proxy settings without using a
 # proxy.
@@ -36,45 +87,12 @@
 ftp_proxy=$http_proxy
 https_proxy=$http_proxy
 
-# Update /etc/environment with the current proxy settings extracted
-# from the WPAD file
-file=/etc/environment
-touch $file
-chmod a+r $file
-sed -e "s%^http_proxy=.*%http_proxy=$http_proxy%" \
-    -e "s%^ftp_proxy=.*%ftp_proxy=$ftp_proxy%" \
-    -e "s%^https_proxy=.*%https_proxy=$https_proxy%" \
-    < $file > $file.new && chmod a+r $file.new
+update_apt_conf
 
-# Only replace if new file have content and is different from the old
-# file
-if [ ! -s $file.new ] || cmp -s $file.new $file ; then
-    rm $file.new
+# Do not set proxy in /etc/environment for machines that move around,
+# as the value will be wrong when arriving at a new network.
+if echo "$PROFILE" | egrep -q 'Roaming-Workstation|Standalone' ; then
+    :
 else
-    mv $file.new $file
+    update_etc_environment
 fi
-append_if_missing $file http_proxy=$http_proxy
-append_if_missing $file ftp_proxy=$ftp_proxy
-append_if_missing $file https_proxy=$https_proxy
-
-# Make sure APT used from cron also get the wanted proxy settings
-# /etc/apt/apt.conf is created by debian-installer if a proxy was used
-# during installation, so we update this file.
-file=/etc/apt/apt.conf
-touch $file
-chmod a+r $file
-sed -e "s%^Acquire::http::Proxy .*%Acquire::http::Proxy \"$http_proxy\";%" \
-    -e "s%^Acquire::ftp::Proxy .*%Acquire::ftp::Proxy \"$ftp_proxy\";%" \
-    -e "s%^Acquire::https::Proxy .*%Acquire::https::Proxy \"$https_proxy\";%" \
-    < $file > $file.new && chmod a+r $file.new
-
-# Only replace if new file have content and is different from the old
-# file
-if [ ! -s $file.new ] || cmp -s $file.new $file ; then
-    rm $file.new
-else
-    mv $file.new $file
-fi
-append_if_missing $file "Acquire::http::Proxy \"$http_proxy\";"
-append_if_missing $file "Acquire::ftp::Proxy \"$ftp_proxy\";"
-append_if_missing $file "Acquire::ftp::Proxy \"$https_proxy\";"




More information about the debian-edu-commits mailing list