airgap/scripts/apt-install

28 lines
778 B
Plaintext
Raw Normal View History

#!/usr/bin/env bash
set -e;
2020-10-16 09:44:26 +00:00
# Get latest apt-transport-https and ca-certificates for safer https apt
apt-get update
2020-10-16 09:44:26 +00:00
apt-get install -y apt-transport-https ca-certificates
mv /etc/apt/sources.list{.new,}
mv /etc/apt/packages.list{.new,}
apt-get update
until apt-get install --download-only --reinstall -y $(cat /etc/apt/packages.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/package-hashes-compare.txt
diff /etc/apt/package-hashes{,-compare}.txt
apt-get install -y $(cat /etc/apt/packages.list)
2020-10-16 09:44:26 +00:00
rm -rf /var/ache/apt/archives/* /var/lib/apt/lists/* /tmp/* /var/tmp/*;