diff --git a/CMakeLists.txt b/CMakeLists.txt index 5dbebef..7f7ea66 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -37,6 +37,7 @@ endif() message("Build Type: ${CMAKE_BUILD_TYPE}") 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 (EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) diff --git a/debian/changelog b/debian/changelog index 1de0a7e..43bfed5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +libkysdk-system (1.1.0kylin1b3) v101; urgency=medium + + *Bug号:无 + *需求号:无 + *其他修改: + * 新增获取操作系统ProjectName的接口 + * 新增获取当前登录有效用户用户名的接口 + * 新增获取当前宿主机虚拟环境类型的接口 + * 新增获取当前宿主机云平台类型的接口 + + -- liuyunhe Wed, 11 May 2022 19:01:54 +0800 + libkysdk-system (1.1.0kylin1) v101; urgency=medium *Bug号:无 diff --git a/src/systeminfo/libkysysinfo.c b/src/systeminfo/libkysysinfo.c index 037d984..86c02c4 100644 --- a/src/systeminfo/libkysysinfo.c +++ b/src/systeminfo/libkysysinfo.c @@ -436,10 +436,11 @@ char* kdk_system_get_hostCloudPlatform() bool res_flag = false; 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)) { fgets(buf, 255 * sizeof(char), pipeLine); + strstripspace(buf); if (strcmp(buf, "Huawei Inc.") == 0) // 华为云 { strcpy(cloudplat, "huawei"); @@ -453,6 +454,7 @@ char* kdk_system_get_hostCloudPlatform() if (__glibc_likely(pipeLine != NULL)) { fgets(buf, 255 * sizeof(char), pipeLine); + strstripspace(buf); if (strcmp(buf, "HUAWEICLOUD") == 0) // 华为云 { strcpy(cloudplat, "huawei"); @@ -463,10 +465,11 @@ char* kdk_system_get_hostCloudPlatform() } 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)) { fgets(buf, 255 * sizeof(char), fp); + strstripspace(buf); if (strcmp(buf, "Huawei Inc.") == 0) // 华为云 { strcpy(cloudplat, "huawei"); @@ -480,6 +483,7 @@ char* kdk_system_get_hostCloudPlatform() if (__glibc_likely(fp != NULL)) { fgets(buf, 255 * sizeof(char), fp); + strstripspace(buf); if (strcmp(buf, "HUAWEICLOUD") == 0) // 华为云 { strcpy(cloudplat, "huawei");