diff options
| author | yangwei <[email protected]> | 2023-11-10 16:03:28 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2023-11-10 16:03:28 +0800 |
| commit | 2b47c81e973920245e1f21acbe0d35111e5acbe1 (patch) | |
| tree | 8b0a22a023b3b1bf2cbd498c1ef726140d6f1f28 /cmake | |
| parent | 52b7f5d5c214d5198eae9a815e68b23f5bb16012 (diff) | |
🔧 build(package for rpm): rename package name
Diffstat (limited to 'cmake')
| -rw-r--r-- | cmake/Package.cmake | 2 | ||||
| -rw-r--r-- | cmake/PreInstall.in | 22 | ||||
| -rw-r--r-- | cmake/PreUninstall.in | 7 |
3 files changed, 30 insertions, 1 deletions
diff --git a/cmake/Package.cmake b/cmake/Package.cmake index 4acc9ce..a409f72 100644 --- a/cmake/Package.cmake +++ b/cmake/Package.cmake @@ -21,8 +21,10 @@ set(CPACK_RPM_PACKAGE_RELEASE_DIST on) set(CPACK_RPM_DEBUGINFO_PACKAGE on) set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PostInstall.in) set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PostUninstall.in) +set(CPACK_RPM_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PreInstall.in) set(CPACK_RPM_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/cmake/PreUninstall.in) + # Must uninstall the debug package before install release package if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(CPACK_RPM_PACKAGE_CONFLICTS "stellar") diff --git a/cmake/PreInstall.in b/cmake/PreInstall.in new file mode 100644 index 0000000..ea89e39 --- /dev/null +++ b/cmake/PreInstall.in @@ -0,0 +1,22 @@ +DST=${RPM_INSTALL_PREFIX}/sapp/ + +mkdir -p ${DST}/plug/stellar_on_sapp +mkdir -p ${DST}/stellar_plugin/ +touch ${DST}/stellar_plugin/spec.toml +touch ${DST}/plug/conflist.inf + +if ! grep -q '^\./plug/stellar_on_sapp/start_loader.inf$' "${DST}/plug/conflist.inf"; then + if grep -q '^\[platform\]$' "${DST}/plug/conflist.inf"; then + sed -i '/^\[platform\]$/a\./plug/stellar_on_sapp/start_loader.inf' "${DST}/plug/conflist.inf" + else + echo -e "[platform]\n./plug/stellar_on_sapp/start_loader.inf" >> "${DST}/plug/conflist.inf" + fi +fi + +if ! grep -q '^\./plug/stellar_on_sapp/defer_loader.inf$' "${DST}/plug/conflist.inf"; then + if grep -q '^\[business\]$' "${DST}/plug/conflist.inf"; then + sed -i '/^\[business\]$/a\./plug/stellar_on_sapp/defer_loader.inf' "${DST}/plug/conflist.inf" + else + echo -e "[business]\n./plug/stellar_on_sapp/defer_loader.inf" >> "${DST}/plug/conflist.inf" + fi +fi
\ No newline at end of file diff --git a/cmake/PreUninstall.in b/cmake/PreUninstall.in index d601599..dc0aa5e 100644 --- a/cmake/PreUninstall.in +++ b/cmake/PreUninstall.in @@ -1 +1,6 @@ -/sbin/ldconfig
\ No newline at end of file +if [ $1 == 0 ]; then + DST=${RPM_INSTALL_PREFIX}/sapp + sed -i '/start_loader.inf/d' ${DST}/plug/conflist.inf + sed -i '/defer_loader.inf/d' ${DST}/plug/conflist.inf + rm ${DST}/stellar_plugin -rf +fi |
