Fix #673: Only load loop module if it is not already loaded in the kernel (#675)

This checks for /sys/modules/loop before modprobing the loop module. My
understanding is that if this module is built into the kernel, that this
directory is still created. For a kernel without loop built in,
losetup.py will try to load the module using modprobe.
This commit is contained in:
clayton craft 2017-10-02 21:53:01 +00:00 committed by Oliver Smith
parent ec77bdb1d3
commit 4204a86992
1 changed files with 2 additions and 1 deletions

View File

@ -27,7 +27,8 @@ import pmb.chroot
def init(args):
pmb.helpers.run.root(args, ["modprobe", "loop"])
if not os.path.isdir("/sys/module/loop"):
pmb.helpers.run.root(args, ["modprobe", "loop"])
loopdevices = [loopdev for loopdev in glob.glob("/dev/loop*") if not os.path.isdir(loopdev)]
for loopdev in loopdevices:
pmb.helpers.mount.bind_blockdevice(args, loopdev,