From d3a2d69f026b08d438dca4dff13e3bc44823a273 Mon Sep 17 00:00:00 2001 From: Esben Haabendal <esben@geanix.com> Date: Thu, 9 Mar 2023 19:08:30 +0100 Subject: [PATCH] openharmony-standard: Run time_service as systemd service Signed-off-by: Esben Haabendal <esben@geanix.com> --- .../openharmony/files/openharmony-preinit | 12 ------------ .../openharmony/files/time.service | 17 +++++++++++++---- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/recipes-openharmony/openharmony/files/openharmony-preinit b/recipes-openharmony/openharmony/files/openharmony-preinit index f48b6f14..365b8a3f 100644 --- a/recipes-openharmony/openharmony/files/openharmony-preinit +++ b/recipes-openharmony/openharmony/files/openharmony-preinit @@ -136,18 +136,6 @@ fi #sa_main /system/profile/dps_service.xml & # SA: 1401 180 3502 #sleep "$STARTUP_CMD_SLEEP" -# trigger: boot -# "name" : "time_service", -# "path" : ["/system/bin/sa_main", "/system/profile/time_service.xml"], -# "uid" : "system", -# "gid" : ["system", "shell"], -# "caps" : ["SYS_TIME", "WAKE_ALARM"] -if systemctl -q is-enabled time.service; then - echo >/dev/console "Starting OpenHarmony time service" - su system -c '/system/bin/sa_main /system/profile/time_service.xml &' # SA: 1401 180 3702 - sleep "$STARTUP_CMD_SLEEP" -fi - # trigger: boot # "name" : "foundation", # "path" : ["/system/bin/sa_main", "/system/profile/foundation.xml"], diff --git a/recipes-openharmony/openharmony/files/time.service b/recipes-openharmony/openharmony/files/time.service index f87cdf88..8e6e64e5 100644 --- a/recipes-openharmony/openharmony/files/time.service +++ b/recipes-openharmony/openharmony/files/time.service @@ -1,10 +1,19 @@ [Unit] -Description=OpenHarmony Time service +Description=OpenHarmony Time service (SA: 1401 180 3702) +Requires=samgr.service +After=samgr.service +# Logging to hilogd, but seems to work without it +Wants=hilogd.service +After=hilogd.service [Service] -Type=oneshot -ExecStart=/bin/echo "OpenHarmony Time Service" -RemainAfterExit=yes +Type=notify +User=system +Group=system +SupplementaryGroups=shell +CapabilityBoundingSet=CAP_SYS_TIME CAP_WAKE_ALARM +LimitNICE=40 +ExecStart=/usr/bin/sa_main /system/profile/time_service.xml [Install] WantedBy=multi-user.target -- GitLab