scripts/generate-bootstraps.sh: make architecture-independent (arch "all") package list optional

It is not available in some repository types, e.g. in built with "aptly".
This commit is contained in:
Leonid Pliushch 2021-04-13 13:16:04 +03:00
parent a6940e58e2
commit d0cea5ae00
No known key found for this signature in database
GPG Key ID: 45F2964132545795
1 changed files with 11 additions and 6 deletions

View File

@ -35,18 +35,23 @@ for cmd in ar awk curl grep gzip find sed tar xargs xz zip; do
done
# Download package lists from remote repository.
# Actually, there 2 lists are downloaded: one architecture-independent and one
# for architecture specified as '$1' argument.
# Actually, there 2 lists can be downloaded: one architecture-independent and
# one for architecture specified as '$1' argument. That depends on repository.
# If repository has been created using "aptly", then architecture-independent
# list is not available.
read_package_list() {
local architecture
for architecture in all "$1"; do
if [ ! -e "${BOOTSTRAP_TMPDIR}/packages.${architecture}" ]; then
echo "[*] Downloading package list for architecture '${architecture}'..."
curl \
--fail \
--location \
if ! curl --fail --location \
--output "${BOOTSTRAP_TMPDIR}/packages.${architecture}" \
"${REPO_BASE_URL}/dists/stable/main/binary-${architecture}/Packages"
"${REPO_BASE_URL}/dists/stable/main/binary-${architecture}/Packages"; then
if [ "$architecture" = "all" ]; then
echo "[!] Skipping architecture-independent package list as not available..."
continue
fi
fi
echo >> "${BOOTSTRAP_TMPDIR}/packages.${architecture}"
fi