From d64b0a2fcb87028e19e18e590b2053e800963751 Mon Sep 17 00:00:00 2001 From: Trevor Cooper Date: Thu, 13 Oct 2022 16:35:51 -0700 Subject: [PATCH] Add beta support to createhdds.py (#12) * add ability to point at stg or pub baseurl * add support for building 8.7-Beta virt-install images * differentiate guestfs and virtInstall --- createhdds.py | 24 +++++++++++++++++------- desktop-8.7-Beta.ks | 21 +++++++++++++++++++++ desktopencrypt-8.7-Beta.ks | 17 +++++++++++++++++ hdds.json | 6 ++++++ minimal-8.7-Beta.ks | 14 ++++++++++++++ minimal-uefi-8.7-Beta.ks | 18 ++++++++++++++++++ server-8.7-Beta.ks | 16 ++++++++++++++++ support-8.7-Beta.ks | 19 +++++++++++++++++++ 8 files changed, 128 insertions(+), 7 deletions(-) create mode 100644 desktop-8.7-Beta.ks create mode 100644 desktopencrypt-8.7-Beta.ks create mode 100644 minimal-8.7-Beta.ks create mode 100644 minimal-uefi-8.7-Beta.ks create mode 100644 server-8.7-Beta.ks create mode 100644 support-8.7-Beta.ks diff --git a/createhdds.py b/createhdds.py index d7ea224..e3b4275 100755 --- a/createhdds.py +++ b/createhdds.py @@ -238,7 +238,7 @@ class VirtInstallImage(object): logger.debug("Using kickstart %s", cand) return cand - def create(self, textinst, retries=3): + def create(self, baseurl, textinst, retries=3): """Create the image.""" if self.arch not in supported_arches(): logger.info("Won't create %s image on %s host. This is normal, don't worry. If you " @@ -282,15 +282,15 @@ class VirtInstallImage(object): memsize = '4096' try: + locbase = "https://download.rockylinux.org/{0}/rocky".format(baseurl) # loctmp is the Distribution tree installation source. Point at the good location - #loctmp = "https://download.rockylinux.org/stg/rocky/{0}/BaseOS/{1}/os" - loctmp = "https://download.rockylinux.org/pub/rocky/{0}/BaseOS/{1}/os" + loctmp = "{0}/{1}/BaseOS/{2}/os" ksfile = self.kickstart_file xargs = "inst.ks=file:/{0}".format(ksfile) args = ["virt-install", "--disk", "size={0},path={1}".format(self.size, tmpfile), "--os-variant", shortid, "-x", xargs, "--initrd-inject", "{0}/{1}".format(SCRIPTDIR, ksfile), "--location", - loctmp.format(str(self.release), arch), "--name", "createhdds", + loctmp.format(locbase, str(self.release), arch), "--name", "createhdds", "--memory", memsize, "--noreboot", "--wait", "-1"] if logger.getEffectiveLevel() == logging.DEBUG: # let's get virt-install debug logs too @@ -333,7 +333,7 @@ class VirtInstallImage(object): os.remove(tmpfile) if retries: logger.info("Retrying: %s retries remain after this", str(retries)) - return self.create(textinst, retries=retries-1) + return self.create(baseurl, textinst, retries=retries-1) else: sys.exit("Image creation timed out too many times!") if ret > 0: @@ -607,7 +607,10 @@ def cli_all(args, hdds): missing.extend(outdated) for (num, img) in enumerate(missing, 1): logger.info("Creating image %s...[%s/%s]", img.filename, str(num), str(len(missing))) - img.create(args.textinst) + if img.filename.endswith(".img"): + img.create(args.textinst) + else: + img.create(args.baseurl, args.textinst) def cli_check(args, hdds): """Function for the CLI 'check' subcommand. Basically just calls @@ -685,7 +688,10 @@ def cli_image(args, *_): for (num, img) in enumerate(imgs, 1): logger.info("Creating image %s...[%s/%s]", img.filename, str(num), str(len(imgs))) - img.create(args.textinst) + if imgtype == 'guestfs': + img.create(args.textinst) + else: + img.create(args.baseurl, args.textinst) def parse_args(hdds): """Parse arguments with argparse.""" @@ -698,6 +704,10 @@ def parse_args(hdds): parser.add_argument( '-t', '--textinst', help="For any virt-install images, run the install in text mode " "and show details on stdout", action='store_true') + parser.add_argument( + '-b', '--baseurl', help="For any virt-install images, support alt baseurl for initrd and vmlinuz.", + choices=('pub', 'stg'), + default='pub') # This is a workaround for a somewhat infamous argparse bug # in Python 3. See: diff --git a/desktop-8.7-Beta.ks b/desktop-8.7-Beta.ks new file mode 100644 index 0000000..38be46e --- /dev/null +++ b/desktop-8.7-Beta.ks @@ -0,0 +1,21 @@ +bootloader --location=mbr +network --bootproto=dhcp +url --url="https://download.rockylinux.org/stg/rocky/8.7-Beta/BaseOS/x86_64/os/" +lang en_US.UTF-8 +keyboard us +timezone --utc America/New_York +clearpart --all +autopart +rootpw --plaintext weakpassword +user --name=test --password=weakpassword --plaintext +firstboot --enable +poweroff + +%packages +@^workstation-product-environment +-selinux-policy-minimum +%end + +%post +touch $INSTALL_ROOT/home/home_preserved +%end diff --git a/desktopencrypt-8.7-Beta.ks b/desktopencrypt-8.7-Beta.ks new file mode 100644 index 0000000..56a364f --- /dev/null +++ b/desktopencrypt-8.7-Beta.ks @@ -0,0 +1,17 @@ +bootloader --location=mbr +network --bootproto=dhcp +url --url="https://download.rockylinux.org/stg/rocky/8.7-Beta/BaseOS/x86_64/os/" +lang en_US.UTF-8 +keyboard us +timezone --utc America/New_York +clearpart --all +autopart --encrypted --passphrase=weakpassword +rootpw --plaintext weakpassword +user --name=test --password=weakpassword --plaintext +firstboot --enable +poweroff + +%packages +@^workstation-product-environment +-selinux-policy-minimum +%end diff --git a/hdds.json b/hdds.json index 0c766cb..197df87 100644 --- a/hdds.json +++ b/hdds.json @@ -155,6 +155,7 @@ "name" : "minimal", "releases" : { "8" : ["x86_64", "aarch64"], + "8.7-Beta" : ["x86_64"], "9" : ["x86_64", "aarch64"] }, "size" : "15" @@ -163,6 +164,7 @@ "name" : "minimal-uefi", "releases" : { "8" : ["x86_64", "aarch64"], + "8.7-Beta" : ["x86_64"], "9" : ["x86_64", "aarch64"] }, "size" : "15", @@ -172,6 +174,7 @@ "name" : "desktop", "releases" : { "8": ["x86_64", "aarch64"], + "8.7-Beta" : ["x86_64"], "9" : ["x86_64", "aarch64"] }, "size" : "20" @@ -180,6 +183,7 @@ "name" : "desktopencrypt", "releases" : { "8" : ["x86_64", "aarch64"], + "8.7-Beta" : ["x86_64"], "9" : ["x86_64", "aarch64"] }, "size" : "20" @@ -188,6 +192,7 @@ "name" : "server", "releases" : { "8" : ["x86_64", "aarch64"], + "8.7-Beta" : ["x86_64"], "9" : ["x86_64", "aarch64"] }, "size" : "9" @@ -196,6 +201,7 @@ "name" : "support", "releases" : { "8" : ["x86_64", "aarch64"], + "8.7-Beta" : ["x86_64"], "9" : ["x86_64", "aarch64"] }, "size" : "30" diff --git a/minimal-8.7-Beta.ks b/minimal-8.7-Beta.ks new file mode 100644 index 0000000..6392655 --- /dev/null +++ b/minimal-8.7-Beta.ks @@ -0,0 +1,14 @@ +bootloader --location=mbr +network --bootproto=dhcp +url --url="https://download.rockylinux.org/stg/rocky/8.7-Beta/BaseOS/x86_64/os/" +lang en_US.UTF-8 +keyboard us +timezone --utc America/New_York +clearpart --all +autopart +rootpw weakpassword +poweroff + +%packages +@core +%end diff --git a/minimal-uefi-8.7-Beta.ks b/minimal-uefi-8.7-Beta.ks new file mode 100644 index 0000000..1687bcb --- /dev/null +++ b/minimal-uefi-8.7-Beta.ks @@ -0,0 +1,18 @@ +bootloader --location=mbr +network --bootproto=dhcp +url --url="https://download.rockylinux.org/stg/rocky/8.7-Beta/BaseOS/x86_64/os/" +lang en_US.UTF-8 +keyboard us +timezone --utc America/New_York +clearpart --all +autopart +rootpw weakpassword +poweroff + +%packages +@core +%end + +%post +touch $INSTALL_ROOT/home/home_preserved +%end diff --git a/server-8.7-Beta.ks b/server-8.7-Beta.ks new file mode 100644 index 0000000..cd67a26 --- /dev/null +++ b/server-8.7-Beta.ks @@ -0,0 +1,16 @@ +bootloader --location=mbr +network --bootproto=dhcp +url --url="https://download.rockylinux.org/stg/rocky/8.7-Beta/BaseOS/x86_64/os/" +lang en_US.UTF-8 +keyboard us +timezone --utc America/New_York +clearpart --all +autopart +rootpw weakpassword +user --name=test --password=weakpassword --plaintext +poweroff + +%packages +@^server-product-environment +plymouth-system-theme +%end diff --git a/support-8.7-Beta.ks b/support-8.7-Beta.ks new file mode 100644 index 0000000..43f061e --- /dev/null +++ b/support-8.7-Beta.ks @@ -0,0 +1,19 @@ +bootloader --location=mbr +network --bootproto=dhcp +url --url="https://download.rockylinux.org/stg/rocky/8.7-Beta/BaseOS/x86_64/os/" +#repo --name="epel" --baseurl="http://mirrors.kernel.org/fedora-epel/8/Everything/x86_64/" +# use epel to keep scsi-target-utils instead of targetcli +lang en_US.UTF-8 +keyboard us +timezone --utc America/New_York +clearpart --all +autopart +rootpw weakpassword +poweroff + +%packages +@core +targetcli +nfs-utils +dnsmasq +%end