aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Popov <alex.popov@linux.com>2024-05-02 16:24:54 +0300
committerDmitry Vyukov <dvyukov@google.com>2024-05-03 12:12:18 +0000
commit45c5511eed4c3a9d73afd8b3a5be58984b9189a0 (patch)
treefe5a877fa32572b14bfcd4b9aa24595c21aef869
parent25f385e1265b1da418ca710cef51c4426f6e2589 (diff)
tools/create-image.sh: support creating old EoL Debian images
Try using `archive.debian.org` and old keys from the Debian keyring if debootstrap fails. This improvement allows the following scenario: ``` sh create-image.sh -s 4096 -d wheezy ``` Signed-off-by: Alexander Popov <alex.popov@linux.com>
-rwxr-xr-xtools/create-image.sh11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/create-image.sh b/tools/create-image.sh
index d73b8eeb2..4d2b3458c 100755
--- a/tools/create-image.sh
+++ b/tools/create-image.sh
@@ -144,7 +144,16 @@ fi
if [ $DEBARCH == "riscv64" ]; then
DEBOOTSTRAP_PARAMS="--keyring /usr/share/keyrings/debian-ports-archive-keyring.gpg --exclude firmware-atheros $DEBOOTSTRAP_PARAMS http://deb.debian.org/debian-ports"
fi
-sudo --preserve-env=http_proxy,https_proxy,ftp_proxy,no_proxy debootstrap $DEBOOTSTRAP_PARAMS
+
+# debootstrap may fail for EoL Debian releases
+RET=0
+sudo --preserve-env=http_proxy,https_proxy,ftp_proxy,no_proxy debootstrap $DEBOOTSTRAP_PARAMS || RET=$?
+
+if [ $RET != 0 ] && [ $DEBARCH != "riscv64" ]; then
+ # Try running debootstrap again using the Debian archive
+ DEBOOTSTRAP_PARAMS="--keyring /usr/share/keyrings/debian-archive-removed-keys.gpg $DEBOOTSTRAP_PARAMS https://archive.debian.org/debian-archive/debian/"
+ sudo --preserve-env=http_proxy,https_proxy,ftp_proxy,no_proxy debootstrap $DEBOOTSTRAP_PARAMS
+fi
# 2. debootstrap stage: only necessary if target != host architecture