diff --git a/bootstrap/bootstrap.py b/bootstrap/bootstrap.py index 6e08fd9..0b3e688 100644 --- a/bootstrap/bootstrap.py +++ b/bootstrap/bootstrap.py @@ -30,7 +30,7 @@ html = """ - +
Please wait while your TLJH is building...
Click the button below to see the logs
@@ -200,8 +200,10 @@ def serve_forever(server): pass def main(): - temp_page_flag = "--temporary-page" - if temp_page_flag in sys.argv: + flags = sys.argv[1:] + temp_page_flag = "--show-progress-page" + + if temp_page_flag in flags: # Serve the loading page until TLJH builds with open("/var/run/index.html", "w+") as f: f.write(html) @@ -213,8 +215,10 @@ def main(): loading_page_server = HTTPServer(("", 80), LoaderPageRequestHandler) p = multiprocessing.Process(target=serve_forever, args=(loading_page_server,)) p.start() - # Put the pid after the temp page flag to be passed to the istaller - sys.argv.insert(sys.argv.index(temp_page_flag)+1, str(p.pid)) + # Pass the server's pid as a flag to the istaller + flags.remove(temp_page_flag) + pid_flag = "--progress-page-server-pid" + flags.extend([pid_flag, str(p.pid)]) except OSError: # Only serve the loading page when installing TLJH pass @@ -303,7 +307,7 @@ def main(): os.path.join(hub_prefix, 'bin', 'python3'), '-m', 'tljh.installer', - ] + sys.argv[1:] + ] + flags ) if __name__ == '__main__': diff --git a/tljh/installer.py b/tljh/installer.py index 7756757..0a21967 100644 --- a/tljh/installer.py +++ b/tljh/installer.py @@ -487,8 +487,9 @@ def main(): help='Plugin pip-specs to install' ) argparser.add_argument( - '--temporary-page', - help='Serve a temporary page while TLJH is building' + '--progress-page-server-pid', + type=int, + help='The pid of the progress page server' ) args = argparser.parse_args() @@ -510,8 +511,6 @@ def main(): try: os.kill(int(args.temporary_page), signal.SIGINT) # Remove the pid file and the temporary html page - os.remove('/index.html') - os.remove('/favicon.ico') except Exception as e: pass