[PATCH 2/5] Add Driver Update Disk support to anaconda-dracut
Samantha N. Bueno
sbueno+anaconda at redhat.com
Mon Apr 29 14:52:40 UTC 2013
On Fri, Apr 26, 2013 at 10:32:22AM -0700, Brian C. Lane wrote:
> From: "Brian C. Lane" <bcl at redhat.com>
> ...
>--- /dev/null
>+++ b/dracut/driver-updates
>@@ -0,0 +1,587 @@
>
> ...
>
> +def dd_extract(driver, dest_path="/updates/", kernel_ver=None):
> + """ Extract a driver rpm to a destination path
> +
> + :param driver: Driver to extract
> + :type driver: Driver object
> + :param dest_path: Top directory of the destination path
> + :type dest_path: string
> + :returns: None
> +
> + This extracts the driver's files into 'dest_path' (which defaults
> + to /updates/ so that the normal live updates handling will overlay
> + any binary or library updates onto the initrd automatically.
> + """
> + if not kernel_ver:
> + kernel_ver = os.uname()[2]
> +
> + cmd = ["dd_extract", "-k", kernel_ver]
> + cmd += driver.args
> + cmd += ["--rpm", driver.rpm, "--directory", dest_path]
> + log.info("Extracting files from %s" % driver.rpm)
> + try:
> + run_cmd(cmd)
> + except (OSError, RunCmdError):
> + log.error("dd_extract failed, skipped %s" % driver.rpm)
> + return
> +
> + # Create the destination directories
> + initrd_updates = "/lib/modules/" + os.uname()[2] + "/updates/"
> + ko_updates = dest_path + initrd_updates
> + initrd_firmware = "/lib/firmware/updates/"
> + firmware_updates = dest_path + initrd_firmware
> + for d in (initrd_updates, ko_updates, initrd_firmware, firmware_updates):
> + if not os.path.exists(d):
> + os.makedirs(d)
> +
> + # Copy *.ko files over to /updates/lib/modules/<kernel>/updates/
> + for root, dirs, files in os.walk(dest_path+"/lib/modules/"):
> + if root.endswith("/updates") and os.path.isdir(root):
> + continue
> + for f in (f for f in files if f.endswith(".ko")):
> + src = root+"/"+f
> + copy_file(src, ko_updates)
> + move_file(src, initrd_updates)
'dirs' doesn't appear to be used in this for loop.
> + # Copy the firmware updates
> + for root, dirs, files in os.walk(dest_path+"/lib/firmware/"):
> + if root.endswith("/updates") and os.path.isdir(root):
> + continue
> + for f in (f for f in files):
> + src = root+"/"+f
> + copy_file(src, firmware_updates)
> + move_file(src, initrd_firmware)
Same here ('dirs' unused).
Other than these couple of things--this and the other patch set look
good to me.
Samantha
More information about the anaconda-patches
mailing list