Make sure modprobe executable can be accessed
authorMichael Prokop <mika@grml.org>
Tue, 23 Apr 2013 14:07:50 +0000 (16:07 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 23 Apr 2013 14:07:52 +0000 (16:07 +0200)
If /sbin is missing in $PATH then we fail with a traceback otherwise

grml2usb

index 6d2a754..c696623 100755 (executable)
--- a/grml2usb
+++ b/grml2usb
@@ -1705,6 +1705,11 @@ def check_programs():
 
 def load_loop():
     """Runs modprobe loop and throws away it's output"""
+    if not which("modprobe"):
+        logging.critical("Fatal: modprobe not available, can not continue - sorry.")
+        logging.critical("Hint: is /sbin missing in PATH?")
+        sys.exit(1)
+
     proc = subprocess.Popen(["modprobe", "loop"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
     proc.wait()