forked from Mirror/pmbootstrap
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:
parent
f3dc6a55cf
commit
f43d552039
4 changed files with 12 additions and 12 deletions
|
@ -66,10 +66,10 @@ def bind(args, source, destination, create_folders=True, umount=False):
|
||||||
raise RuntimeError("Mount failed: " + source + " -> " + destination)
|
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
|
Mount a file with the --bind option, and create the destination file,
|
||||||
file, if necessary.
|
if necessary.
|
||||||
"""
|
"""
|
||||||
# Skip existing mountpoint
|
# Skip existing mountpoint
|
||||||
if ismount(destination):
|
if ismount(destination):
|
||||||
|
|
|
@ -36,8 +36,8 @@ def previous_install(args):
|
||||||
if not os.path.exists(blockdevice_outside):
|
if not os.path.exists(blockdevice_outside):
|
||||||
continue
|
continue
|
||||||
blockdevice_inside = "/dev/sdcardp1"
|
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)
|
args.work + "/chroot_native" + blockdevice_inside)
|
||||||
label = pmb.chroot.root(args, ["blkid", "-s", "LABEL", "-o", "value",
|
label = pmb.chroot.root(args, ["blkid", "-s", "LABEL", "-o", "value",
|
||||||
blockdevice_inside], output_return=True)
|
blockdevice_inside], output_return=True)
|
||||||
pmb.helpers.run.root(args, ["umount", args.work + "/chroot_native" + blockdevice_inside])
|
pmb.helpers.run.root(args, ["umount", args.work + "/chroot_native" + blockdevice_inside])
|
||||||
|
@ -57,8 +57,8 @@ def mount_sdcard(args):
|
||||||
raise RuntimeError(path + " is mounted! We will not attempt"
|
raise RuntimeError(path + " is mounted! We will not attempt"
|
||||||
" to format this!")
|
" to format this!")
|
||||||
logging.info("(native) mount /dev/install (host: " + args.sdcard + ")")
|
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")
|
args.work + "/chroot_native/dev/install")
|
||||||
if previous_install(args):
|
if previous_install(args):
|
||||||
if not pmb.helpers.cli.confirm(args, "WARNING: This device has a"
|
if not pmb.helpers.cli.confirm(args, "WARNING: This device has a"
|
||||||
" previous installation of pmOS."
|
" previous installation of pmOS."
|
||||||
|
@ -123,8 +123,8 @@ def create_and_mount_image(args, size_boot, size_root):
|
||||||
" (" + os.path.basename(img_path) + ")")
|
" (" + os.path.basename(img_path) + ")")
|
||||||
pmb.install.losetup.mount(args, img_path)
|
pmb.install.losetup.mount(args, img_path)
|
||||||
device = pmb.install.losetup.device_by_back_file(args, img_path)
|
device = pmb.install.losetup.device_by_back_file(args, img_path)
|
||||||
pmb.helpers.mount.bind_blockdevice(args, device, args.work +
|
pmb.helpers.mount.bind_file(args, device,
|
||||||
"/chroot_native" + mount_point)
|
args.work + "/chroot_native" + mount_point)
|
||||||
|
|
||||||
|
|
||||||
def create(args, size_boot, size_root):
|
def create(args, size_boot, size_root):
|
||||||
|
|
|
@ -32,8 +32,8 @@ def init(args):
|
||||||
pmb.helpers.run.root(args, ["modprobe", "loop"])
|
pmb.helpers.run.root(args, ["modprobe", "loop"])
|
||||||
loopdevices = [loopdev for loopdev in glob.glob("/dev/loop*") if not os.path.isdir(loopdev)]
|
loopdevices = [loopdev for loopdev in glob.glob("/dev/loop*") if not os.path.isdir(loopdev)]
|
||||||
for loopdev in loopdevices:
|
for loopdev in loopdevices:
|
||||||
pmb.helpers.mount.bind_blockdevice(args, loopdev,
|
pmb.helpers.mount.bind_file(args, loopdev,
|
||||||
args.work + "/chroot_native/" + loopdev)
|
args.work + "/chroot_native/" + loopdev)
|
||||||
|
|
||||||
|
|
||||||
def mount(args, img_path):
|
def mount(args, img_path):
|
||||||
|
|
|
@ -54,7 +54,7 @@ def partitions_mount(args):
|
||||||
for i in [1, 2]:
|
for i in [1, 2]:
|
||||||
source = prefix + partition_prefix + str(i)
|
source = prefix + partition_prefix + str(i)
|
||||||
target = args.work + "/chroot_native/dev/installp" + 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):
|
def partition(args, size_boot):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue