From 29324714c0a5b61d1435fb3865db6cbc515fa725 Mon Sep 17 00:00:00 2001 From: Cody Shepherd Date: Wed, 31 Oct 2018 11:52:20 -0700 Subject: [PATCH 1/2] Improving modularity of moving around /etc/resolv.conf in order to make some other fixes more future proof. --- live-build/functions | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/live-build/functions b/live-build/functions index cbe108f4..50855c92 100644 --- a/live-build/functions +++ b/live-build/functions @@ -77,6 +77,17 @@ mount_image() { return 0 } +setup_resolvconf() { + local mountpoint=${1} + mv "${mountpoint}/etc/resolv.conf" resolv.conf.tmp + cp /etc/resolv.conf "${mountpoint}/etc/resolv.conf" +} + +recover_resolvconf() { + local mountmpoint=${1} + mv resolv.conf.tmp "${mountpoint}/etc/resolv.conf" +} + setup_mountpoint() { local mountpoint="$1" @@ -86,8 +97,7 @@ setup_mountpoint() { mount -t tmpfs none "$mountpoint/tmp" mount -t tmpfs none "$mountpoint/var/lib/apt" mount -t tmpfs none "$mountpoint/var/cache/apt" - mv "$mountpoint/etc/resolv.conf" resolv.conf.tmp - cp /etc/resolv.conf "$mountpoint/etc/resolv.conf" + setup_resolvconf "${mountpoint}" chroot "$mountpoint" apt-get update } @@ -103,7 +113,7 @@ teardown_mountpoint() { { print \$2 }" | LC_ALL=C sort -r); do umount $submount done - mv resolv.conf.tmp "$mountpoint/etc/resolv.conf" + recover_resolvconf "${mountpoint}" } mount_partition() { From 1f990b1bf255c1ed48a73389ae0f260c08e1f91f Mon Sep 17 00:00:00 2001 From: Cody Shepherd Date: Wed, 31 Oct 2018 13:37:44 -0700 Subject: [PATCH 2/2] Fixing spelling error --- live-build/functions | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/live-build/functions b/live-build/functions index 50855c92..55f700f3 100644 --- a/live-build/functions +++ b/live-build/functions @@ -84,7 +84,7 @@ setup_resolvconf() { } recover_resolvconf() { - local mountmpoint=${1} + local mountpoint=${1} mv resolv.conf.tmp "${mountpoint}/etc/resolv.conf" }