forked from public/airgap
34 lines
1.2 KiB
Bash
Executable File
34 lines
1.2 KiB
Bash
Executable File
#!/bin/bash
|
|
[ -f /.dockerenv ] || { echo "please run in supplied container"; exit 1; }
|
|
set -e
|
|
|
|
cat /etc/apt/packages-old.list | sed 's/=.*//g' \
|
|
> /etc/apt/packages.list
|
|
|
|
apt-get update
|
|
apt-get install -y --download-only $(cat /etc/apt/packages.list)
|
|
|
|
snapshot_date=$(date -d @${GIT_EPOCH} +"%Y%m%dT000000Z")
|
|
cat <<-EOF > /etc/apt/sources.list
|
|
deb https://deb.debian.org/debian buster main
|
|
deb https://snapshot.debian.org/archive/debian/${snapshot_date} buster main
|
|
deb https://security.debian.org/debian-security buster/updates main
|
|
deb https://snapshot.debian.org/archive/debian-security/${snapshot_date} buster/updates main
|
|
deb https://deb.debian.org/debian buster-updates main
|
|
deb https://snapshot.debian.org/archive/debian/${snapshot_date} buster-updates main
|
|
EOF
|
|
|
|
(
|
|
cd /var/cache/apt/archives \
|
|
&& find . -type f \( -iname \*.deb \) -exec sha256sum {} \; \
|
|
| sed 's/.\///g' \
|
|
| LC_ALL=C sort
|
|
) > /etc/apt/package-hashes.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}" >> /etc/apt/packages.list;
|
|
done
|