[PATCH 5/6] driver-updates: add DoRefresh loop to select_iso()

Will Woods wwoods at redhat.com
Tue Mar 4 17:43:37 UTC 2014


On Tue, 2014-03-04 at 10:53 -0500, Will Woods wrote:
> This allows the user to hit 'r' to refresh the contents of the device
> menu and get a refreshed set of devices.
> 
> This is handy if, say, you want to eject the installer DVD and insert a
> driver DVD, and load drivers from that.
> ---
>  dracut/driver-updates | 30 ++++++++++++++++++------------
>  1 file changed, 18 insertions(+), 12 deletions(-)
> 
> diff --git a/dracut/driver-updates b/dracut/driver-updates
> index 34fb55a..e58b7ca 100755
> --- a/dracut/driver-updates
> +++ b/dracut/driver-updates
> @@ -654,20 +654,26 @@ def select_iso():
>                    or (None, None) if no ISO file is selected
>          :rtype: (str, str)
>      """
> -    try:
> -        _ret, out = run_cmd(["blkid"])
> -    except (OSError, RunCmdError):
> -        return (None, None)
> +    header = "      %-10s %-20s %-15s %s" % ("DEVICE", "TYPE", "LABEL", "UUID")
>  
> -    devices = []
> -    for line in out.splitlines():
> -        dev = parse_blkid(line)
> -        if dev:
> -            devices.append(DeviceInfo(**dev))
> +    iso_dev = DoRefresh
> +    while iso_dev is DoRefresh:
> +        try:
> +            _ret, out = run_cmd(["blkid"])
> +        except (OSError, RunCmdError):
> +            return (None, None)
> +
> +        devices = []
> +        for line in out.splitlines():
> +            dev = parse_blkid(line)
> +            if dev:
> +                devices.append(DeviceInfo(**dev))
> +
> +        iso_dev = selection_menu(devices,
> +                                 "Driver disk device selection\n" + header,
> +                                 str, multi_choice=False, refresh=True)
>         print iso_dev
          ^^^^^^^^^^^^^
Whoops - that's a debugging line that snuck into this commit. This line
should be dropped.

-w



More information about the anaconda-patches mailing list