Added check to see if brokenproxy apt fix was already done previously on host debian...
authorAndrey Miroshnikov <andrey@technepisteme.xyz>
Sun, 12 Sep 2021 20:02:40 +0000 (21:02 +0100)
committerAndrey Miroshnikov <andrey@technepisteme.xyz>
Sun, 12 Sep 2021 20:02:40 +0000 (21:02 +0100)
mk-deb-chroot

index a30ef30152f3ede7f59a72259aca9f5b9936970b..c432d3f2ac35fed378e2657bd3ec85872b80760f 100755 (executable)
@@ -21,16 +21,27 @@ echo "Creating chroot dir '$chrootdir'"
 mkdir /opt/chroot/$chrootdir
 
 # argh apt with broken proxies and unreliable ISPs, getting fed up with it
-cat <<EOF >/tmp/brokenproxy
+if [ -e /tmp/brokenproxy ]; then
+    echo "Temp file containing apt proxy fix configuration already exists, skipping!"
+else
+    cat <<EOF >/tmp/brokenproxy
 APT::Acquire::Retries "20";
 APT::Get::Fix-Broken "true";
 Acquire::http::Pipeline-Depth "0";
 Acquire::http::No-Cache=True;
 Acquire::BrokenProxy=true;
 EOF
+fi
+
+if [ -e /etc/apt/apt.conf.d/80-retries ]; then
+    echo "Host system apt.conf.d already has 80-retries, skipping!"
+else
+    cp /tmp/brokenproxy /etc/apt/apt.conf.d/80-retries
+fi
+
+# No need to check if exists, this script always runs with new chroot
+cp /tmp/brokenproxy /opt/chroot/$chrootdir/etc/apt/apt.conf.d/80-retries
 
-cp /tmp/brokenproxy /etc/apt/apt.conf.d/80-retries
-cp /tmp/brokenproxy /opt/chroot/coriolis/etc/apt/apt.conf.d/80-retries
 
 # Install debootstrap and schroot
 if [ -e /etc/debian_version ]; then