This repository has been archived on 2024-12-14. You can view files and clone it, but cannot push or open issues or pull requests.
toolchain/scripts/packages-fetch

35 lines
840 B
Bash
Executable File

#!/bin/bash
[ -f /.dockerenv ] || { echo "please run in supplied container"; exit 1; }
set -e
ARCH=$(uname -m)
cp -R /config/* /etc/apt/
apt update -o Acquire::Check-Valid-Until=false
until apt-get install \
--download-only \
--allow-downgrades \
-o Acquire::Check-Valid-Until=false \
-y $(cat /etc/apt/apt-pins-${ARCH}.list);
do
echo "apt install failed. Likely throttled. Retrying in 10 mins...";
sleep 600;
done;
(
cd /var/cache/apt/archives \
&& find . -type f \( -iname \*.deb \) -exec sha256sum {} \; \
| sed 's/.\///g' \
| LC_ALL=C sort
) > /etc/apt/apt-hashes-${ARCH}-compare.list
diff /etc/apt/apt-hashes-${ARCH}{,-compare}.list
mkdir -p /fetch/apt
mv /var/cache/apt/archives/*.deb /fetch/apt/
apt-get install -y dpkg-dev
env -C /fetch dpkg-scanpackages apt | bzip2 > /fetch/apt/Packages.bz2