[CP] support ob rpm platform standalone systemd service

This commit is contained in:
LINxiansheng
2024-02-09 08:57:55 +00:00
committed by ob-robot
parent 64af7349c3
commit 6ccd4831c0
15 changed files with 474 additions and 1 deletions

View File

@ -44,18 +44,46 @@ set(CPACK_RPM_PACKAGE_DESCRIPTION "OceanBase is a distributed relational databas
set(CPACK_RPM_PACKAGE_LICENSE "Mulan PubL v2.")
set(CPACK_RPM_DEFAULT_USER "admin")
set(CPACK_RPM_DEFAULT_GROUP "admin")
if (OB_BUILD_OPENSOURCE)
set(DEBUG_INSTALL_POST "mv $RPM_BUILD_ROOT/../server/home/admin/oceanbase/bin/obshell %{_builddir}/obshell; %{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} %{_builddir}/%{?buildsubdir}; mv %{_builddir}/obshell $RPM_BUILD_ROOT/../server/home/admin/oceanbase/bin/obshell; %{nil}")
else()
set(DEBUG_INSTALL_POST "%{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} %{_builddir}/%{?buildsubdir};%{nil}")
endif()
set(CPACK_RPM_SPEC_MORE_DEFINE
"%global _missing_build_ids_terminate_build 0
%global _find_debuginfo_opts -g
%define __strip ${CMAKE_SOURCE_DIR}/deps/3rd/usr/local/oceanbase/devtools/bin/llvm-strip
%undefine __brp_mangle_shebangs
%global __requires_exclude ^\(/bin/bash\|/usr/bin/\.*\)$
%define __debug_install_post %{_rpmconfigdir}/find-debuginfo.sh %{?_find_debuginfo_opts} %{_builddir}/%{?buildsubdir};%{nil}
%define __debug_install_post ${DEBUG_INSTALL_POST}
%if \\\"%name\\\" != \\\"oceanbase-ce-sql-parser\\\" && \\\"%name\\\" != \\\"oceanbase-sql-parser\\\"
%debug_package
%endif
")
if (OB_BUILD_OPENSOURCE)
set(CPACK_RPM_PACKAGE_REQUIRES "jq, systemd")
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/oceanbase-service.sh.template
${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/oceanbase-service.sh
@ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_install.sh.template
${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_install.sh
@ONLY)
set(CPACK_RPM_SERVER_POST_INSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_install.sh)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/pre_uninstall.sh.template
${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/pre_uninstall.sh
@ONLY)
set(CPACK_RPM_SERVER_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/pre_uninstall.sh)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_uninstall.sh.template
${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_uninstall.sh
@ONLY)
set(CPACK_RPM_SERVER_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_CURRENT_SOURCE_DIR}/tools/rpm/systemd/profile/post_uninstall.sh)
endif()
## TIPS
#
# - PATH is relative to the **ROOT directory** of project other than the cmake directory.
@ -68,6 +96,7 @@ install(PROGRAMS
tools/import_time_zone_info.py
tools/import_srs_data.py
${CMAKE_BINARY_DIR}/src/observer/observer
deps/3rd/home/admin/oceanbase/bin/obshell
DESTINATION bin
COMPONENT server)
else()
@ -100,6 +129,17 @@ install(
DESTINATION admin
COMPONENT server)
install(FILES
tools/rpm/systemd/profile/oceanbase.cnf
tools/rpm/systemd/profile/oceanbase-pre.json
tools/rpm/systemd/profile/oceanbase.service
tools/rpm/systemd/profile/oceanbase-service.sh
tools/rpm/systemd/profile/post_install.sh
tools/rpm/systemd/profile/post_uninstall.sh
tools/rpm/systemd/profile/pre_uninstall.sh
DESTINATION profile
COMPONENT server)
## oceanbase-cdc
if (NOT OB_SO_CACHE AND OB_BUILD_CDC)
include(GNUInstallDirs)