#!/bin/bash [ -f /.dockerenv ] || { echo "please run in supplied container"; exit 1; } set -e cat /config/packages-base.list | sed 's/=.*//g' > /etc/apt/packages.list snapshot_url="http://snapshot.debian.org/archive/debian" snapshot_date=$(date +"%Y%m%dT000000Z") cat <<-EOF > /etc/apt/sources.list deb http://deb.debian.org/debian bullseye main deb http://security.debian.org/debian-security bullseye-security main deb http://deb.debian.org/debian bullseye-updates main deb [check-valid-until=no] ${snapshot_url}/${snapshot_date} bullseye main deb [check-valid-until=no] ${snapshot_url}-security/${snapshot_date} bullseye-security main deb [check-valid-until=no] ${snapshot_url}/${snapshot_date} bullseye-updates main EOF ARCH=$(uname -m) apt-get update apt-get install -y --download-only --reinstall $( \ dpkg-query \ -W \ -f='${db:Status-Abbrev}\t${binary:Package} - ${binary:Summary}\n' \ | awk -F'\t' '/^ii/ {print $2}' \ | awk '{print $1}' \ ) apt-get install -y --download-only $(cat /config/packages-${ARCH}.list) ( cd /var/cache/apt/archives \ && find . -type f \( -iname \*.deb \) -exec sha256sum {} \; \ | sed 's/.\///g' \ | LC_ALL=C sort ) > /config/package-hashes-${ARCH}.txt cp /dev/null /etc/apt/packages.list for deb in /var/cache/apt/archives/*.deb; do package=$(dpkg-deb -f $deb Package); version=$(dpkg --info ${deb} | grep "^ Version: " | sed 's/^ Version: //g'); echo "${package}=${version}" >> /config/packages-${ARCH}.list; done