install_system_image: add root_label parameter (MR 1946)

Prepare for on-device installer, so it can use something other than
"pmOS_root" as label.
This commit is contained in:
Oliver Smith 2020-06-07 08:50:28 +02:00 committed by Bart Ribbers
parent 7fb41641ea
commit a56e4eae5a
No known key found for this signature in database
GPG key ID: 699D16185DAFAE61
2 changed files with 9 additions and 6 deletions

View file

@ -43,9 +43,10 @@ def format_and_mount_root(args, device):
raise RuntimeError("Failed to open cryptdevice!")
def format_and_mount_pm_crypt(args, device):
def format_and_mount_pm_crypt(args, device, root_label):
"""
:param device: root partition on install block device (e.g. /dev/installp2)
:param root_label: label of the root partition (e.g. "pmOS_root")
"""
# Block device
if args.full_disk_encryption:
@ -58,7 +59,7 @@ def format_and_mount_pm_crypt(args, device):
# When changing the options of mkfs.ext4, also change them in the
# recovery zip code (see 'grep -r mkfs\.ext4')!
mkfs_ext4_args = ["mkfs.ext4", "-O", "^metadata_csum", "-F",
"-q", "-L", "pmOS_root"]
"-q", "-L", root_label]
# When we don't know the file system size before hand like
# with non-block devices, we need to explicitely set a number of
@ -75,11 +76,12 @@ def format_and_mount_pm_crypt(args, device):
pmb.chroot.root(args, ["mount", device, mountpoint])
def format(args, size_reserve):
def format(args, size_reserve, root_label):
"""
:param size_reserve: empty partition between root and boot in MiB (pma#463)
:param root_label: label of the root partition (e.g. "pmOS_root")
"""
root_dev = "/dev/installp3" if size_reserve else "/dev/installp2"
format_and_mount_root(args, root_dev)
format_and_mount_pm_crypt(args, root_dev)
format_and_mount_pm_crypt(args, root_dev, root_label)
format_and_mount_boot(args)