forked from Mirror/pmbootstrap
install_system_image: add sdcard argument (MR 1946)
The on-device installer will run install_system_image once with sdcard=None and the second time with sdcard=args.sdcard.
This commit is contained in:
parent
718839364b
commit
8fb69f9c46
4 changed files with 40 additions and 31 deletions
|
@ -43,10 +43,11 @@ def format_and_mount_root(args, device):
|
|||
raise RuntimeError("Failed to open cryptdevice!")
|
||||
|
||||
|
||||
def format_and_mount_pm_crypt(args, device, root_label):
|
||||
def format_and_mount_pm_crypt(args, device, root_label, sdcard):
|
||||
"""
|
||||
:param device: root partition on install block device (e.g. /dev/installp2)
|
||||
:param root_label: label of the root partition (e.g. "pmOS_root")
|
||||
:param sdcard: path to sdcard device (e.g. /dev/mmcblk0) or None
|
||||
"""
|
||||
# Block device
|
||||
if args.full_disk_encryption:
|
||||
|
@ -64,7 +65,7 @@ def format_and_mount_pm_crypt(args, device, 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
|
||||
# inodes. See #1717 and #1845 for details
|
||||
if not args.sdcard:
|
||||
if not sdcard:
|
||||
mkfs_ext4_args = mkfs_ext4_args + ["-N", "100000"]
|
||||
|
||||
pmb.chroot.root(args, mkfs_ext4_args + [device])
|
||||
|
@ -76,12 +77,13 @@ def format_and_mount_pm_crypt(args, device, root_label):
|
|||
pmb.chroot.root(args, ["mount", device, mountpoint])
|
||||
|
||||
|
||||
def format(args, size_reserve, root_label):
|
||||
def format(args, size_reserve, root_label, sdcard):
|
||||
"""
|
||||
: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")
|
||||
:param sdcard: path to sdcard device (e.g. /dev/mmcblk0) or None
|
||||
"""
|
||||
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, root_label)
|
||||
format_and_mount_pm_crypt(args, root_dev, root_label, sdcard)
|
||||
format_and_mount_boot(args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue