import hashlib
import http.server
import itertools
+import importlib.resources
import json
import logging
import os
os.chown("mkosi.version", uid, gid)
+def show_docs(args: MkosiArgs) -> None:
+ with importlib.resources.path("mkosi.resources", "mkosi.1") as man:
+ if man.exists():
+ run(["man", man])
+ return
+
+ md = importlib.resources.read_text("mkosi.resources", "mkosi.md")
+ page(md, args.pager)
+
+
def expand_specifier(s: str) -> str:
return s.replace("%u", InvokingUser.name())
if args.verb.needs_root() and os.getuid() != 0:
die(f"Must be root to run the {args.verb} command")
+ if args.verb == Verb.documentation:
+ return show_docs(args)
+
if args.verb == Verb.genkey:
return generate_key_cert_pair(args)
class Verb(StrEnum):
- build = enum.auto()
- clean = enum.auto()
- summary = enum.auto()
- shell = enum.auto()
- boot = enum.auto()
- qemu = enum.auto()
- ssh = enum.auto()
- serve = enum.auto()
- bump = enum.auto()
- help = enum.auto()
- genkey = enum.auto()
+ build = enum.auto()
+ clean = enum.auto()
+ summary = enum.auto()
+ shell = enum.auto()
+ boot = enum.auto()
+ qemu = enum.auto()
+ ssh = enum.auto()
+ serve = enum.auto()
+ bump = enum.auto()
+ help = enum.auto()
+ genkey = enum.auto()
+ documentation = enum.auto()
def supports_cmdline(self) -> bool:
return self in (Verb.shell, Verb.boot, Verb.qemu, Verb.ssh)
mkosi [options...] {b}serve{e}
mkosi [options...] {b}bump{e}
mkosi [options...] {b}genkey{e}
+ mkosi [options...] {b}documentation{e}
mkosi [options...] {b}help{e}
mkosi -h | --help
mkosi --version
`mkosi [options…] genkey`
+`mkosi [options…] documentation`
+
`mkosi [options…] help`
# DESCRIPTION
`SecureBootKey=`/`--secure-boot-key=` and
`SecureBootCertificate=`/`--secure-boot-certificate=` options.
+`documentation`
+
+: Show mkosi's documentation.
+
`help`
: This verb is equivalent to the `--help` switch documented below: it