diff mbox series

[OSSTEST,5/7] Debian mirror: Disable timestamp verification for snapshot.d.o

Message ID 20210209175904.28282-5-iwj@xenproject.org (mailing list archive)
State New, archived
Headers show
Series [OSSTEST,1/7] mg-debian-installer-update: Honour redirect for dtbs | expand

Commit Message

Ian Jackson Feb. 9, 2021, 5:59 p.m. UTC
This is kind of duplicative of the logic in preseed_backports_packages
but I don't want to mess with that now.

Signed-off-by: Ian Jackson <iwj@xenproject.org>
---
 Osstest.pm        |  2 ++
 Osstest/Debian.pm | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)
diff mbox series

Patch

diff --git a/Osstest.pm b/Osstest.pm
index 809194f0..7776ba88 100644
--- a/Osstest.pm
+++ b/Osstest.pm
@@ -246,6 +246,8 @@  sub readglobalconfig () {
     $c{DefaultBranch} ||= 'xen-unstable';
 
     $c{DebianMirrorHost} ||= 'ftp.debian.org' if $c{DebianMirrorProxy};
+    $c{DebianMirrorAllowExpiredReleaseRegexp} //=
+      qr{^\Qhttp://snapshot.debian.org/};
 
     $c{EmailStdHeaders} ||= <<'END';
 Content-Type: text/plain; charset="UTF-8"
diff --git a/Osstest/Debian.pm b/Osstest/Debian.pm
index dee52b3d..d6e0b59d 100644
--- a/Osstest/Debian.pm
+++ b/Osstest/Debian.pm
@@ -972,6 +972,22 @@  END
     preseed_hook_command($ho, 'late_command', $sfx,
 			 debian_dhcp_rofs_fix($ho, '/target'));
 
+    my $murl = debian_mirror_url($ho);
+    if ($murl =~ m/$c{DebianMirrorAllowExpiredReleaseRegexp}/) {
+	# Inspired by
+	#  https://stackoverflow.com/questions/25039317/is-there-any-setting-in-the-preseed-file-to-ignore-the-release-valid-until-opt/51396935#51396935
+	# In some sense a workaround for the lack of a better way,
+	#  https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=771699
+	preseed_hook_installscript($ho, $sfx,
+            '/usr/lib/apt-setup/generators/', '02IgnoreValidUntil', <<'END');
+#!/bin/sh
+set -ex
+d=/target/etc/apt/apt.conf.d/
+mkdir -p $d
+echo 'Acquire::Check-Valid-Until "false";' >$d/02IgnoreValidUntil
+END
+    }
+
     my ($mhost, $mpath) = debian_mirror_host_path($ho);
 
     my $preseed = <<"END";