[修复] 修复华为云平台判断错误的问题

[修复] 修复编译后动态库rpath搜索路径缺失的问题
This commit is contained in:
Debaucher 2022-05-12 14:54:12 +08:00
parent 35e9c8bef2
commit 89bf5f2763
3 changed files with 19 additions and 2 deletions

View File

@ -37,6 +37,7 @@ endif()
message("Build Type: ${CMAKE_BUILD_TYPE}") message("Build Type: ${CMAKE_BUILD_TYPE}")
set (CMAKE_INSTALL_PREFIX /usr) set (CMAKE_INSTALL_PREFIX /usr)
set (CMAKE_INSTALL_RPATH /usr/lib/kysdk/kysdk-system;/usr/lib/kysdk/kysdk-base)
set (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) set (LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib)
set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) set (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin)

12
debian/changelog vendored
View File

@ -1,3 +1,15 @@
libkysdk-system (1.1.0kylin1b3) v101; urgency=medium
*Bug号
*需求号:无
*其他修改:
* 新增获取操作系统ProjectName的接口
* 新增获取当前登录有效用户用户名的接口
* 新增获取当前宿主机虚拟环境类型的接口
* 新增获取当前宿主机云平台类型的接口
-- liuyunhe <liuyunhe@kylinos.cn> Wed, 11 May 2022 19:01:54 +0800
libkysdk-system (1.1.0kylin1) v101; urgency=medium libkysdk-system (1.1.0kylin1) v101; urgency=medium
*Bug号 *Bug号

View File

@ -436,10 +436,11 @@ char* kdk_system_get_hostCloudPlatform()
bool res_flag = false; bool res_flag = false;
if (geteuid() == 0) // root 用户可以用dmidecode if (geteuid() == 0) // root 用户可以用dmidecode
{ {
FILE *pipeLine = popen("dmidecode -s system-manufacturer", "r"); FILE *pipeLine = popen("dmidecode -s chassis-manufacturer", "r");
if (__glibc_likely(pipeLine != NULL)) if (__glibc_likely(pipeLine != NULL))
{ {
fgets(buf, 255 * sizeof(char), pipeLine); fgets(buf, 255 * sizeof(char), pipeLine);
strstripspace(buf);
if (strcmp(buf, "Huawei Inc.") == 0) // 华为云 if (strcmp(buf, "Huawei Inc.") == 0) // 华为云
{ {
strcpy(cloudplat, "huawei"); strcpy(cloudplat, "huawei");
@ -453,6 +454,7 @@ char* kdk_system_get_hostCloudPlatform()
if (__glibc_likely(pipeLine != NULL)) if (__glibc_likely(pipeLine != NULL))
{ {
fgets(buf, 255 * sizeof(char), pipeLine); fgets(buf, 255 * sizeof(char), pipeLine);
strstripspace(buf);
if (strcmp(buf, "HUAWEICLOUD") == 0) // 华为云 if (strcmp(buf, "HUAWEICLOUD") == 0) // 华为云
{ {
strcpy(cloudplat, "huawei"); strcpy(cloudplat, "huawei");
@ -463,10 +465,11 @@ char* kdk_system_get_hostCloudPlatform()
} }
else // 普通用户,只能读取文件 else // 普通用户,只能读取文件
{ {
FILE *fp = fopen("/sys/devices/virtual/dmi/id/sys_vendor", "rt"); FILE *fp = fopen("/sys/devices/virtual/dmi/id/chassis_vendor", "rt");
if (__glibc_likely(fp != NULL)) if (__glibc_likely(fp != NULL))
{ {
fgets(buf, 255 * sizeof(char), fp); fgets(buf, 255 * sizeof(char), fp);
strstripspace(buf);
if (strcmp(buf, "Huawei Inc.") == 0) // 华为云 if (strcmp(buf, "Huawei Inc.") == 0) // 华为云
{ {
strcpy(cloudplat, "huawei"); strcpy(cloudplat, "huawei");
@ -480,6 +483,7 @@ char* kdk_system_get_hostCloudPlatform()
if (__glibc_likely(fp != NULL)) if (__glibc_likely(fp != NULL))
{ {
fgets(buf, 255 * sizeof(char), fp); fgets(buf, 255 * sizeof(char), fp);
strstripspace(buf);
if (strcmp(buf, "HUAWEICLOUD") == 0) // 华为云 if (strcmp(buf, "HUAWEICLOUD") == 0) // 华为云
{ {
strcpy(cloudplat, "huawei"); strcpy(cloudplat, "huawei");