pmb.install: add boot label arg to several funcs (MR 2008)
Allow to set a different label for the boot partition than "pmOS_boot".
This commit is contained in:
parent
7d1c8d29df
commit
b07ff9444c
|
@ -445,13 +445,15 @@ def sanity_check_ondev_version(args):
|
||||||
|
|
||||||
|
|
||||||
def install_system_image(args, size_reserve, suffix, step, steps,
|
def install_system_image(args, size_reserve, suffix, step, steps,
|
||||||
root_label="pmOS_root", split=False, sdcard=None):
|
boot_label="pmOS_boot", root_label="pmOS_root",
|
||||||
|
split=False, sdcard=None):
|
||||||
"""
|
"""
|
||||||
:param size_reserve: empty partition between root and boot in MiB (pma#463)
|
:param size_reserve: empty partition between root and boot in MiB (pma#463)
|
||||||
:param suffix: the chroot suffix, where the rootfs that will be installed
|
:param suffix: the chroot suffix, where the rootfs that will be installed
|
||||||
on the device has been created (e.g. "rootfs_qemu-amd64")
|
on the device has been created (e.g. "rootfs_qemu-amd64")
|
||||||
:param step: next installation step
|
:param step: next installation step
|
||||||
:param steps: total installation steps
|
:param steps: total installation steps
|
||||||
|
:param boot_label: label of the boot partition (e.g. "pmOS_boot")
|
||||||
:param root_label: label of the root partition (e.g. "pmOS_root")
|
:param root_label: label of the root partition (e.g. "pmOS_root")
|
||||||
:param split: create separate images for boot and root partitions
|
:param split: create separate images for boot and root partitions
|
||||||
:param sdcard: path to sdcard device (e.g. /dev/mmcblk0) or None
|
:param sdcard: path to sdcard device (e.g. /dev/mmcblk0) or None
|
||||||
|
@ -469,7 +471,7 @@ def install_system_image(args, size_reserve, suffix, step, steps,
|
||||||
root_id = 3 if size_reserve else 2
|
root_id = 3 if size_reserve else 2
|
||||||
pmb.install.partitions_mount(args, root_id, sdcard)
|
pmb.install.partitions_mount(args, root_id, sdcard)
|
||||||
|
|
||||||
pmb.install.format(args, size_reserve, root_label, sdcard)
|
pmb.install.format(args, size_reserve, boot_label, root_label, sdcard)
|
||||||
|
|
||||||
# Just copy all the files
|
# Just copy all the files
|
||||||
logging.info(f"*** ({step + 1}/{steps}) FILL INSTALL BLOCKDEVICE ***")
|
logging.info(f"*** ({step + 1}/{steps}) FILL INSTALL BLOCKDEVICE ***")
|
||||||
|
|
|
@ -5,18 +5,24 @@ import logging
|
||||||
import pmb.chroot
|
import pmb.chroot
|
||||||
|
|
||||||
|
|
||||||
def format_and_mount_boot(args):
|
def format_and_mount_boot(args, boot_label):
|
||||||
|
"""
|
||||||
|
:param boot_label: label of the root partition (e.g. "pmOS_boot")
|
||||||
|
"""
|
||||||
mountpoint = "/mnt/install/boot"
|
mountpoint = "/mnt/install/boot"
|
||||||
device = "/dev/installp1"
|
device = "/dev/installp1"
|
||||||
filesystem = args.deviceinfo["boot_filesystem"] or "ext2"
|
filesystem = args.deviceinfo["boot_filesystem"] or "ext2"
|
||||||
logging.info("(native) format " + device + " (boot, " + filesystem + "), mount to " +
|
logging.info("(native) format " + device + " (boot, " + filesystem + "), mount to " +
|
||||||
mountpoint)
|
mountpoint)
|
||||||
if filesystem == "fat16":
|
if filesystem == "fat16":
|
||||||
pmb.chroot.root(args, ["mkfs.fat", "-F", "16", "-n", "pmOS_boot", device])
|
pmb.chroot.root(args, ["mkfs.fat", "-F", "16", "-n", boot_label,
|
||||||
|
device])
|
||||||
elif filesystem == "fat32":
|
elif filesystem == "fat32":
|
||||||
pmb.chroot.root(args, ["mkfs.fat", "-F", "32", "-n", "pmOS_boot", device])
|
pmb.chroot.root(args, ["mkfs.fat", "-F", "32", "-n", boot_label,
|
||||||
|
device])
|
||||||
elif filesystem == "ext2":
|
elif filesystem == "ext2":
|
||||||
pmb.chroot.root(args, ["mkfs.ext2", "-F", "-q", "-L", "pmOS_boot", device])
|
pmb.chroot.root(args, ["mkfs.ext2", "-F", "-q", "-L", boot_label,
|
||||||
|
device])
|
||||||
else:
|
else:
|
||||||
raise RuntimeError("Filesystem " + filesystem + " is not supported!")
|
raise RuntimeError("Filesystem " + filesystem + " is not supported!")
|
||||||
pmb.chroot.root(args, ["mkdir", "-p", mountpoint])
|
pmb.chroot.root(args, ["mkdir", "-p", mountpoint])
|
||||||
|
@ -79,9 +85,10 @@ def format_and_mount_root(args, device, root_label, sdcard):
|
||||||
pmb.chroot.root(args, ["mount", device, mountpoint])
|
pmb.chroot.root(args, ["mount", device, mountpoint])
|
||||||
|
|
||||||
|
|
||||||
def format(args, size_reserve, root_label, sdcard):
|
def format(args, size_reserve, boot_label, root_label, sdcard):
|
||||||
"""
|
"""
|
||||||
:param size_reserve: empty partition between root and boot in MiB (pma#463)
|
:param size_reserve: empty partition between root and boot in MiB (pma#463)
|
||||||
|
:param boot_label: label of the boot partition (e.g. "pmOS_boot")
|
||||||
:param root_label: label of the root partition (e.g. "pmOS_root")
|
:param root_label: label of the root partition (e.g. "pmOS_root")
|
||||||
:param sdcard: path to sdcard device (e.g. /dev/mmcblk0) or None
|
:param sdcard: path to sdcard device (e.g. /dev/mmcblk0) or None
|
||||||
"""
|
"""
|
||||||
|
@ -92,4 +99,4 @@ def format(args, size_reserve, root_label, sdcard):
|
||||||
root_dev = "/dev/mapper/pm_crypt"
|
root_dev = "/dev/mapper/pm_crypt"
|
||||||
|
|
||||||
format_and_mount_root(args, root_dev, root_label, sdcard)
|
format_and_mount_root(args, root_dev, root_label, sdcard)
|
||||||
format_and_mount_boot(args)
|
format_and_mount_boot(args, boot_label)
|
||||||
|
|
Loading…
Reference in New Issue