pmb.helpers.mount: Rename bind_blockdevice() to bind_file() (!1861)

bind_blockdevice() can be also used to mount --bind files,
rename it to bind_file().
This commit is contained in:
Minecrell 2020-01-20 13:27:40 +01:00 committed by Oliver Smith
parent f3dc6a55cf
commit f43d552039
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB
4 changed files with 12 additions and 12 deletions

View file

@ -66,10 +66,10 @@ def bind(args, source, destination, create_folders=True, umount=False):
raise RuntimeError("Mount failed: " + source + " -> " + destination)
def bind_blockdevice(args, source, destination):
def bind_file(args, source, destination):
"""
Mount a blockdevice with the --bind option, and create the destination
file, if necessary.
Mount a file with the --bind option, and create the destination file,
if necessary.
"""
# Skip existing mountpoint
if ismount(destination):

View file

@ -36,7 +36,7 @@ def previous_install(args):
if not os.path.exists(blockdevice_outside):
continue
blockdevice_inside = "/dev/sdcardp1"
pmb.helpers.mount.bind_blockdevice(args, blockdevice_outside,
pmb.helpers.mount.bind_file(args, blockdevice_outside,
args.work + "/chroot_native" + blockdevice_inside)
label = pmb.chroot.root(args, ["blkid", "-s", "LABEL", "-o", "value",
blockdevice_inside], output_return=True)
@ -57,7 +57,7 @@ def mount_sdcard(args):
raise RuntimeError(path + " is mounted! We will not attempt"
" to format this!")
logging.info("(native) mount /dev/install (host: " + args.sdcard + ")")
pmb.helpers.mount.bind_blockdevice(args, args.sdcard,
pmb.helpers.mount.bind_file(args, args.sdcard,
args.work + "/chroot_native/dev/install")
if previous_install(args):
if not pmb.helpers.cli.confirm(args, "WARNING: This device has a"
@ -123,8 +123,8 @@ def create_and_mount_image(args, size_boot, size_root):
" (" + os.path.basename(img_path) + ")")
pmb.install.losetup.mount(args, img_path)
device = pmb.install.losetup.device_by_back_file(args, img_path)
pmb.helpers.mount.bind_blockdevice(args, device, args.work +
"/chroot_native" + mount_point)
pmb.helpers.mount.bind_file(args, device,
args.work + "/chroot_native" + mount_point)
def create(args, size_boot, size_root):

View file

@ -32,7 +32,7 @@ def init(args):
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,
pmb.helpers.mount.bind_file(args, loopdev,
args.work + "/chroot_native/" + loopdev)

View file

@ -54,7 +54,7 @@ def partitions_mount(args):
for i in [1, 2]:
source = prefix + partition_prefix + str(i)
target = args.work + "/chroot_native/dev/installp" + str(i)
pmb.helpers.mount.bind_blockdevice(args, source, target)
pmb.helpers.mount.bind_file(args, source, target)
def partition(args, size_boot):