Fix --mods=auto with --kdir != .
Signed-off-by: Andy Lutomirski <luto@kernel.org>
diff --git a/bin/virtme-prep-kdir-mods b/bin/virtme-prep-kdir-mods
index be28fb6..089bce6 100755
--- a/bin/virtme-prep-kdir-mods
+++ b/bin/virtme-prep-kdir-mods
@@ -2,7 +2,7 @@
# This is still a bit of an experiment.
-if ! [ -d .tmp_versions ]; then
+if ! [ -f modules.order ]; then
echo 'virtme-prep-kdir-mods must be run from a kernel build directory' >&2
exit 1
fi
diff --git a/virtme/commands/run.py b/virtme/commands/run.py
index 263bdd2..1274fa3 100644
--- a/virtme/commands/run.py
+++ b/virtme/commands/run.py
@@ -24,7 +24,7 @@
from .. import mkinitramfs
from .. import qemu_helpers
from .. import architectures
-from .. import guest_tools
+from .. import resources
uname = os.uname()
@@ -185,7 +185,8 @@
else:
# Auto-refresh virtme's kernel modules directory
try:
- guest_tools.run_script('virtme-prep-kdir-mods')
+ resources.run_script('virtme-prep-kdir-mods',
+ cwd=args.kdir)
except subprocess.CalledProcessError:
raise SilentError()
kernel.moddir = os.path.join(virtme_mods, 'lib/modules', '0.0.0')
@@ -263,7 +264,7 @@
# Set up virtfs
export_virtfs(qemu, arch, qemuargs, args.root, '/dev/root', readonly=(not args.rw))
- guest_tools_path = guest_tools.find_guest_tools()
+ guest_tools_path = resources.find_guest_tools()
if guest_tools_path is None:
raise ValueError("couldn't find guest tools -- virtme is installed incorrectly")
diff --git a/virtme/guest_tools.py b/virtme/resources.py
similarity index 92%
rename from virtme/guest_tools.py
rename to virtme/resources.py
index 2505b49..d07e981 100644
--- a/virtme/guest_tools.py
+++ b/virtme/resources.py
@@ -37,6 +37,6 @@
# No luck. This is somewhat surprising.
raise Exception('could not find script %s' % name)
-def run_script(name) -> None:
+def run_script(name, **kwargs) -> None:
fn = find_script(name)
- subprocess.check_call(executable=fn, args=[fn])
+ subprocess.check_call(executable=fn, args=[fn], **kwargs)