Fix build with local offline mirrors
Commit a15b579652
(#775989) dropped an early exit from the
chroot_archives remove step in case the parent mirror chroot and binary
parameters are the same and introduced a regression, as with the
following live-build now fails when the parent mirror is using a file:/
local apt repository (for example when the build worker is offline and
uses a pre-built cache of packages).
Example config:
lb config --mirror-bootstrap "file:/pkgs" \
--mirror-chroot "file:/pkgs/" \
--mirror-binary "file:/pkgs" \
--parent-mirror-bootstrap "file:/pkgs" \
--parent-mirror-chroot "file:/pkgs/" \
--parent-mirror-binary "file:/pkgs" \
...
with /pkgs being a directory with the packages for the installation and
the apt metadata (Packages/Sources/Release).
The problem is that, with such a setup, the /pkgs directory is bind
mounted inside the chroot as an optimisation in the install step,
and umounted as one of the first actions in the remove step for
chroot_archives.
Before that fix, the script terminated immediately. But now it
progresses and at the end it tries to run apt update inside the chroot
which will fail since the repository directory has been umounted, and
thus the packages and the apt metadata are no longer available, while
still being listed in /etc/apt/sources.list.
The proposed solution is to umount the local directory at the end of
the remove step, rather than at the beginning.
Closes: #891206
This commit is contained in:
parent
96e73960b3
commit
9a0c6102fd
|
@ -449,12 +449,6 @@ EOF
|
|||
mv chroot/etc/apt/sources.list.d/zz-sources.list chroot/etc/apt/sources.list
|
||||
fi
|
||||
|
||||
# Unmount local repository
|
||||
if echo "${LB_PARENT_MIRROR_CHROOT}" | grep -q '^file:/'
|
||||
then
|
||||
Chroot_unbind_path chroot "$(echo ${LB_PARENT_MIRROR_CHROOT} | sed -e 's|file:||')"
|
||||
fi
|
||||
|
||||
# Configure generic indices
|
||||
# Cleaning apt list cache
|
||||
rm -rf chroot/var/lib/apt/lists
|
||||
|
@ -652,6 +646,12 @@ EOF
|
|||
# Updating indices
|
||||
Apt chroot update
|
||||
|
||||
# Unmount local repository - after apt update or it will fail due to missing files
|
||||
if echo "${LB_PARENT_MIRROR_CHROOT}" | grep -q '^file:/'
|
||||
then
|
||||
Chroot_unbind_path chroot "$(echo ${LB_PARENT_MIRROR_CHROOT} | sed -e 's|file:||')"
|
||||
fi
|
||||
|
||||
# Cleaning apt package cache
|
||||
rm -rf chroot/var/cache/apt
|
||||
mkdir -p chroot/var/cache/apt/archives/partial
|
||||
|
|
Loading…
Reference in New Issue