diff --git a/recipes-openharmony/openharmony/files/installs.service b/recipes-openharmony/openharmony/files/installs.service index b47eb4f2ccb1737469db3b82e97dddf5cc3a07c3..a4d7316bf870cccd654bf9c415bf544b2b955e1b 100644 --- a/recipes-openharmony/openharmony/files/installs.service +++ b/recipes-openharmony/openharmony/files/installs.service @@ -1,10 +1,14 @@ [Unit] -Description=OpenHarmony Installs service +Description=OpenHarmony installd service (SA: 511) +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 Installs Service" -RemainAfterExit=yes +Type=notify +ExecStart=/usr/bin/installs [Install] WantedBy=multi-user.target diff --git a/recipes-openharmony/openharmony/files/openharmony-preinit b/recipes-openharmony/openharmony/files/openharmony-preinit index e9efcc9e0cef5af770d661f34a28db7e90605e15..c5725f608a12b6ee6cdf4ec1fb107ae7c14890e9 100644 --- a/recipes-openharmony/openharmony/files/openharmony-preinit +++ b/recipes-openharmony/openharmony/files/openharmony-preinit @@ -132,18 +132,6 @@ if systemctl -q is-enabled weston.service; then sleep "$STARTUP_CMD_SLEEP" fi -# trigger: late-fs -# "name" : "installs", -# "path" : ["/system/bin/installs"], -# "importance" : -20, -# "uid" : "root", -# "gid" : ["root"] -if systemctl -q is-enabled installs.service; then - echo >/dev/console "Starting OpenHarmony installs service" - /system/bin/installs & # saId 511 - sleep "$STARTUP_CMD_SLEEP" -fi - # trigger: late-fs # "name" : "appspawn", # "path" : ["/system/bin/appspawn"], diff --git a/recipes-openharmony/openharmony/files/openharmony-preinit.service b/recipes-openharmony/openharmony/files/openharmony-preinit.service index b44fe52eed1e0ad60002da0b1a30cc4dea42fca0..92004484bc6a9c233d4505e57bdd863279b7b5dd 100644 --- a/recipes-openharmony/openharmony/files/openharmony-preinit.service +++ b/recipes-openharmony/openharmony/files/openharmony-preinit.service @@ -8,6 +8,8 @@ After=hilogd.service Requires=hilogd.service After=huks.service Requires=huks.service +After=installs.service +Requires=installs.service [Service] Type=oneshot diff --git a/recipes-openharmony/openharmony/openharmony-standard-3.0/installs-sd-notify.patch b/recipes-openharmony/openharmony/openharmony-standard-3.0/installs-sd-notify.patch new file mode 100644 index 0000000000000000000000000000000000000000..44942d220b0f5bd753bf0c9011c9aa350edc3a50 --- /dev/null +++ b/recipes-openharmony/openharmony/openharmony-standard-3.0/installs-sd-notify.patch @@ -0,0 +1,50 @@ +# SPDX-FileCopyrightText: Huawei Inc. +# +# SPDX-License-Identifier: Apache-2.0 + +Patch for //foundation/appexecfwk/standard of OpenHarmony 3.0 codebase + +This adds sd_notify(3) ready notification to installd service for better +integration with systemd. + +Signed-off-by: Esben Haabendal <esben@geanix.com> +Upstream-Status: Pending + +diff --git a/services/bundlemgr/BUILD.gn b/services/bundlemgr/BUILD.gn +index 4d227c32c520..305ddd13e279 100755 +--- a/services/bundlemgr/BUILD.gn ++++ b/services/bundlemgr/BUILD.gn +@@ -200,6 +200,7 @@ ohos_executable("installs") { + "//foundation/distributedschedule/samgr/interfaces/innerkits/samgr_proxy:samgr_proxy", + "//third_party/jsoncpp:jsoncpp", + ] ++ libs = [ "systemd" ] + + external_deps = [ + "hiviewdfx_hilog_native:libhilog", +diff --git a/services/bundlemgr/src/installd/installd_main.cpp b/services/bundlemgr/src/installd/installd_main.cpp +index 7f03862f1e9d..600664463c26 100644 +--- a/services/bundlemgr/src/installd/installd_main.cpp ++++ b/services/bundlemgr/src/installd/installd_main.cpp +@@ -18,6 +18,8 @@ + #include "app_log_wrapper.h" + #include "installd/installd_service.h" + ++#include <systemd/sd-daemon.h> ++ + int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) + { + using namespace OHOS::AppExecFwk; +@@ -35,8 +37,10 @@ int main([[maybe_unused]] int argc, [[maybe_unused]] char **argv) + std::exit(EXIT_FAILURE); + } + } ++ sd_notify(0, "READY=1"); + OHOS::IPCSkeleton::JoinWorkThread(); ++ sd_notify(0, "STOPPING=1"); + service->Stop(); + APP_LOGE("installd service stopped"); + return EXIT_SUCCESS; +-} +\ No newline at end of file ++} diff --git a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb index 941419678d604b844f77ab457edeffc323a59592..ce14e3481fca5d34975e209d01e25cb28522171c 100644 --- a/recipes-openharmony/openharmony/openharmony-standard_3.0.bb +++ b/recipes-openharmony/openharmony/openharmony-standard_3.0.bb @@ -76,6 +76,7 @@ SRC_URI += "file://param_service-Add-to-startup-l2-part.patch;patchdir=${S}/base SRC_URI += "file://samgr-sd-notify.patch;patchdir=${S}/foundation/distributedschedule/samgr" SRC_URI += "file://safwk-sd-notify.patch;patchdir=${S}/foundation/distributedschedule/safwk" +SRC_URI += "file://installs-sd-notify.patch;patchdir=${S}/foundation/appexecfwk/standard" SRC_URI += "file://base_hiviewdfx_hiview-libfaultlogger-static.patch;patchdir=${S}/base/hiviewdfx/hiview" @@ -564,7 +565,7 @@ FILES:${PN}-appexecfwk = "\ ${libdir}/module/libnapi_app_mgr*${SOLIBS} \ ${libdir}/openharmony/profile/foundation.xml \ " -RDEPENDS:${PN}-appexecfwk += "musl libcxx" +RDEPENDS:${PN}-appexecfwk += "musl libcxx libsystemd" RDEPENDS:${PN}-appexecfwk += "${PN}-libutils ${PN}-hilog ${PN}-samgr ${PN}-ipc ${PN}-appverify ${PN}-distributeddatamgr ${PN}-notification-ces" RDEPENDS:${PN}-appexecfwk += "${PN}-security-permission ${PN}-appspawn ${PN}-safwk ${PN}-timeservice ${PN}-powermgr ${PN}-dmsfwk ${PN}-resmgr" RDEPENDS:${PN}-appexecfwk += "${PN}-aafwk ${PN}-ace-napi"