From 9976d0a3088ee314b19d5cc21a89c89a73ec4f7d Mon Sep 17 00:00:00 2001 From: Igor Pashev Date: Thu, 11 Apr 2013 13:04:27 +0000 Subject: More messages --- install | 65 +++++++++++++++++++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 24 deletions(-) (limited to 'install') diff --git a/install b/install index 7dd7b01..53c6f1b 100755 --- a/install +++ b/install @@ -17,9 +17,11 @@ from subprocess import Popen, PIPE, call from pprint import pprint from tempfile import mkstemp from urllib2 import urlopen, URLError, HTTPError +from time import sleep import os import re import sys +import math # Snack screen screen = None @@ -33,7 +35,7 @@ rpool = None # Name of the root slice, where ZFS root pool will be created (e. g. c0t0d0s0) rslice = None -# Created boot environment +# Created boot environment, e. g. rpoot/ROOT/osdy-0 bootenv = None # Version to install: @@ -502,10 +504,10 @@ def configure_mirror(): def debootstrap(): progress = ProgressBar(screen, - title='Installing base system', - width=70) + title='Installing base system, please wait...', + width=76) - progress.text = 'Starting debootstrap ...' + progress.text = ' ' read, write = os.pipe() @@ -533,30 +535,45 @@ def debootstrap(): log = open('/root/di.log', 'w') info_re = re.compile(' +') m = 'START' - IA = [] # Arguments for I, cleaned after each IF + IA = [] # Arguments for IF, cleaned after each IF + PA = [] # Arguments for PF, cleaned after each PF + EA = [] # Arguments for EF, cleaned after each EF while True: line = di.readline() if not line: break - - print(line, file=log) - colon = line.find(':') - if colon == -1: - continue - cmd = line[:colon] - info = line[colon+1:].strip() - - if cmd == 'P': # "P: 23 454 XYZ" or "P: 123 3445" - p = info_re.split(info) - if len(p) == 3: - m = p[2].strip() - p = int(p[0]) / int (p[1]) - progress.progress = (miles[m][0] + (miles[m][1] - miles[m][0]) * p) - elif cmd == 'IA': - IA.append(info) - elif cmd == 'IF': - progress.text = info % tuple(IA) - IA = [] + try: + colon = line.find(':') + if colon == -1: + continue + cmd = line[:colon] + info = line[colon+1:].strip() + + if cmd == 'P': # "P: 23 454 XYZ" or "P: 123 3445" + p = info_re.split(info) + if len(p) == 3: + m = p[2].strip() + progress.progress = math.ceil(miles[m][0] + float(p[0])*(miles[m][1] - miles[m][0]) / float(p[1])) + elif cmd == 'IA': + IA.append(info) + elif cmd == 'PA': + PA.append(info) + elif cmd == 'EA': + EA.append(info) + elif cmd == 'IF': + progress.text = (info % tuple(IA)) + IA = [] + elif cmd == 'PF': + progress.text = (info % tuple(PA)) + PA = [] + elif cmd == 'EF': + progress.text = (info % tuple(EA)) + EA = [] + sleep(1) + except: + pass + status = os.wait()[1] + return os.WEXITSTATUS(status) -- cgit v1.2.3