File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -22,8 +22,25 @@ if [ -z "$PKG_LIST" ]; then
2222 exit 1
2323fi
2424
25- echo " deb [check-valid-until=no] http://snapshot.debian.org/archive/debian/${SNAPSHOT_DATE} bookworm main" > /etc/apt/sources.list
26- echo " deb [check-valid-until=no] http://snapshot.debian.org/archive/debian-security/${SNAPSHOT_DATE} bookworm-security main" >> /etc/apt/sources.list
25+ # Detect base image suite (e.g. bookworm, trixie). Different Debian releases
26+ # ship different sources layouts (legacy sources.list vs deb822
27+ # sources.list.d/*.sources), so we must wipe both and rewrite from scratch
28+ # pointing at the frozen snapshot for this exact suite. Otherwise the base
29+ # image's default live sources stay active and packages drift on every build.
30+ # shellcheck source=/dev/null
31+ SUITE=$( . /etc/os-release && echo " ${VERSION_CODENAME:- } " )
32+ if [ -z " $SUITE " ]; then
33+ echo " could not detect Debian suite from /etc/os-release" >&2
34+ exit 1
35+ fi
36+
37+ rm -f /etc/apt/sources.list
38+ rm -f /etc/apt/sources.list.d/* .list /etc/apt/sources.list.d/* .sources
39+
40+ cat > /etc/apt/sources.list << EOF
41+ deb [check-valid-until=no] http://snapshot.debian.org/archive/debian/${SNAPSHOT_DATE} ${SUITE} main
42+ deb [check-valid-until=no] http://snapshot.debian.org/archive/debian-security/${SNAPSHOT_DATE} ${SUITE} -security main
43+ EOF
2744echo ' Acquire::Check-Valid-Until "false";' > /etc/apt/apt.conf.d/10no-check-valid-until
2845
2946mkdir -p /etc/apt/preferences.d
You can’t perform that action at this time.
0 commit comments