summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-04-11 01:09:12 +0000
committerIgor Pashev <pashev.igor@gmail.com>2013-04-11 01:09:12 +0000
commitdb21e0ba05c23d3e3a04657836154b7be728ab90 (patch)
tree046259cd712c234c2d6b56f8e9e491406bfc1647 /install
parent838e2c0ea9a9ca572cb17f978843b01abd45cbf4 (diff)
downloadlive-db21e0ba05c23d3e3a04657836154b7be728ab90.tar.gz
Can show messages from debootstrap
Diffstat (limited to 'install')
-rwxr-xr-xinstall42
1 files changed, 35 insertions, 7 deletions
diff --git a/install b/install
index e585b92..df8dd2e 100755
--- a/install
+++ b/install
@@ -8,6 +8,7 @@ thereby relinquishing all copyrights. Everyone is free
to use, modify, republish, sell or give away this work
without prior consent from anybody.
"""
+from __future__ import print_function
from lib.hdd import HDD
from lib.snack import *
@@ -52,7 +53,8 @@ mirrors = [
# - mile is a stage name, e. g. DOWNDEBS;
# - a, z - the start and the end position on progress bar,
# e. i. a=0 z=100 - entire progress bar (100%);
-debootstrap_miles = {
+miles = {
+ 'START' : (0, 0), # Dummy
'DOWNREL' : (0, 1), # Downloading the 'Release' file
'DOWNPKGS' : (1, 5), # Downloading the 'Packages' file
'SIZEDEBS' : (5, 10), # Finding packags sizes
@@ -511,6 +513,12 @@ def debootstrap():
if pid == 0:
os.close(read)
os.dup2(write, 3)
+ stdo = os.open('/root/stdout', os.O_WRONLY + os.O_CREAT)
+ stde = os.open('/root/stderr', os.O_WRONLY + os.O_CREAT)
+ os.dup2(stdo, 1)
+ os.dup2(stde, 2)
+ os.close(stdo)
+ os.close(stde)
os.close(write)
try:
os.execl('/usr/sbin/debootstrap', 'debootstrap',
@@ -521,15 +529,35 @@ def debootstrap():
sys.exit(e.errno)
else:
os.close(write)
- f = os.fdopen(read, 'r', 0)
- r = re.compile(' +')
+ di = os.fdopen(read, 'r', 1)
+ log = open('/root/di.log', 'w')
+ info_re = re.compile(' +')
+ m = 'START'
+ IA = [] # Arguments for I, cleaned after each IF
while True:
- line = f.readline()
- if line:
- progress.text = line
- else:
+ 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 = []
+
def destroy_bootenv():