diff options
author | Igor Pashev <pashev.igor@gmail.com> | 2013-04-07 23:20:01 +0000 |
---|---|---|
committer | Igor Pashev <pashev.igor@gmail.com> | 2013-04-07 23:24:39 +0000 |
commit | ac1a63382ea0481b3451d518006026b0d8c28f03 (patch) | |
tree | f63664c0dcbe827d33abd22302e8cffdddbce558 /install | |
parent | bfb1de5aa23a49b9414c1145c2cd65de2f03b35f (diff) | |
download | live-ac1a63382ea0481b3451d518006026b0d8c28f03.tar.gz |
Show progress
Diffstat (limited to 'install')
-rwxr-xr-x | install | 22 |
1 files changed, 12 insertions, 10 deletions
@@ -10,6 +10,7 @@ without prior consent from anybody. """ from lib.hdd import HDD +from lib.snack import * from snack import * from subprocess import Popen, PIPE, call from pprint import pprint @@ -57,16 +58,21 @@ Whould you like to continue?''', def find_zpools(): global zpools + progress = ProgressBar(screen, title='Searching for zpools') + progress.progress = 10 zpools = [] zpool_cmd = Popen(['zpool', 'list', '-H', '-o', 'name'], stdout=PIPE, stderr=PIPE) for line in zpool_cmd.stdout: zpools.append(line.rstrip()) + progress.progress = 50 zpool_cmd = Popen("zpool import | awk '/pool:/ {print $2}'", shell=True, stdout=PIPE, stderr=PIPE) for line in zpool_cmd.stdout: zpools.append(line.rstrip()) + progress.progress = 100 def find_hdds(): global hdds + progress = ProgressMessage(screen, title='Please, wait', text='Searching for disks...') hdds = [] pat = re.compile('\d+\.\s+(\S+)\s+<(.+?)(\s+cyl.*)?>') format_cmd = Popen('format </dev/null', shell=True, stdout=PIPE) @@ -76,6 +82,8 @@ def find_hdds(): name = m.group(1) desc = m.group(2) hdds.append(HDD(name, desc)) + if len(hdds) == 0: + raise NoDisks('No disks found') def choose_rpool(): @@ -155,12 +163,13 @@ def configure_rpool(): rpool = create_rpool(hdd) if rpool: if not pool_is_imported(rpool): + progress = ProgressMessage(screen, title='Please, wait', text='Importing ZFS pool "{}"...'.format(rpool)) zpool_cmd = Popen(['zpool', 'import', '-f', rpool], stderr=PIPE, stdout=PIPE) out, err = zpool_cmd.communicate() if 0 != zpool_cmd.returncode: ButtonChoiceWindow(screen, title='Importing of ZFS pool "{}" failed'.format(rpool), - text=err, buttons = ['Ok'], width=70) + text=err, buttons=['Ok'], width=70) rpool = None @@ -261,18 +270,11 @@ will be used.' -# Begin installation: -print("Getting list of hard disk drives ... ") -find_hdds() - screen = SnackScreen() +screen.pushHelpLine(' ') try: - screen.pushHelpLine(' ') - - if len(hdds) == 0: - raise NoDisks('No disks found') - welcome() + find_hdds() configure_rpool() configure_zfs() |