diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2012-06-16 22:46:22 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2012-06-16 22:46:22 +0000 |
commit | b0011ae17e2f56a9a348a878ed4cabf22c1688d0 (patch) | |
tree | e25057cc74af83721e5febfe0c12b96a441505a1 | |
parent | 9a7ecb415affd96631d4b175cc39bc5eb8ebbf7c (diff) | |
download | live-b0011ae17e2f56a9a348a878ed4cabf22c1688d0.tar.gz |
Use hash for disk list
-rwxr-xr-x | setup | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -9,7 +9,7 @@ d = dialog.Dialog() d.setBackgroundTitle('Dyson Installer') -HDD = [] +HDD = {} def get_hdd(): pat = re.compile('\d+\.\s+(\S+)\s+<(.+)>') @@ -17,18 +17,17 @@ def get_hdd(): for line in out: match = pat.search(line) if match: - HDD.append({ - 'name': match.group(1), - 'desc': match.group(2), - 'use': 0, - }) + HDD[match.group(1)] = { + 'desc' : match.group(2), + 'use' : 0, + } if len(HDD) == 0: d.msgbox(width=50, title='Error: no disks found', text='\nSorry, no hard disks found on your system. Installation is not possible.') sys.exit(1) # if there is only one disk, use it by default: - if len(HDD) == 1: - HDD[0]['use'] = 1 +# if len(HDD) == 1: +# HDD[0]['use'] = 1 @@ -36,7 +35,8 @@ def choose_hdd(): while True: choices = [] for hdd in HDD: - choices.append((hdd['name'], hdd['desc'], hdd['use'])) + props = HDD[hdd] + choices.append((hdd, props['desc'], props['use'])) (code, disks) = d.checklist(choices=choices, width=70, height=20, title='Choose disks to use for ZFS root pool', text=''' @@ -47,11 +47,11 @@ If disk does not have a Solaris partition you will be asked to create one.''') if code: break if len(disks) > 0: - for hdd in HDD: - if hdd['name'] in disks: - hdd['use'] = 1 + for h in HDD: + if h in disks: + HDD[h]['use'] = 1 else: - hdd['use'] = 0 + HDD[h]['use'] = 0 break else: d.msgbox(width=40, height=8, title='You need at least one disk', |