aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarcos Paulo de Souza <marcos.souza.org@gmail.com>2019-06-20 20:45:43 -0300
committerMarcos Paulo de Souza <mpdesouza@suse.de>2019-06-20 20:51:33 -0300
commit235b4141e4eef5d671204aba14be21a0d1a55e87 (patch)
tree5ace43e555d26498fd182885b4968edef830fc04
parent538f1e756139a6b57a4780e7ceb3ac6bcaa4fe6f (diff)
downloadvirtme-235b4141e4eef5d671204aba14be21a0d1a55e87.tar.gz
modfinder.py: Check if modprobe is the PATH of the user
openSUSE and SLE don't have modprobe in the user's PATH, so check /usr/sbin too. With this patch applied, an ordinary user can execute virtme-run --installed-kernel Without the need to be root in openSUSE/SLE. Signed-off-by: Marcos Paulo de Souza <mpdesouza@suse.com>
-rw-r--r--virtme/modfinder.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/virtme/modfinder.py b/virtme/modfinder.py
index 02f0924..b44eb37 100644
--- a/virtme/modfinder.py
+++ b/virtme/modfinder.py
@@ -12,6 +12,7 @@ everything. The idea is to require very few modules.
"""
import re
+import shutil
import subprocess
import os, os.path
import itertools
@@ -19,7 +20,9 @@ import itertools
_INSMOD_RE = re.compile('insmod (.*[^ ]) *$')
def resolve_dep(modalias, root=None, kver=None, moddir=None):
- args = ['modprobe', '--show-depends']
+ # In openSUSE and SLE, modprobe is not in the PATH of ordinary users
+ modprobe = shutil.which('modprobe') or shutil.which('/usr/sbin/modprobe')
+ args = [modprobe, '--show-depends']
args += ['-C', '/var/empty']
if root is not None:
args += ['-d', root]