$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"
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";