summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorLuca Boccassi <bluca@debian.org>2018-02-23 00:00:20 +0000
committerLuca Boccassi <bluca@debian.org>2018-02-23 14:04:59 +0000
commit9a0c6102fdff56da0871bfb1a63cc0349d6317f4 (patch)
tree48377335c9178913db2e8607c78f4415968fc1c6 /scripts
parent96e73960b3e64bae81294250e5ad531212ef0ac1 (diff)
downloadvyos-live-build-9a0c6102fdff56da0871bfb1a63cc0349d6317f4.tar.gz
vyos-live-build-9a0c6102fdff56da0871bfb1a63cc0349d6317f4.zip
Fix build with local offline mirrors
Commit a15b579652e64 (#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
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/build/chroot_archives12
1 files changed, 6 insertions, 6 deletions
diff --git a/scripts/build/chroot_archives b/scripts/build/chroot_archives
index 85ad35b0c..596fafc57 100755
--- a/scripts/build/chroot_archives
+++ b/scripts/build/chroot_archives
@@ -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