[elbe-devel] [PATCH 2/2] elbepack: efilesystem: setup /usr/ before interpreter

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Aug 20 08:36:40 CEST 2024


If not even /usr is available in the image, the /usr/bin/ excursion
would fail.
As a few lines later we set up our own /usr/bin/ directory anyways,
reshuffle the code so that custom /usr/bin/ directory can be used for
the interpreter.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh at linutronix.de>
---
 elbepack/efilesystem.py | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index 4ae1bbaca3f4..8de8c16e973d 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -316,11 +316,11 @@ class ChRootFilesystem(ElbeFilesystem):
             Excursion('/usr/sbin/policy-rc.d'),
         ]
 
-        if self.interpreter:
-            if not self.exists('usr/bin'):
-                if self.islink('usr/bin'):
-                    self._excursions.append(Excursion('/usr/bin'))
+        self.mkdir_p('usr/bin')
+        self.mkdir_p('usr/sbin')
+        self.write_file('usr/sbin/policy-rc.d', 0o755, '#!/bin/sh\nexit 101\n')
 
+        if self.interpreter:
             ui = '/usr/share/elbe/qemu-elbe/' + self.interpreter
             if not os.path.exists(ui):
                 ui = '/usr/bin/' + self.interpreter
@@ -330,10 +330,6 @@ class ChRootFilesystem(ElbeFilesystem):
         for excursion in self._excursions:
             excursion.do(self)
 
-        self.mkdir_p('usr/bin')
-        self.mkdir_p('usr/sbin')
-        self.write_file('usr/sbin/policy-rc.d', 0o755, '#!/bin/sh\nexit 101\n')
-
         self._exitstack = contextlib.ExitStack()
         if self.path != '/':
             self._exitstack.enter_context(

-- 
2.46.0



More information about the elbe-devel mailing list