initrdinject: Remove RHEL4 support

It's end of life, let's move on
This commit is contained in:
Cole Robinson 2018-10-09 14:18:36 -04:00
parent c797071be3
commit 71626b1dd2
2 changed files with 3 additions and 68 deletions

View File

@ -30,9 +30,8 @@ meter = util.make_meter(quiet=False)
DEVFEDORA_URL = "http://dl.fedoraproject.org/pub/fedora/linux/development/%s/Server/%s/os/"
FEDORA_URL = "http://dl.fedoraproject.org/pub/fedora/linux/releases/%s/Server/%s/os/"
(WARN_RHEL4,
WARN_RHEL5,
WARN_LATEST) = range(1, 4)
(WARN_RHEL5,
WARN_LATEST) = range(1, 3)
def prompt():
@ -62,8 +61,6 @@ def _add(*args, **kwargs):
_alldistros[_d.name] = _d
_add("centos-4.9", "http://vault.centos.org/4.9/os/x86_64",
warntype=WARN_RHEL4, ks2=True, virtio=False)
_add("centos-5.11", "http://vault.centos.org/5.11/os/x86_64/",
warntype=WARN_RHEL5)
_add("centos-6-latest", "http://ftp.linux.ncsu.edu/pub/CentOS/6/os/x86_64/",
@ -106,10 +103,7 @@ def _fetch_distro(distro):
def _test_distro(distro):
os.system("clear")
print("\n")
if distro.warntype == WARN_RHEL4:
print("RHEL4: Makes its way to the text installer, then chokes ")
print("on our bogus URI http://HEY-THIS-IS-OUR-BAD-KICKSTART-URL.com/")
elif distro.warntype == WARN_RHEL5:
if distro.warntype == WARN_RHEL5:
print("RHEL5, RHEL6, Fedora < 17: You'll get an error about a ")
print("bogus bootproto ITREADTHEKICKSTART. This means anaconda ")
print("read our busted kickstart.")

View File

@ -12,62 +12,6 @@ import subprocess
import tempfile
def _rhel4_initrd_inject(initrd, injections):
try:
file_proc = subprocess.Popen(["file", "-z", initrd],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
s = bytes("ext2 filesystem", "ascii")
if s not in file_proc.communicate()[0]:
return False
except Exception:
logging.exception("Failed to file command for rhel4 initrd detection")
return False
logging.debug("Is RHEL4 initrd")
# Uncompress the initrd
newinitrd = open(initrd + ".new", "wb")
gzip_proc = subprocess.Popen(["gzip", "-d", "-f", "-c", initrd],
stdout=newinitrd,
stderr=subprocess.PIPE)
gzip_proc.wait()
newinitrd.close()
debugfserr = bytes()
for filename in injections:
# We have an ext2 filesystem, use debugfs to inject files
cmd = ["debugfs", "-w", "-R",
"write %s %s" % (filename, os.path.basename(filename)),
newinitrd.name]
logging.debug("Copying %s to the initrd with cmd=%s", filename, cmd)
debugfs_proc = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
debugfs_proc.wait()
debugfserr += debugfs_proc.stderr.read() or bytes()
gziperr = gzip_proc.stderr.read()
if gziperr:
logging.debug("gzip stderr=%s", gziperr)
if debugfserr:
logging.debug("debugfs stderr=%s", debugfserr)
# Recompress the initrd
gzip_proc = subprocess.Popen(["gzip"],
stdin=open(newinitrd.name, "rb"),
stdout=open(initrd, "wb"),
stderr=subprocess.PIPE)
gzip_proc.wait()
gziperr = gzip_proc.stderr.read()
if gziperr:
logging.debug("gzip stderr=%s", gziperr)
os.unlink(newinitrd.name)
return True
def perform_initrd_injections(initrd, injections, scratchdir):
"""
Insert files into the root directory of the initial ram disk
@ -75,9 +19,6 @@ def perform_initrd_injections(initrd, injections, scratchdir):
if not injections:
return
if _rhel4_initrd_inject(initrd, injections):
return
tempdir = tempfile.mkdtemp(dir=scratchdir)
os.chmod(tempdir, 0o775)