2 * Copyright (c) 2019 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.
18 #include "ni_common.h"
20 #include "db_manager.h"
26 #include <boost/filesystem.hpp>
28 #include <json/json.h>
29 #include <pkgmgr-info.h>
30 #include <pkgmgr_installer_info.h>
31 #include <openssl/sha.h>
36 #define LOG_TAG "DOTNET_INSTALLER_PLUGIN"
39 #define __STR(x) __XSTR(x)
40 static const char* __TAC_DIR = __STR(TAC_DIR);
44 typedef struct Metadata {
49 std::vector<std::string> nugetPackagesAssembliesSha;
50 std::vector<std::string> tacDB;
51 std::vector<std::string> createDirectories;
52 std::vector<std::string> updateTac;
53 std::string status = "";
57 bool isCreateDirectory = false;
58 static sqlite3 *tac_db = NULL;
60 bool metadataCheck(GList *list)
63 Metadata *mdInfo = NULL;
64 tag = g_list_first(list);
65 mdInfo = (Metadata*)tag->data;
66 if (strcmp(mdInfo->key, TAC_METADATA_KEY) == 0 && strcmp(mdInfo->value, METADATA_VALUE) == 0) {
67 _DBG("Prefer nuget cache set TRUE");
68 NiCommonOption option = {std::string(), std::string(), std::string()};
69 if (initNICommon(&option) < 0) {
70 _ERR("Fail to initialize NI Common");
78 bool appTypeCheck(std::string pkgId)
81 if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
82 _ERR("Failed to get UID");
86 pkgmgrinfo_pkginfo_h handle;
87 int ret = pkgmgrinfo_pkginfo_get_usr_pkginfo(pkgId.c_str(), uid, &handle);
88 if (ret != PMINFO_R_OK) {
89 _ERR("Failed to get pkg info");
93 bool isDotnetAppType = false;
94 auto dotnetAppCounter = [] (pkgmgrinfo_appinfo_h handle, void *userData) -> int {
96 bool* dotnet = static_cast<bool*>(userData);
97 if (pkgmgrinfo_appinfo_get_apptype(handle, &type) != PMINFO_R_OK) {
98 _ERR("Failed to get app type : %s", type);
101 if (strcmp(type, "dotnet") == 0) {
107 if (pkgmgrinfo_appinfo_get_usr_list(handle, PMINFO_ALL_APP, dotnetAppCounter, &isDotnetAppType, uid) != PMINFO_R_OK) {
108 _ERR("Failed to get list of app in pkg : %s", pkgId.c_str());
109 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
113 pkgmgrinfo_pkginfo_destroy_pkginfo(handle);
114 return isDotnetAppType;
117 void SHA256(std::string path, char outputBuffer[65])
119 FILE *file = fopen(path.c_str(), "rb");
124 unsigned char hash[SHA256_DIGEST_LENGTH];
126 SHA256_Init(&sha256);
128 const int bufSize = 32768;
129 char *buffer = (char*)malloc(bufSize);
135 while ((bytesRead = fread(buffer, 1, bufSize, file))) {
136 SHA256_Update(&sha256, buffer, bytesRead);
138 SHA256_Final(hash, &sha256);
139 for (int i = 0; i < SHA256_DIGEST_LENGTH; i++) {
140 sprintf(outputBuffer + (i * 2), "%02x", hash[i]);
142 outputBuffer[64] = 0;
150 std::string deps_json_name = execName.substr(0, execName.rfind(".dll")) + ".deps.json";
151 std::string deps_json_path = concatPath(rootPath, deps_json_name);
152 if (bf::exists(deps_json_path)) {
153 std::ifstream ifs(deps_json_path);
154 Json::CharReaderBuilder reader;
158 if (!Json::parseFromStream(reader, ifs, &root, &error)) {
159 _ERR("Failed to parse of deps.json");
163 const Json::Value runtimeTargetName = root["runtimeTarget"]["name"];
164 const Json::Value nugetPackages = root["targets"][runtimeTargetName.asString().c_str()];
165 for (auto& nuget : nugetPackages.getMemberNames()) {
166 if (strstr(nuget.c_str(), TIZEN_DOTNET_NUGET) != NULL ||
167 strstr(nuget.c_str(), TIZEN_DOTNET_SDK_NUGET) != NULL ||
168 strstr(nuget.c_str(), (execName.substr(0, execName.find(".Tizen."))).c_str()) != NULL ||
169 strstr(nuget.c_str(), (execName.substr(0, execName.find(".dll"))).c_str()) != NULL) {
172 const Json::Value assemblies = nugetPackages[nuget.c_str()]["runtime"];
173 if (assemblies != Json::nullValue) {
174 const Json::Value dependencies = nugetPackages[nuget.c_str()]["dependencies"];
175 bool isDependency = false;
176 for (auto& dependency : dependencies.getMemberNames()) {
177 if (strstr(dependency.c_str(), TIZEN_DOTNET_NUGET) != NULL ||
178 strstr(dependency.c_str(), NET_STANDARD_LIBRARY_NUGET) != NULL) {
185 tacDB.push_back(nuget);
186 _INFO("Nuget package : %s", nuget.c_str());
187 for (auto& assembly : assemblies.getMemberNames()) {
188 std::string assembly_name = assembly.substr(assembly.rfind('/') + 1);
189 char buffer[65] = {0};
190 SHA256(concatPath(binPath, assembly_name), buffer);
191 nugetPackagesAssembliesSha.push_back(nuget + "/" + assembly_name + "/" + buffer);
192 _INFO("Assembly / SHA256 : %s / %s", assembly_name.c_str(), buffer);
204 int createSymlink(std::string tac_version_dir, std::string np)
207 std::string tac_dir = concatPath(binPath, TAC_SYMLINK_SUB_DIR);
208 if (!createDir(tac_dir)) {
209 _INFO("Cannot create directory: %s", tac_dir.c_str());
213 for (auto& npAssemblySha : nugetPackagesAssembliesSha) {
214 std::string nuget_package_assembly = npAssemblySha.substr(0, npAssemblySha.rfind('/'));
215 std::string nuget_package = nuget_package_assembly.substr(0, nuget_package_assembly.rfind('/'));
216 std::string assembly = nuget_package_assembly.substr(nuget_package_assembly.rfind('/') + 1);
217 if (!strcmp(nuget_package.c_str(), np.c_str())) {
218 if (bf::exists(concatPath(binPath, assembly))) {
219 if (isCreateDirectory) {
220 if (!copyFile(concatPath(binPath, assembly), concatPath(tac_version_dir, assembly))) {
221 _ERR("Failed to copy of %s", assembly.c_str());
225 if (pkgmgr_installer_info_get_target_uid(&uid) < 0) {
226 _ERR("Failed to get UID");
229 bf::create_symlink(concatPath(tac_version_dir, assembly), concatPath(tac_dir, assembly));
230 if (lchown(concatPath(tac_dir, assembly).c_str(), uid, 0)) {
231 _ERR("Failed to change owner of: %s", concatPath(tac_dir, assembly).c_str());
234 if (!removeFile(concatPath(binPath, assembly))) {
235 _ERR("Failed to remove of %s", assembly.c_str());
244 extern "C" int PKGMGR_MDPARSER_PLUGIN_INSTALL(const char *pkgId, const char *appId, GList *list)
246 _DBG("[===== PKGMGR_MDPARSER_PLUGIN_INSTALL =====]");
247 _INFO("PackageID : %s", pkgId);
249 if (!appTypeCheck(std::string(pkgId))) {
250 _INFO("App type is not dotnet");
253 if (getExecName(std::string(pkgId), execName) < 0) {
256 if (getRootPath(std::string(pkgId), rootPath) < 0) {
259 binPath = concatPath(rootPath, "bin");
261 if (metadataCheck(list)) {
262 if (depsJsonParser() < 0) {
268 tac_db = dbCreate(TAC_APP_LIST_DB);
270 if (!dbOpen(tac_db, TAC_APP_LIST_DB)) {
271 _ERR("Sqlite open error");
275 _ERR("Sqlite create error");
280 _ERR("Not exist .deps.json file");
284 for (auto& np : tacDB) {
285 std::string tac_name = np.substr(0, np.find('/'));
286 std::string tac_version = np.substr(np.rfind('/') + 1);
287 _INFO("TAC name : %s", tac_name.c_str());
288 _INFO("TAC version : %s", tac_version.c_str());
290 std::string tac_version_dir = concatPath(__TAC_DIR, np);
291 std::string sha256_info = concatPath(tac_version_dir, TAC_SHA_256_INFO);
292 isCreateDirectory = false;
293 if (!bf::exists(tac_version_dir)) {
294 _INFO("Create tac_version_dir [%s]", tac_version_dir.c_str());
295 if (!createDir(tac_version_dir)) {
296 _ERR("Cannot create directory: %s", tac_version_dir.c_str());
299 isCreateDirectory = true;
300 createDirectories.push_back(tac_version_dir);
301 std::ofstream ofs(sha256_info, std::ios::app);
302 int assembly_count = 0;
303 for (auto& npAssemblySha : nugetPackagesAssembliesSha) {
304 std::string nuget_package_assembly = npAssemblySha.substr(0, npAssemblySha.rfind('/'));
305 std::string nuget_package = nuget_package_assembly.substr(0, nuget_package_assembly.rfind('/'));
306 std::string assembly = nuget_package_assembly.substr(nuget_package_assembly.rfind('/') + 1);
307 std::string sha = npAssemblySha.substr(npAssemblySha.rfind('/') + 1);
308 if (!strcmp(nuget_package.c_str(), np.c_str())) {
309 ofs << assembly << ";" << sha << std::endl;
313 ofs << assembly_count << std::endl;
316 if (createSymlink(tac_version_dir, np) < 0) {
317 _ERR("Failed to create symlink");
320 std::string sql = "INSERT INTO TAC (PKGID, NUGET, NAME, VERSION) " \
321 "VALUES ('" + std::string(pkgId) + "', '" + np + "', '" + tac_name + "', '" + tac_version + "');";
322 dbInsert(tac_db, TAC_APP_LIST_DB, sql);
324 _INFO("Exists tac_version_dir [%s]", tac_version_dir.c_str());
325 int compare_count = 0;
326 int assembly_count = 0;
327 std::string sha256_count = "0";
328 for (auto& npAssemblySha : nugetPackagesAssembliesSha) {
329 std::string nuget_package_assembly = npAssemblySha.substr(0, npAssemblySha.rfind('/'));
330 std::string nuget_package = nuget_package_assembly.substr(0, nuget_package_assembly.rfind('/'));
331 std::string assembly = nuget_package_assembly.substr(nuget_package_assembly.rfind('/') + 1);
332 std::string sha = npAssemblySha.substr(npAssemblySha.rfind('/') + 1);
333 if (!strcmp(nuget_package.c_str(), np.c_str())) {
335 std::ifstream ifs(sha256_info);
338 while (getline(ifs, get_str)) {
339 if (!strcmp(get_str.c_str(), (assembly + ";" + sha).c_str())) {
342 sha256_count = get_str;
348 if (!strcmp(std::to_string(assembly_count).c_str(), std::to_string(compare_count).c_str()) &&
349 !strcmp(std::to_string(assembly_count).c_str(), sha256_count.c_str())) {
350 _INFO("Same nuget : %s", tac_name.c_str());
351 if (createSymlink(tac_version_dir, np) < 0) {
352 _ERR("Failed to create symlink");
355 std::string sql = "INSERT INTO TAC (PKGID, NUGET, NAME, VERSION) " \
356 "VALUES ('" + std::string(pkgId) + "', '" + np + "', '" + tac_name + "', '" + tac_version + "');";
357 dbInsert(tac_db, TAC_APP_LIST_DB, sql);
359 _INFO("Different nuget : %s", tac_name.c_str());
362 if (!bf::exists(sha256_info)) {
363 if(!removeAll(tac_version_dir)) {
364 _ERR("Failed to remove of %s", tac_version_dir.c_str());
371 static int sqliteCb(void *count, int argc, char **argv, char **colName) {
372 int *c = (int*)count;
377 int updateTacDB(const char *pkgId)
379 for (auto& unp : updateTac) {
382 if (!dbOpen(tac_db, TAC_APP_LIST_DB)) {
383 _ERR("Sqlite open error");
387 _ERR("Sqlite create error");
390 std::string sql = "SELECT COUNT(NUGET) FROM TAC WHERE NUGET = '" + unp + "';";
391 int ret = sqlite3_exec(tac_db, sql.c_str(), sqliteCb, &count, NULL);
392 if (ret != SQLITE_OK) {
393 _ERR("Sqlite select error");
397 std::string tac_version_dir_prev = concatPath(__TAC_DIR, unp);
398 std::string tac_version_dir_backup = tac_version_dir_prev + ".bck";
399 if (!copyDir(tac_version_dir_prev, tac_version_dir_backup)) {
400 _ERR("Failed to copy of %s to %s", tac_version_dir_prev.c_str(), tac_version_dir_backup.c_str());
403 if (!removeAll(tac_version_dir_prev)) {
404 _ERR("Failed to remove of %s", tac_version_dir_prev.c_str());
412 extern "C" int PKGMGR_MDPARSER_PLUGIN_UPGRADE(const char *pkgId, const char *appId, GList *list)
414 _DBG("[===== PKGMGR_MDPARSER_PLUGIN_UPGRADE =====]");
415 _INFO("PackageID : %s", pkgId);
417 if (!appTypeCheck(std::string(pkgId))) {
418 _INFO("App type is not dotnet");
421 if (getExecName(std::string(pkgId), execName) < 0) {
424 if (getRootPath(std::string(pkgId), rootPath) < 0) {
427 binPath = concatPath(rootPath, "bin");
429 if (!strcmp("removed", status.c_str())) {
430 _INFO("Skipped to parse of deps.json");
432 if (metadataCheck(list)) {
433 if (depsJsonParser() < 0) {
440 tac_db = dbCreate(TAC_APP_LIST_DB);
442 if (!dbOpen(tac_db, TAC_APP_LIST_DB)) {
443 _ERR("Sqlite open error");
447 _ERR("Sqlite create error");
451 std::string sql = "SELECT * FROM TAC WHERE PKGID = '" + std::string(pkgId) + "';";
452 updateTac = dbSelect(tac_db, TAC_APP_LIST_DB, sql);
455 sql = "DELETE FROM TAC WHERE PKGID = '" + std::string(pkgId) + "';";
456 dbDelete(tac_db, TAC_APP_LIST_DB, sql);
457 if (updateTacDB(pkgId) < 0) {
461 for (auto& np : tacDB) {
462 std::string tac_name = np.substr(0, np.find('/'));
463 std::string tac_version = np.substr(np.rfind('/') + 1);
464 _INFO("TAC name : %s", tac_name.c_str());
465 _INFO("TAC version : %s", tac_version.c_str());
467 std::string tac_version_dir = concatPath(__TAC_DIR, np);
468 std::string sha256_info = concatPath(tac_version_dir, TAC_SHA_256_INFO);
469 isCreateDirectory = false;
470 if (!bf::exists(tac_version_dir)) {
471 _INFO("Create tac_version_dir [%s]", tac_version_dir.c_str());
472 if (!createDir(tac_version_dir)) {
473 _ERR("Cannot create directory: %s", tac_version_dir.c_str());
476 isCreateDirectory = true;
477 createDirectories.push_back(tac_version_dir);
478 std::ofstream ofs2(sha256_info, std::ios::app);
479 int assembly_count = 0;
480 for (auto& npAssemblySha : nugetPackagesAssembliesSha) {
481 std::string nuget_package_assembly = npAssemblySha.substr(0, npAssemblySha.rfind('/'));
482 std::string nuget_package = nuget_package_assembly.substr(0, nuget_package_assembly.rfind('/'));
483 std::string assembly = nuget_package_assembly.substr(nuget_package_assembly.rfind('/') + 1);
484 std::string sha = npAssemblySha.substr(npAssemblySha.rfind('/') + 1);
485 if (!strcmp(nuget_package.c_str(), np.c_str())) {
486 ofs2 << assembly << ";" << sha << std::endl;
490 ofs2 << assembly_count << std::endl;
492 if (createSymlink(tac_version_dir, np) < 0) {
493 _ERR("Failed to create symlink");
498 sql = "SELECT COUNT(NUGET) FROM TAC WHERE PKGID = '" + std::string(pkgId) + "' AND NAME = '" + tac_name + "';";
499 int ret = sqlite3_exec(tac_db, sql.c_str(), sqliteCb, &count, NULL);
500 if (ret != SQLITE_OK) {
501 _ERR("Sqlite select error");
505 sql = "UPDATE TAC SET NAME = '" + tac_name + "', VERSION = '" + tac_version + "', NUGET = '" + np + "' WHERE PKGID = '" + std::string(pkgId) + "' AND NAME = '" + tac_name + "';";
506 dbUpdate(tac_db, TAC_APP_LIST_DB, sql);
507 } else if (count == 0) {
508 sql = "INSERT INTO TAC (PKGID, NUGET, NAME, VERSION) " \
509 "VALUES ('" + std::string(pkgId) + "', '" + np + "', '" + tac_name + "', '" + tac_version + "');";
510 dbInsert(tac_db, TAC_APP_LIST_DB, sql);
513 _INFO("Exists tac_version_dir [%s]", tac_version_dir.c_str());
514 int compare_count = 0;
515 int assembly_count = 0;
516 std::string sha256_count = "0";
517 for (auto& npAssemblySha : nugetPackagesAssembliesSha) {
518 std::string nuget_package_assembly = npAssemblySha.substr(0, npAssemblySha.rfind('/'));
519 std::string nuget_package = nuget_package_assembly.substr(0, nuget_package_assembly.rfind('/'));
520 std::string assembly = nuget_package_assembly.substr(nuget_package_assembly.rfind('/') + 1);
521 std::string sha = npAssemblySha.substr(npAssemblySha.rfind('/') + 1);
522 if (!strcmp(nuget_package.c_str(), np.c_str())) {
524 std::ifstream ifs2(sha256_info);
526 if (ifs2.is_open()) {
527 while (getline(ifs2, get_str)) {
528 if (!strcmp(get_str.c_str(), (assembly + ";" + sha).c_str())) {
531 sha256_count = get_str;
538 if (!strcmp(std::to_string(assembly_count).c_str(), std::to_string(compare_count).c_str()) &&
539 !strcmp(std::to_string(assembly_count).c_str(), sha256_count.c_str())) {
540 _INFO("Same nuget : %s", tac_name.c_str());
541 if (createSymlink(tac_version_dir, np) < 0) {
542 _ERR("Failed to create symlink");
547 std::string sql = "SELECT COUNT(NUGET) FROM TAC WHERE PKGID = '" + std::string(pkgId) + "' AND NAME = '" + tac_name + "';";
548 int ret = sqlite3_exec(tac_db, sql.c_str(), sqliteCb, &count, NULL);
549 if (ret != SQLITE_OK) {
550 _ERR("Sqlite select error");
554 sql = "UPDATE TAC SET NAME = '" + tac_name + "', VERSION = '" + tac_version + "', NUGET = '" + np + "' WHERE PKGID = '" + std::string(pkgId) + "' AND NAME = '" + tac_name + "';";
555 dbUpdate(tac_db, TAC_APP_LIST_DB, sql);
556 } else if (count == 0) {
557 sql = "INSERT INTO TAC (PKGID, NUGET, NAME, VERSION) " \
558 "VALUES ('" + std::string(pkgId) + "', '" + np + "', '" + tac_name + "', '" + tac_version + "');";
559 dbInsert(tac_db, TAC_APP_LIST_DB, sql);
562 _INFO("Different nuget : %s", tac_name.c_str());
565 if (!bf::exists(sha256_info)) {
566 if(!removeAll(tac_version_dir)) {
567 _ERR("Failed to remove of %s", tac_version_dir.c_str());
571 for (auto& unp : updateTac) {
572 bool isExits = false;
573 for (auto& np : tacDB) {
574 if (!strcmp(unp.c_str(), np.c_str())) {
581 std::string sql = "DELETE FROM TAC WHERE PKGID = '" + std::string(pkgId) + "' AND NUGET = '" + unp + "';";
582 dbDelete(tac_db, TAC_APP_LIST_DB, sql);
585 if (updateTacDB(pkgId) < 0) {
592 extern "C" int PKGMGR_MDPARSER_PLUGIN_UNINSTALL(const char *pkgId, const char *appId, GList *list)
594 _DBG("[===== PKGMGR_MDPARSER_PLUGIN_UNINSTALL =====]");
595 _INFO("PackageID : %s", pkgId);
597 status = "uninstall";
598 tac_db = dbCreate(TAC_APP_LIST_DB);
600 if (!dbOpen(tac_db, TAC_APP_LIST_DB)) {
601 _ERR("Sqlite open error");
605 _ERR("Sqlite create error");
609 std::string sql = "SELECT * FROM TAC WHERE PKGID = '" + std::string(pkgId) + "';";
610 updateTac = dbSelect(tac_db, TAC_APP_LIST_DB, sql);
612 sql = "DELETE FROM TAC WHERE PKGID = '" + std::string(pkgId) + "';";
613 dbDelete(tac_db, TAC_APP_LIST_DB, sql);
615 if (updateTacDB(pkgId) < 0) {
621 extern "C" int PKGMGR_MDPARSER_PLUGIN_REMOVED(const char *pkgId, const char *appId, GList *list)
623 _DBG("[===== PKGMGR_MDPARSER_PLUGIN_REMOVED =====]");
624 _INFO("PackageID : %s", pkgId);
628 return PKGMGR_MDPARSER_PLUGIN_UPGRADE(pkgId, appId, list);
631 void cleanStep(std::string tac)
633 std::string current_tac = concatPath(__TAC_DIR, tac.substr(0, tac.find('/')));
634 for (auto& bck : bf::recursive_directory_iterator(current_tac)) {
635 if (bf::is_directory(bck.path()) && strstr(bck.path().c_str(), ".bck") != NULL) {
636 if (!removeAll(bck.path().string())) {
637 _ERR("Failed to remove of %s", bck.path().c_str());
643 bool isExist = false;
644 for (auto& bck : bf::recursive_directory_iterator(current_tac)) {
645 if (bf::exists(bck.path()) && bf::is_directory(bck.path()) && strstr(bck.path().c_str(), ".bck") == NULL) {
651 if (!removeAll(current_tac)) {
652 _ERR("Failed to remove of %s", current_tac.c_str());
662 void unInstall_Clean()
664 for (auto& unp : updateTac) {
671 if (!tacDB.empty()) {
672 for (auto& np : tacDB) {
679 extern "C" int PKGMGR_MDPARSER_PLUGIN_CLEAN(const char *pkgId, const char *appId, GList *list)
681 _DBG("[===== PKGMGR_MDPARSER_PLUGIN_CLEAN =====]");
682 _INFO("PackageID : %s", pkgId);
688 if (!strcmp("install", status.c_str())) {
690 } else if (!strcmp("update", status.c_str())) {
692 } else if (!strcmp("uninstall", status.c_str())) {
698 void undoStep(std::string tac)
700 std::string current_tac = concatPath(__TAC_DIR, tac.substr(0, tac.find('/')));
701 for (auto& bck : bf::recursive_directory_iterator(current_tac)) {
702 if (bf::is_directory(bck.path()) && strstr(bck.path().c_str(), ".bck") != NULL) {
703 if (!moveFile(bck.path(), bck.path().string().substr(0, bck.path().string().rfind(".bck")))) {
704 _ERR("Failed to move %s to %s",
705 bck.path().c_str(), bck.path().string().substr(0, bck.path().string().rfind(".bck")).c_str());
714 for (auto& cd : createDirectories) {
715 if (!removeAll(cd)) {
716 _ERR("Failed to remove of %s", cd.c_str());
721 void unInstall_Undo()
723 for (auto& unp : updateTac) {
731 if (!tacDB.empty()) {
732 for (auto& np : tacDB) {
739 extern "C" int PKGMGR_MDPARSER_PLUGIN_UNDO(const char *pkgId, const char *appId, GList *list)
741 _DBG("[===== PKGMGR_MDPARSER_PLUGIN_UNDO =====]");
742 _INFO("PackageID : %s", pkgId);
748 if (!strcmp("install", status.c_str())) {
750 } else if (!strcmp("update", status.c_str())) {
752 } else if (!strcmp("uninstall", status.c_str())) {