Lines Matching refs:hnpInfo
185 static int HnpInstall(const char *hnpFile, HnpInstallInfo *hnpInfo, HnpCfgInfo *hnpCfg,
191 ret = HnpUnZip(hnpFile, hnpInfo->hnpVersionPath, hnpInfo->hnpSignKeyPrefix, hnpSignMapInfos, count);
197 return HnpGenerateSoftLink(hnpInfo->hnpVersionPath, hnpInfo->hnpBasePath, hnpCfg);
335 static int HnpInstallForceCheck(HnpCfgInfo *hnpCfgInfo, HnpInstallInfo *hnpInfo)
340 if (access(hnpInfo->hnpSoftwarePath, F_OK) == 0) {
341 if (hnpInfo->hapInstallInfo->isForce == false) {
342 HNP_LOGE("hnp install path[%{public}s] exist, but force is false", hnpInfo->hnpSoftwarePath);
345 if (hnpInfo->isPublic == false) {
346 if (HnpDeleteFolder(hnpInfo->hnpSoftwarePath) != 0) {
352 ret = HnpCreateFolder(hnpInfo->hnpVersionPath);
354 return HnpDeleteFolder(hnpInfo->hnpVersionPath);
359 static int HnpInstallPathGet(HnpCfgInfo *hnpCfgInfo, HnpInstallInfo *hnpInfo)
364 ret = sprintf_s(hnpInfo->hnpSoftwarePath, MAX_FILE_PATH_LEN, "%s/%s.org", hnpInfo->hnpBasePath,
372 ret = sprintf_s(hnpInfo->hnpVersionPath, MAX_FILE_PATH_LEN, "%s/%s_%s", hnpInfo->hnpSoftwarePath,
382 static int HnpPublicDealAfterInstall(HnpInstallInfo *hnpInfo, HnpCfgInfo *hnpCfg)
388 HnpUnInstallPublicHnp(hnpInfo->hapInstallInfo->hapPackageName, hnpCfg->name, version,
389 hnpInfo->hapInstallInfo->uid, true);
397 return HnpInstallInfoJsonWrite(hnpInfo->hapInstallInfo->hapPackageName, hnpCfg);
400 static int HnpReadAndInstall(char *srcFile, HnpInstallInfo *hnpInfo, HnpSignMapInfo *hnpSignMapInfos, int *count)
405 HNP_LOGI("hnp install start now! src file=%{public}s, dst path=%{public}s", srcFile, hnpInfo->hnpBasePath);
412 ret = HnpInstallPathGet(&hnpCfg, hnpInfo);
422 if (access(hnpInfo->hnpVersionPath, F_OK) == 0 && hnpInfo->isPublic) {
424 ret = HnpGenerateSoftLink(hnpInfo->hnpVersionPath, hnpInfo->hnpBasePath, &hnpCfg);
432 return HnpPublicDealAfterInstall(hnpInfo, &hnpCfg);
435 ret = HnpInstallForceCheck(&hnpCfg, hnpInfo);
445 ret = HnpInstall(srcFile, hnpInfo, &hnpCfg, hnpSignMapInfos, count);
451 HnpUnInstallPublicHnp(hnpInfo->hapInstallInfo->hapPackageName, hnpCfg.name, hnpCfg.version,
452 hnpInfo->hapInstallInfo->uid, false);
456 if (hnpInfo->isPublic) {
457 ret = HnpPublicDealAfterInstall(hnpInfo, &hnpCfg);
459 HnpUnInstallPublicHnp(hnpInfo->hapInstallInfo->hapPackageName, hnpCfg.name, hnpCfg.version,
460 hnpInfo->hapInstallInfo->uid, false);
479 static int HnpPackageGetAndInstall(const char *dirPath, HnpInstallInfo *hnpInfo, char *sunDir,
508 int ret = HnpPackageGetAndInstall(path, hnpInfo, sunDirNew, hnpSignMapInfos, count);
517 if (sprintf_s(hnpInfo->hnpSignKeyPrefix, MAX_FILE_PATH_LEN, "hnp/%s/%s%s", hnpInfo->hapInstallInfo->abi,
523 int ret = HnpReadAndInstall(path, hnpInfo, hnpSignMapInfos, count);
540 HnpInstallInfo hnpInfo = {0};
549 hnpInfo.hapInstallInfo = installInfo;
553 hnpInfo.isPublic = true;
554 if ((sprintf_s(hnpInfo.hnpBasePath, MAX_FILE_PATH_LEN, "%s/hnppublic", dstPath) < 0) ||
561 hnpInfo.isPublic = false;
562 if ((sprintf_s(hnpInfo.hnpBasePath, MAX_FILE_PATH_LEN, "%s/hnp/%s", dstPath,
573 ret = HnpPackageGetAndInstall(hnpPath, &hnpInfo, "", hnpSignMapInfos, count);