installer: Cached apt indices for local pool

Add the apt indices for the additional source of packages on the live
medium. It allows for installing packages from that source without
running 'apt-get update' first
This commit is contained in:
Roland Clobus 2024-11-24 16:17:15 +01:00
parent f4b19cd8bf
commit 6f6376dd3b
No known key found for this signature in database
GPG Key ID: 62C57C6AA61495BD
1 changed files with 31 additions and 10 deletions

View File

@ -587,6 +587,21 @@ then
done
fi
# The path to the package pool when running inside the live environment
case "${LB_INITRAMFS}" in
live-boot)
PATH_TO_POOL_INSIDE_LIVE_ENVIRONMENT="/run/live/medium"
;;
dracut-live)
PATH_TO_POOL_INSIDE_LIVE_ENVIRONMENT="/run/initramfs/live"
;;
*)
PATH_TO_POOL_INSIDE_LIVE_ENVIRONMENT=""
;;
esac
# Generating deb indices
Echo_debug "Generating deb indices"
for _ARCHIVE_AREA in $(cd binary/pool && ls); do
@ -604,6 +619,12 @@ EOF
mv chroot/root/binary ./
touch "binary/${INDICE_DIR}/Packages" -d@${SOURCE_DATE_EPOCH}
if [ -n "${PATH_TO_POOL_INSIDE_LIVE_ENVIRONMENT}" ]
then
# Make the pool available without 'apt-get update'
VAR_LIB_APT_LISTS_FILENAME=$(echo "${PATH_TO_POOL_INSIDE_LIVE_ENVIRONMENT}/${INDICE_DIR}/Packages" | sed 's|/|_|g')
cp -a "binary/${INDICE_DIR}/Packages" "chroot/chroot/var/lib/apt/lists/${VAR_LIB_APT_LISTS_FILENAME}"
fi
gzip -9 -c "binary/${INDICE_DIR}/Packages" > "binary/${INDICE_DIR}/Packages.gz"
# Fetching release
@ -872,16 +893,16 @@ EOF
rm -f chroot/binary.sh
mv chroot/root/binary ./
# Add to sources.list with the path that is used inside the live environment
case "${LB_INITRAMFS}" in
live-boot)
echo "deb [trusted=yes] file:/run/live/medium ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/chroot/etc/apt/sources.list
;;
dracut-live)
echo "deb [trusted=yes] file:/run/initramfs/live ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" >> chroot/chroot/etc/apt/sources.list
;;
esac
if [ -n "${PATH_TO_POOL_INSIDE_LIVE_ENVIRONMENT}" ]
then
# Add to sources.list with the path that is used inside the live environment
# Add in the first line, to give it precedence over the online versions of the same package
echo "deb [trusted=yes] file:${PATH_TO_POOL_INSIDE_LIVE_ENVIRONMENT} ${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION} ${LB_PARENT_ARCHIVE_AREAS}" > sources.list
cat chroot/chroot/etc/apt/sources.list >> sources.list
cp sources.list chroot/chroot/etc/apt/sources.list
VAR_LIB_APT_LISTS_FILENAME=$(echo "${PATH_TO_POOL_INSIDE_LIVE_ENVIRONMENT}/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/Release" | sed 's|/|_|g')
cp -a binary/dists/${LB_PARENT_DEBIAN_INSTALLER_DISTRIBUTION}/Release chroot/chroot/var/lib/apt/lists/${VAR_LIB_APT_LISTS_FILENAME}
fi
Echo_debug "Creating distribution directories/symlinks"