2 * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include "ni_common.h"
23 #define LOG_TAG "NETCORE_INSTALLER_PLUGIN"
26 #include <pkgmgr-info.h>
27 #include <pkgmgr_installer_info.h>
30 * forked crossgen from installer is not working.
31 * because crossgen's capability is not enough.
32 * following command is needed
34 * setcap cap_dac_override=eip /opt/usr/share/dotnet.tizen/framework/crossgen
38 extern "C" int PKGMGR_PARSER_PLUGIN_POST_INSTALL(const char *pkgId)
40 _INFO("pkg : %s", pkgId);
44 if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
45 _ERR("Failed to get UID");
49 pkgmgrinfo_pkginfo_h handle;
50 int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgId, uid, &handle);
51 if (ret != PMINFO_R_OK) {
52 _ERR("Failed to get pkg info");
56 _INFO("success to get pkg info");
58 bool dotnetExist = false;
60 auto dotnetAppCounter = [] (pkgmgrinfo_appinfo_h handle, void *userData) -> int {
61 char* appId = nullptr;
63 bool* dotnet = static_cast<bool*>(userData);
65 if (pkgmgrinfo_appinfo_get_appid(handle, &appId) != PMINFO_R_OK) {
66 _ERR("Failed to get app id");
70 _INFO("App id : %s", appId);
72 if (pkgmgrinfo_appinfo_get_apptype(handle, &type) != PMINFO_R_OK) {
73 _ERR("Failed to get app type : %s", appId);
77 _INFO("App type : %s", type);
79 if (strcmp(type, "dotnet") == 0)
85 if (pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_ALL_APP, dotnetAppCounter, &dotnetExist, uid) != PMINFO_R_OK) {
86 _ERR("Failed to get list of app in pkg : %s", pkgId);
90 _INFO("Finish to get pkg list");
92 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
94 _INFO("dotnet app is exist");
95 return createNiUnderPkgRoot(pkgId) == 0 ? 0 : -1;
100 extern "C" int PKGMGR_PARSER_PLUGIN_POST_UPGRADE(const char *pkgId)
102 return PKGMGR_PARSER_PLUGIN_POST_INSTALL(pkgId);