[debian-edu-commits] [Git][debian-edu/debian-edu-config][master] 2 commits: share/debian-edu-config/tools/update-proxy-from-wpad: Fix typo (wrong protocol...

Mike Gabriel (@sunweaver) gitlab at salsa.debian.org
Sun Jan 30 21:57:42 GMT 2022



Mike Gabriel pushed to branch master at Debian Edu / debian-edu-config


Commits:
d9125a68 by Mike Gabriel at 2022-01-30T22:47:11+01:00
share/debian-edu-config/tools/update-proxy-from-wpad: Fix typo (wrong protocol in APT proxy config creation.

- - - - -
a8ef043c by Mike Gabriel at 2022-01-30T22:56:19+01:00
share/debian-edu-config/tools/update-proxy-from-wpad: Create a Debian Edu specific proxy configuration in /etc/apt/apt.conf.d/ named 03debian-edu-config rather than meddling with /etc/apt/apt.conf directly. Clean-up any earlier meddling from apt.conf, as well. (Closes: #1003560).

- - - - -


2 changed files:

- debian/changelog
- share/debian-edu-config/tools/update-proxy-from-wpad


Changes:

=====================================
debian/changelog
=====================================
@@ -41,6 +41,12 @@ debian-edu-config (2.12.16) UNRELEASED; urgency=medium
     - share/debian-edu-config/tools/: Add new update-dlw-krb5-keytabs script and
       call it (with delay) from gosa-modify-host hook script.
     - (Closes: #613167)
+  * share/debian-edu-config/tools/update-proxy-from-wpad:
+    - Fix typo (wrong protocol) in APT proxy config creation.
+    - Create a Debian Edu specific proxy configuration in /etc/apt/apt.conf.d/
+      named 03debian-edu-config rather than meddling with /etc/apt/apt.conf
+      directly. Clean up any earlier meddling from apt.conf, as well. (Closes:
+      #1003560).
 
  -- Mike Gabriel <sunweaver at debian.org>  Fri, 14 Jan 2022 22:21:27 +0100
 


=====================================
share/debian-edu-config/tools/update-proxy-from-wpad
=====================================
@@ -27,6 +27,18 @@ append_if_missing() {
     fi
 }
 
+remove_if_matches() {
+    file="$1"
+    shift
+    regexp="$@"
+    if [ -e "$file" ] ; then
+	if grep -qE "$regexp" "$file" ; then
+	    log "Removing line matching '$regexp' from $file."
+	    sed -i $file -e "/$regexp/d"
+	fi
+    fi
+}
+
 # Update /etc/environment with the current proxy settings extracted
 # from the WPAD file
 update_etc_environment() {
@@ -54,7 +66,7 @@ update_etc_environment() {
 # /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
+    file=/etc/apt/apt.conf.d/03debian-edu-config
     touch $file
     chmod a+r $file
     sed -e "s%^Acquire::http::Proxy .*%Acquire::http::Proxy \"$http_proxy\";%" \
@@ -71,7 +83,17 @@ update_apt_conf() {
     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\";"
+    append_if_missing $file "Acquire::https::Proxy \"$https_proxy\";"
+
+    # Fix main /etc/apt/apt.conf file (which we used until Debian Edu bullseye).
+    #
+    # FIXME: This code portion can be removed in the bookworm+1 release cycle
+    previously_used_file=/etc/apt/apt.conf
+    if [ -e $previously_used_file ]; then
+	remove_if_matches $previously_used_file ".*Acquire::http::Proxy\ .*;"
+	remove_if_matches $previously_used_file ".*Acquire::ftp::Proxy\ .*;"
+	remove_if_matches $previously_used_file ".*Acquire::https::Proxy\ .*;"
+    fi
 }
 
 if [ -r /etc/debian-edu/config ] ; then



View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/27f3867fbf6d4d92d42b16f45d60d9276f2f0ba1...a8ef043c0cc3380173126ff06c6bf0ffdee33484

-- 
View it on GitLab: https://salsa.debian.org/debian-edu/debian-edu-config/-/compare/27f3867fbf6d4d92d42b16f45d60d9276f2f0ba1...a8ef043c0cc3380173126ff06c6bf0ffdee33484
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/debian-edu-commits/attachments/20220130/5e15ee0b/attachment-0001.htm>


More information about the debian-edu-commits mailing list