Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 61 additions & 0 deletions classes/systimemgrconfig.bbclass
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Generates /etc/systimemgr.conf based on active override.
#
# Supported overrides:
# - ntp-dtt-rdkdefault
# - ntp-dtt-drm-tee

python create_systimemgrconfig() {
import os

overrides = (d.getVar("OVERRIDES", True) or "").split(":")
rootfs_dir = d.getVar("IMAGE_ROOTFS", True)

content = None
remove_secure_conf = False

if "ntp-dtt-drm-tee" in overrides:
content = """timesrc ntp /ntp
timesrc dtt /dtt
timesrc drm /drm
timesync tee /tee
"""
remove_secure_conf = True
elif "ntp-dtt-rdkdefault" in overrides:
content = """timesrc ntp /ntp
timesrc dtt /dtt
timesync rdkdefault /clock_time
"""

if content is None:
bb.note("No supported systimemgr override active; skipping systimemgr.conf generation")
return

dest_dir = os.path.join(rootfs_dir, "etc")
os.makedirs(dest_dir, exist_ok=True)

dest_path = os.path.join(dest_dir, "systimemgr.conf")
with open(dest_path, "w", encoding="utf-8") as f:
f.write(content)

os.chmod(dest_path, 0o644)

if remove_secure_conf:
secure_conf = os.path.join(
rootfs_dir,
"lib",
"systemd",
"system",
"systimemgr.service.d",
"secure.conf"
)
Comment on lines +43 to +50

if os.path.exists(secure_conf):
os.remove(secure_conf)

service_dir = os.path.dirname(secure_conf)
if os.path.isdir(service_dir) and not os.listdir(service_dir):
os.rmdir(service_dir)
}

create_systimemgrconfig[vardepsexclude] += "DATETIME"
ROOTFS_POSTPROCESS_COMMAND += 'create_systimemgrconfig; '
3 changes: 3 additions & 0 deletions conf/include/image-classes.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ IMAGE_CLASSES += "mediariteproductconfig"

# /etc/rfcdefaults/socprovisioning.ini
IMAGE_CLASSES += "socprovisioning-config"

#/etc/systimemgr.conf
IMAGE_CLASSES += "systimemgrconfig"
Loading