[elbe-devel] [PATCH 1/3] elbepack: rfs: clean up debootstrapped tree
Thomas Weißschuh
thomas.weissschuh at linutronix.de
Wed Apr 24 12:37:20 CEST 2024
debootstrap helpfully copies some files into the new tree.
These files are also managed by elbes excursion functionality and them
already existing breaks the clean up process.
Due to this elbe always leaked the initvms /etc/resolv.conf into the
target.
Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
elbepack/rfs.py | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index b3476f965639..c3fea7d38d39 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -140,6 +140,12 @@ class BuildEnv:
do(f'rm {self.path}/etc/apt/sources.list.d/local.list')
do(f'rm {self.path}/etc/apt/trusted.gpg.d/elbe-localrepo.gpg')
+ def _cleanup_bootstrap(self):
+ # debootstrap helpfully copies configuration into the new tree
+ # elbe is managing these files already
+ for f in {'/etc/resolv.conf', '/etc/hostname'}:
+ self.rfs.remove(f)
+
def debootstrap(self, arch='default'):
cleanup = False
@@ -204,6 +210,7 @@ class BuildEnv:
if keyring:
self.convert_asc_to_gpg('/cdrom/targetrepo/repo.pub', '/elbe.keyring')
do(cmd)
+ self._cleanup_bootstrap()
except subprocess.CalledProcessError as e:
cleanup = True
raise DebootstrapException() from e
@@ -244,6 +251,7 @@ class BuildEnv:
chroot(self.rfs.path,
'/debootstrap/debootstrap --second-stage')
+ self._cleanup_bootstrap()
chroot(self.rfs.path, 'dpkg --configure -a')
except subprocess.CalledProcessError as e:
--
2.44.0
More information about the elbe-devel
mailing list