Use build env archive mirror in binary hooks

sil2100/proposed-components
Robert C Jennings 5 years ago committed by Pat Viafore
parent 76f9f34177
commit 5362e3a7e7
No known key found for this signature in database
GPG Key ID: 20C739856E05C9D1

@ -87,6 +87,25 @@ mount_image() {
return 0 return 0
} }
setup_sourceslist(){
# Use the build environment apt mirror during the build,
# for both archive and security.
# live-build does this in the chroot (lb_chroot_archives)
# but not for the binary hooks
. config/bootstrap # For the LB_MIRROR_* variables
cp -a "${mountpoint}/etc/apt/sources.list" sources.list.tmp
sed -i "s#http://archive.ubuntu.com/ubuntu#${LB_PARENT_MIRROR_CHROOT}#g" \
"${mountpoint}/etc/apt/sources.list"
sed -i "s#http://security.ubuntu.com/ubuntu#${LB_PARENT_MIRROR_CHROOT}#g" \
"${mountpoint}/etc/apt/sources.list"
}
recover_sourceslist(){
# Remove the build environment apt mirror from the image
mv sources.list.tmp "${mountpoint}/etc/apt/sources.list"
}
setup_mountpoint() { setup_mountpoint() {
local mountpoint="$1" local mountpoint="$1"
@ -109,6 +128,7 @@ setup_mountpoint() {
cp /etc/resolv.conf "$mountpoint/etc/resolv.conf" cp /etc/resolv.conf "$mountpoint/etc/resolv.conf"
mv "$mountpoint/etc/nsswitch.conf" nsswitch.conf.tmp mv "$mountpoint/etc/nsswitch.conf" nsswitch.conf.tmp
sed 's/systemd//g' nsswitch.conf.tmp > "$mountpoint/etc/nsswitch.conf" sed 's/systemd//g' nsswitch.conf.tmp > "$mountpoint/etc/nsswitch.conf"
setup_sourceslist "${mountpoint}"
chroot "$mountpoint" apt-get update chroot "$mountpoint" apt-get update
} }
@ -125,6 +145,7 @@ teardown_mountpoint() {
mount --make-private $submount mount --make-private $submount
umount $submount umount $submount
done done
recover_sourceslist "${mountpoint}"
mv resolv.conf.tmp "$mountpoint/etc/resolv.conf" mv resolv.conf.tmp "$mountpoint/etc/resolv.conf"
mv nsswitch.conf.tmp "$mountpoint/etc/nsswitch.conf" mv nsswitch.conf.tmp "$mountpoint/etc/nsswitch.conf"
} }

Loading…
Cancel
Save