Skip to content

Commit

Permalink
Merge pull request #2344 from DaanDeMeyer/firstboot
Browse files Browse the repository at this point in the history
Fixes
  • Loading branch information
behrmann authored Feb 8, 2024
2 parents 02f299a + 373ab9c commit b8a4458
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ jobs:
- uses: actions/checkout@v3
- uses: ./

- name: Free disk space
run: |
sudo rm -rf /usr/local
sudo rm -rf /opt/hostedtoolcache
- name: Install
run: |
sudo apt-get update
Expand Down
12 changes: 8 additions & 4 deletions mkosi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2385,7 +2385,7 @@ def run_depmod(context: Context, *, force: bool = False) -> None:

def run_sysusers(context: Context) -> None:
if not find_binary("systemd-sysusers", root=context.config.tools()):
logging.info("systemd-sysusers is not installed, not generating system users")
logging.warning("systemd-sysusers is not installed, not generating system users")
return

with complete_step("Generating system users"):
Expand All @@ -2395,7 +2395,7 @@ def run_sysusers(context: Context) -> None:

def run_tmpfiles(context: Context) -> None:
if not find_binary("systemd-tmpfiles", root=context.config.tools()):
logging.info("systemd-tmpfiles is not installed, not generating volatile files")
logging.warning("systemd-tmpfiles is not installed, not generating volatile files")
return

with complete_step("Generating volatile files"):
Expand Down Expand Up @@ -2431,7 +2431,7 @@ def run_tmpfiles(context: Context) -> None:

def run_preset(context: Context) -> None:
if not find_binary("systemctl", root=context.config.tools()):
logging.info("systemctl is not installed, not applying presets")
logging.warning("systemctl is not installed, not applying presets")
return

with complete_step("Applying presets…"):
Expand All @@ -2446,7 +2446,7 @@ def run_hwdb(context: Context) -> None:
return

if not find_binary("systemd-hwdb", root=context.config.tools()):
logging.info("systemd-hwdb is not installed, not generating hwdb")
logging.warning("systemd-hwdb is not installed, not generating hwdb")
return

with complete_step("Generating hardware database"):
Expand All @@ -2461,6 +2461,10 @@ def run_firstboot(context: Context) -> None:
if context.config.overlay or context.config.output_format.is_extension_image():
return

if not find_binary("systemd-firstboot", root=context.config.tools()):
logging.warning("systemd-firstboot is not installed, not applying first boot settings")
return

password, hashed = context.config.root_password or (None, False)
if password and not hashed:
password = run(["openssl", "passwd", "-stdin", "-6"],
Expand Down
2 changes: 1 addition & 1 deletion mkosi/qemu.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ def available(self, log: bool = False) -> bool:


def hash_output(config: Config) -> "hashlib._Hash":
p = os.fspath(config.output_dir_or_cwd() / config.output_with_compression)
p = os.fspath(config.output_dir_or_cwd() / config.output)
return hashlib.sha256(p.encode())


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Packages=
libfido2-1
^libtss2-esys-[0-9\.]+-0$
libtss2-rc0
libtss2-mu0
^libtss2-mu[0-9\.-]+$
libtss2-tcti-device0

RemovePackages=
Expand Down
3 changes: 2 additions & 1 deletion tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class Config(NamedTuple):
distribution: Distribution
release: str
tools_tree_distribution: Optional[Distribution]
debug_shell: bool

def __init__(self, config: Config, options: Sequence[PathString] = []) -> None:
self.options = options
Expand Down Expand Up @@ -86,7 +87,7 @@ def mkosi(
def build(self, options: Sequence[str] = (), args: Sequence[str] = ()) -> CompletedProcess:
return self.mkosi(
"build",
[*options, "--debug", "--force"],
[*options, "--debug", "--force", *(["--debug-shell"] if self.config.debug_shell else [])],
args,
stdin=sys.stdin if sys.stdin.isatty() else None,
user=INVOKING_USER.uid,
Expand Down
6 changes: 6 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ def pytest_addoption(parser: Any) -> None:
type=Distribution,
choices=[Distribution(d) for d in Distribution.values()],
)
parser.addoption(
"--debug-shell",
help="Pass --debug-shell when running mkosi",
action="store_true",
)


@pytest.fixture(scope="session")
Expand All @@ -43,4 +48,5 @@ def config(request: Any) -> Image.Config:
distribution=distribution,
release=release,
tools_tree_distribution=cast(Distribution, request.config.getoption("--tools-tree-distribution")),
debug_shell=request.config.getoption("--debug-shell"),
)

0 comments on commit b8a4458

Please sign in to comment.