Initial commit

This commit is contained in:
root
2026-06-14 23:45:57 +08:00
commit e13621a510
48 changed files with 4304 additions and 0 deletions

47
cmake/DnfInstall.cmake Normal file
View File

@@ -0,0 +1,47 @@
#
# dnf/yum 系统包安装通用模块
#
# 函数DNF 安装系统包
# 参数PKG_NAME - 包名
function(DnfInstall PKG_NAME)
CHECK_ROOT()
DEPLOY_MSG ("Start install system package: ${PKG_NAME}")
if(ENABLE_DEBUG)
execute_process(
COMMAND dnf install -y ${PKG_NAME}
RESULT_VARIABLE DNF_RET
OUTPUT_VARIABLE DNF_OUT
ERROR_VARIABLE DNF_ERR
)
message(STATUS "[Debug] Output: ${DNF_OUT}")
message(STATUS "[Debug] Errors: ${DNF_ERR}")
else()
execute_process(
COMMAND dnf install -y ${PKG_NAME}
RESULT_VARIABLE DNF_RET
OUTPUT_VARIABLE DNF_OUT
ERROR_VARIABLE DNF_ERR
)
set(DNF_ERR "")
endif()
if(NOT DNF_RET EQUAL 0)
message(FATAL_ERROR "Install ${PKG_NAME} failed: ${DNF_ERR}")
endif()
DEPLOY_MSG ("Install ${PKG_NAME} success")
endfunction()
# 函数DNF 卸载系统包
function(DnfRemove PKG_NAME)
CHECK_ROOT()
DEPLOY_MSG ("Start remove system package: ${PKG_NAME}")
execute_process(
COMMAND dnf remove -y ${PKG_NAME}
RESULT_VARIABLE DNF_RET
)
if(NOT DNF_RET EQUAL 0)
message(WARNING "Remove ${PKG_NAME} failed")
endif()
endfunction()