From 22a6852b44735c6a0c9acac184351cc648b36efe Mon Sep 17 00:00:00 2001 From: "Brian C. Lane" Date: Wed, 8 Aug 2018 08:44:01 -0700 Subject: [PATCH] Move disklabel and UEFI support to compose.py Currently we are making MBR disk images for qcow2 and partitioned disk, so the UEFI packages aren't required at this point. Move the clearpart command into compose.py so that in the futute it can use clearpart --disklabel to create a GPT image, and add the required packages to the package set. --- share/composer/ext4-filesystem.ks | 4 +--- share/composer/live-iso.ks | 2 -- share/composer/partitioned-disk.ks | 8 -------- share/composer/qcow2.ks | 9 --------- share/composer/tar.ks | 4 +--- src/pylorax/api/compose.py | 4 ++++ 6 files changed, 6 insertions(+), 25 deletions(-) diff --git a/share/composer/ext4-filesystem.ks b/share/composer/ext4-filesystem.ks index 91fa62c0..c96080c7 100644 --- a/share/composer/ext4-filesystem.ks +++ b/share/composer/ext4-filesystem.ks @@ -21,10 +21,8 @@ logging --level=info shutdown # System timezone timezone US/Eastern -# System bootloader configuration +# System bootloader configuration (unpartitioned fs image doesn't use a bootloader) bootloader --location=none -# Partition clearing information -clearpart --all --initlabel %post # Remove random-seed diff --git a/share/composer/live-iso.ks b/share/composer/live-iso.ks index 8196f92c..f274701f 100644 --- a/share/composer/live-iso.ks +++ b/share/composer/live-iso.ks @@ -27,8 +27,6 @@ services --disabled="network,sshd" --enabled="NetworkManager" timezone US/Eastern # System bootloader configuration bootloader --location=none -# Partition clearing information -clearpart --all --initlabel %post # FIXME: it'd be better to get this installed from a package diff --git a/share/composer/partitioned-disk.ks b/share/composer/partitioned-disk.ks index e6d02ecb..7f184064 100644 --- a/share/composer/partitioned-disk.ks +++ b/share/composer/partitioned-disk.ks @@ -23,8 +23,6 @@ shutdown timezone US/Eastern # System bootloader configuration bootloader --location=mbr -# Partition clearing information -clearpart --all --initlabel %post # Remove random-seed @@ -35,12 +33,6 @@ rm /var/lib/systemd/random-seed kernel -dracut-config-rescue -shim -shim-ia32 grub2 -grub2-efi -grub2-efi-*-cdboot -grub2-efi-ia32 -efibootmgr # NOTE lorax-composer will add the recipe packages below here, including the final %end diff --git a/share/composer/qcow2.ks b/share/composer/qcow2.ks index 4002d92c..8f22dd2e 100644 --- a/share/composer/qcow2.ks +++ b/share/composer/qcow2.ks @@ -23,8 +23,6 @@ shutdown timezone US/Eastern # System bootloader configuration bootloader --location=mbr -# Partition clearing information -clearpart --all --initlabel %post # Remove root password @@ -37,13 +35,6 @@ rm /var/lib/systemd/random-seed %packages kernel -dracut-config-rescue - -shim -shim-ia32 grub2 -grub2-efi -grub2-efi-*-cdboot -grub2-efi-ia32 -efibootmgr # NOTE lorax-composer will add the recipe packages below here, including the final %end diff --git a/share/composer/tar.ks b/share/composer/tar.ks index 478fbf38..9e7c3b30 100644 --- a/share/composer/tar.ks +++ b/share/composer/tar.ks @@ -21,10 +21,8 @@ logging --level=info shutdown # System timezone timezone US/Eastern -# System bootloader configuration +# System bootloader configuration (tar doesn't need a bootloader) bootloader --location=none -# Partition clearing information -clearpart --all --initlabel %post # Remove random-seed diff --git a/src/pylorax/api/compose.py b/src/pylorax/api/compose.py index 5a59491b..c0ed3b7d 100644 --- a/src/pylorax/api/compose.py +++ b/src/pylorax/api/compose.py @@ -334,6 +334,10 @@ def start_build(cfg, dnflock, gitlock, branch, recipe_name, compose_type, test_m log.debug("repo composer-%s = %s", idx, ks_repo) f.write('repo --name="composer-%s" %s\n' % (idx, ks_repo)) + # Setup the disk for booting + # TODO Add GPT and UEFI boot support + f.write('clearpart --all --initlabel\n') + # Write the root partition and it's size in MB (rounded up) f.write('part / --fstype="ext4" --size=%d\n' % ceil(installed_size / 1024**2))