[elbe-devel] [PATCH 5/7] elbepack: hdimg: switch chroot() calls to non-shell

Thomas Weißschuh thomas.weissschuh at linutronix.de
Tue Apr 30 09:23:12 CEST 2024


Running commands through a shell is error-prone.
Migrate all shell-based invocations to normal ones.

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

diff --git a/elbepack/hdimg.py b/elbepack/hdimg.py
index df5b4f5be181..bd9d3a657867 100644
--- a/elbepack/hdimg.py
+++ b/elbepack/hdimg.py
@@ -169,7 +169,7 @@ class grubinstaller202(grubinstaller_base):
             devmap.write(f'(hd0) {loopdev}\n')
             devmap.close()
 
-            chroot(imagemnt, 'update-grub2')
+            chroot(imagemnt, ['update-grub2'])
 
             if 'efi' in self.fw_type:
                 grub_tgt = next(t for t in self.fw_type if t.endswith('-efi'))
@@ -253,7 +253,7 @@ class grubinstaller97(grubinstaller_base):
             do(rf'chroot {imagemnt} sed -in "s/^# groot=.*$/# groot=\(hd0,{bootentry - 1}\)/" /boot/grub/menu.lst')  # noqa: E501
             do(rf'chroot {imagemnt} sed -in "s/^# kopt=.*$/# kopt=root=LABEL={bootentry_label}/" /boot/grub/menu.lst')  # noqa: E501
 
-            chroot(imagemnt, 'update-grub')
+            chroot(imagemnt, ['update-grub2'])
 
             do(
                 f'chroot {imagemnt} '

-- 
2.44.0



More information about the elbe-devel mailing list