mirror of
https://github.com/rocky-linux/createhdds.git
synced 2024-12-22 01:58:30 +00:00
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
This commit is contained in:
parent
4108a7ac16
commit
d64b0a2fcb
@ -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:
|
||||
|
21
desktop-8.7-Beta.ks
Normal file
21
desktop-8.7-Beta.ks
Normal file
@ -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
|
17
desktopencrypt-8.7-Beta.ks
Normal file
17
desktopencrypt-8.7-Beta.ks
Normal file
@ -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
|
@ -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"
|
||||
|
14
minimal-8.7-Beta.ks
Normal file
14
minimal-8.7-Beta.ks
Normal file
@ -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
|
18
minimal-uefi-8.7-Beta.ks
Normal file
18
minimal-uefi-8.7-Beta.ks
Normal file
@ -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
|
16
server-8.7-Beta.ks
Normal file
16
server-8.7-Beta.ks
Normal file
@ -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
|
19
support-8.7-Beta.ks
Normal file
19
support-8.7-Beta.ks
Normal file
@ -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
|
Loading…
Reference in New Issue
Block a user