[PATCH 4/6] driver-updates: add 'refresh' to selection_menu()
Will Woods
wwoods at redhat.com
Tue Mar 4 15:53:57 UTC 2014
This allows the user to signal that they would like to refresh the
contents of the menu. You'll need a loop that wraps selection_menu() and
restarts the menu (with refreshed contents) whenever DoRefresh is
returned.
There are better ways to do this, but we don't have the time for that
right now.
---
dracut/driver-updates | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/dracut/driver-updates b/dracut/driver-updates
index f85a0b1..34fb55a 100755
--- a/dracut/driver-updates
+++ b/dracut/driver-updates
@@ -433,7 +433,11 @@ def dd_extract(driver, dest_path="/updates/", kernel_ver=None):
copy_file(src, firmware_updates)
move_file(src, initrd_firmware)
-def selection_menu(items, title, info_func, multi_choice=True):
+
+# an arbitrary value to signal refreshing the menu contents
+DoRefresh = True
+
+def selection_menu(items, title, info_func, multi_choice=True, refresh=False):
""" Display menu and let user select one or more choices.
:param items: list of items
@@ -488,6 +492,8 @@ def selection_menu(items, title, info_func, multi_choice=True):
"'c'-continue"]
if multi_choice:
opts[0] = "# to toggle selection"
+ if refresh:
+ opts.insert(1,"'r'-refresh")
idx = raw_input(''.join(['\n',
", ".join(opts[:-1]),
" or ", opts[-1], ": "]))
@@ -508,6 +514,8 @@ def selection_menu(items, title, info_func, multi_choice=True):
page -= 1
else:
print("First page")
+ elif idx.lower() == 'r' and refresh:
+ return DoRefresh
elif idx.lower() == 'c':
return
else:
--
1.8.5.3
More information about the anaconda-patches
mailing list