Ignore directories while searching for loop devices (#235)
Thanks, cmdr2! Here's the text from his PR: Fixes an issue on alpine-vanilla, where `/dev/loop` is a directory (containing `/dev/loop/0`, `/dev/loop/1` ..etc), and causes `./pmbootstrap install` to fail. Ignoring the `/dev/loop` directory works because `/dev/` also contains files named `/dev/loop0`, `/dev/loop1` ..etc, which the new code will still pick up. The `install` command passes after this fix on my alpine-vanilla.
This commit is contained in:
parent
14f164b8a2
commit
2afe205243
|
@ -19,6 +19,7 @@ along with pmbootstrap. If not, see <http://www.gnu.org/licenses/>.
|
|||
import glob
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
|
||||
import pmb.helpers.mount
|
||||
import pmb.helpers.run
|
||||
|
@ -27,7 +28,8 @@ import pmb.chroot
|
|||
|
||||
def init(args):
|
||||
pmb.helpers.run.root(args, ["modprobe", "loop"])
|
||||
for loopdev in glob.glob("/dev/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,
|
||||
args.work + "/chroot_native/" + loopdev)
|
||||
|
||||
|
|
Loading…
Reference in New Issue