summaryrefslogtreecommitdiff
path: root/install
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2013-09-08 21:54:31 +0400
committerIgor Pashev <pashev.igor@gmail.com>2013-09-08 21:54:31 +0400
commitb0df8edf7e9cdec5b4dba260eeec99b5e62e74bd (patch)
tree5d204d55ad03d5c60d17cd01376d8f93348624bd /install
parentf4b97d0af96c584a9b39f8492cfce185ffd993ae (diff)
downloadlive-b0df8edf7e9cdec5b4dba260eeec99b5e62e74bd.tar.gz
Run apt-get update
Diffstat (limited to 'install')
-rwxr-xr-xinstall43
1 files changed, 42 insertions, 1 deletions
diff --git a/install b/install
index a191445..4bcb624 100755
--- a/install
+++ b/install
@@ -771,8 +771,49 @@ def install_minimal():
umount_in_bootenv() # debootstrap mounts required FS for us
call(['zfs', 'rollback', '-r', bootenv + '@empty'])
+
+def apt_get_update(log):
+ progress = ProgressBar(screen, title='Updating APT cache', text='Please wait ...')
+ read, write = os.pipe()
+ pid = os.fork()
+ if pid == 0:
+ os.close(read)
+ os.dup2(log, 1)
+ os.dup2(log, 2)
+ try:
+ os.execl('/usr/sbin/chroot', 'chroot apt-get update', rootdir,
+ '/usr/bin/apt-get', '-o', 'APT::Status-Fd=' + str(write), 'update')
+ except EnvironmentError as e:
+ os.write(log, str(e))
+ sys.exit(e.errno)
+ else: # Parent
+ os.close(write)
+ pr = os.fdopen(read, 'r', 1)
+ while True:
+ line = pr.readline()
+ if not line:
+ break
+ try:
+ (status, f, percent, text) = line.split(':')
+ except:
+ os.write(log, 'Installer failed to parse line "{}"'.format(line))
+ continue
+ progress.progress = float(percent)
+ progress.text = text
+
+ status = os.wait()[1]
+ return os.WEXITSTATUS(status)
+
+
+
+
+
+
def install_profile():
- pass
+ logfile = rootdir + '/root/apt-get.log'
+ log = os.open(logfile, os.O_WRONLY + os.O_CREAT)
+ code = apt_get_update(log)
+ os.close(log)
def umount_in_bootenv():