Progress bar on osinstall not working

Issue #438 resolved
Christopher Bradsher created an issue

I found it strange that Imagr has a progress bar but it never does anything; it turns out it was looking for an old and now incorrect format for the feedback from startosinstall.

As with the other issue, I’ll just post the diff

diff --git a/Imagr/osinstall.py b/Imagr/osinstall.py
index 40224be..39f941e 100644
--- a/Imagr/osinstall.py
+++ b/Imagr/osinstall.py
@@ -305,14 +305,14 @@ def run(item, target, progress_method=None):
             NSLog('%@', msg)
             if progress_method:
                 progress_method(None, None, msg)
-        elif msg.startswith('Preparing '):
+        elif msg.startswith('Preparing'):
             # percent-complete messages
             try:
-                percent = int(float(msg[10:].rstrip().rstrip('.')))
+                percent = int(float(msg[10:].lstrip().rstrip().rstrip('%.')))
             except ValueError:
                 percent = -1
             if progress_method:
-                progress_method(None, percent, None)
+                progress_method(None, percent, "%d%% complete." % percent)
         elif msg.startswith(('By using the agreetolicense option',
                              'If you do not agree,')):
             # annoying legalese

Comments (2)

  1. Log in to comment