diff options
author | Zev Weiss <zev@bewilderbeest.net> | 2018-12-29 00:16:57 -0600 |
---|---|---|
committer | Zev Weiss <zev@bewilderbeest.net> | 2019-09-17 00:57:09 -0500 |
commit | 2f13dea5d5ec0a7eac11ddb818cde977a18e2035 (patch) | |
tree | 30c40926e3a1644df97ed9e71109492ec8a7ccad | |
parent | f4cd13a9c6328633f8af729d777ad9490e7cf585 (diff) | |
download | virtme-2f13dea5d5ec0a7eac11ddb818cde977a18e2035.tar.gz |
mkinitramfs: generate busybox paths instead of enumerating them explicitly
Signed-off-by: Zev Weiss <zev@bewilderbeest.net>
-rw-r--r-- | virtme/mkinitramfs.py | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/virtme/mkinitramfs.py b/virtme/mkinitramfs.py index baaefe9..58081e1 100644 --- a/virtme/mkinitramfs.py +++ b/virtme/mkinitramfs.py @@ -9,6 +9,7 @@ import shutil import io import os.path import shlex +import itertools from . import cpiowriter from . import modfinder from . import virtmods @@ -165,12 +166,12 @@ def mkinitramfs(out, config): cw.write_trailer() def find_busybox(root, is_native): - for path in ('usr/local/bin/busybox', 'usr/local/sbin/busybox', - 'usr/bin/busybox-static', - 'usr/bin/busybox', 'usr/sbin/busybox', - 'bin/busybox', 'sbin/busybox'): - if os.path.isfile(os.path.join(root, path)): - return os.path.join(root, path) + for p in itertools.product(['usr/local', 'usr', ''], + ['bin', 'sbin'], + ['', '-static']): + path = os.path.join(root, p[0], p[1], 'busybox' + p[2]) + if os.path.isfile(path): + return path if is_native: # Try the host's busybox, if any |