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:
parent
7fb41641ea
commit
a56e4eae5a
|
@ -373,11 +373,12 @@ def sanity_check_sdcard(device):
|
||||||
raise RuntimeError("{} is read-only, is the sdcard locked?".format(device))
|
raise RuntimeError("{} is read-only, is the sdcard locked?".format(device))
|
||||||
|
|
||||||
|
|
||||||
def install_system_image(args, size_reserve, suffix):
|
def install_system_image(args, size_reserve, suffix, root_label="pmOS_root"):
|
||||||
"""
|
"""
|
||||||
: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 root_label: label of the root partition (e.g. "pmOS_root")
|
||||||
"""
|
"""
|
||||||
# Partition and fill image/sdcard
|
# Partition and fill image/sdcard
|
||||||
logging.info("*** (3/5) PREPARE INSTALL BLOCKDEVICE ***")
|
logging.info("*** (3/5) PREPARE INSTALL BLOCKDEVICE ***")
|
||||||
|
@ -392,7 +393,7 @@ def install_system_image(args, size_reserve, suffix):
|
||||||
root_id = 3 if size_reserve else 2
|
root_id = 3 if size_reserve else 2
|
||||||
pmb.install.partitions_mount(args, root_id)
|
pmb.install.partitions_mount(args, root_id)
|
||||||
|
|
||||||
pmb.install.format(args, size_reserve)
|
pmb.install.format(args, size_reserve, root_label)
|
||||||
|
|
||||||
# Just copy all the files
|
# Just copy all the files
|
||||||
logging.info("*** (4/5) FILL INSTALL BLOCKDEVICE ***")
|
logging.info("*** (4/5) FILL INSTALL BLOCKDEVICE ***")
|
||||||
|
|
|
@ -43,9 +43,10 @@ def format_and_mount_root(args, device):
|
||||||
raise RuntimeError("Failed to open cryptdevice!")
|
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 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
|
# Block device
|
||||||
if args.full_disk_encryption:
|
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
|
# When changing the options of mkfs.ext4, also change them in the
|
||||||
# recovery zip code (see 'grep -r mkfs\.ext4')!
|
# recovery zip code (see 'grep -r mkfs\.ext4')!
|
||||||
mkfs_ext4_args = ["mkfs.ext4", "-O", "^metadata_csum", "-F",
|
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
|
# When we don't know the file system size before hand like
|
||||||
# with non-block devices, we need to explicitely set a number of
|
# 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])
|
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 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"
|
root_dev = "/dev/installp3" if size_reserve else "/dev/installp2"
|
||||||
format_and_mount_root(args, root_dev)
|
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)
|
format_and_mount_boot(args)
|
||||||
|
|
Loading…
Reference in New Issue