]> git.ipfire.org Git - thirdparty/mkosi.git/commitdiff
Run mkosi serve without root
authorPyfisch <pyfisch@posteo.org>
Thu, 15 Sep 2022 15:03:49 +0000 (17:03 +0200)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Sun, 18 Sep 2022 07:04:52 +0000 (09:04 +0200)
If the output image already exists mkosi serve works without root.
Otherwise an error message is shown (as before).

Show the correct URL where the artifacts are served.

mkosi/__init__.py

index 4f8bd36067d3f1f4cb6759b84d9c08f5c1e70534..333a3ea53df0ed4545c8c546bfc466e928f8ebb2 100644 (file)
@@ -124,7 +124,7 @@ SomeIO = Union[BinaryIO, TextIO]
 PathString = Union[Path, str]
 
 MKOSI_COMMANDS_NEED_BUILD = (Verb.shell, Verb.boot, Verb.qemu, Verb.serve)
-MKOSI_COMMANDS_SUDO = (Verb.build, Verb.clean, Verb.shell, Verb.boot, Verb.serve)
+MKOSI_COMMANDS_SUDO = (Verb.build, Verb.clean, Verb.shell, Verb.boot)
 MKOSI_COMMANDS_CMDLINE = (Verb.build, Verb.shell, Verb.boot, Verb.qemu, Verb.ssh)
 
 DRACUT_SYSTEMD_EXTRAS = [
@@ -7902,13 +7902,12 @@ def run_serve(config: MkosiConfig) -> None:
     """Serve the output directory via a tiny embedded HTTP server"""
 
     port = 8081
-    image = config.output.parent
 
     if config.output_dir is not None:
         os.chdir(config.output_dir)
 
     with http.server.HTTPServer(("", port), http.server.SimpleHTTPRequestHandler) as httpd:
-        print(f"Serving HTTP on port {port}: http://localhost:{port}/{image}")
+        print(f"Serving HTTP on port {port}: http://localhost:{port}/")
         httpd.serve_forever()