mirror of
https://github.com/BigfootACA/arch-image-builder.git
synced 2024-11-11 08:37:54 +08:00
23 lines
701 B
Python
23 lines
701 B
Python
|
import os
|
||
|
from logging import getLogger
|
||
|
from builder.lib.context import ArchBuilderContext
|
||
|
from builder.component import systemd as systemd_comp
|
||
|
log = getLogger(__name__)
|
||
|
|
||
|
|
||
|
def proc_systemd(ctx: ArchBuilderContext):
|
||
|
systemd_comp.enable(ctx, ctx.get("systemd.enable", []))
|
||
|
systemd_comp.disable(ctx, ctx.get("systemd.disable", []))
|
||
|
systemd_comp.set_default(ctx, ctx.get("systemd.default", None))
|
||
|
|
||
|
|
||
|
def proc_machine_id(ctx: ArchBuilderContext):
|
||
|
id = ctx.get("machine-id", "")
|
||
|
root = ctx.get_rootfs()
|
||
|
mid = os.path.join(root, "etc/machine-id")
|
||
|
with open(mid, "w") as f:
|
||
|
f.write(id)
|
||
|
f.write(os.linesep)
|
||
|
if len(id) == 0: log.info("removed machine-id")
|
||
|
else: log.info(f"set machine-id to {id}")
|