parent
35e9c8bef2
commit
89bf5f2763
|
@ -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)
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
*Bug号:无
|
||||
|
|
|
@ -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");
|
||||
|
|
Loading…
Reference in New Issue