summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorsongyanchao <[email protected]>2024-03-20 09:47:06 +0800
committersongyanchao <[email protected]>2024-03-20 09:47:06 +0800
commit184cd89d41df6550127516e17500c1c4bf3da174 (patch)
treebb4f815676ee1a90b931c53347158c1973209c5e /cmake
parenta8ada69f7e08632c6d9db72295e0f54495628372 (diff)
🐞 fix: Correct error where rpm -u unintentionally triggers update-alternatives.
Correct error where rpm -u unintentionally triggers update-alternatives
Diffstat (limited to 'cmake')
-rw-r--r--cmake/PostInstall.in2
-rw-r--r--cmake/PostUninstall.in4
2 files changed, 5 insertions, 1 deletions
diff --git a/cmake/PostInstall.in b/cmake/PostInstall.in
index 4e9d5e3..009825f 100644
--- a/cmake/PostInstall.in
+++ b/cmake/PostInstall.in
@@ -9,6 +9,7 @@ if [ ! -d "$mrzcpd_bin_path" ]; then
mkdir -p "$mrzcpd_bin_path"
fi
+if [ $1 -gt 1 ]; then
command="update-alternatives --altdir @CMAKE_INSTALL_PREFIX@/altdir \
--install \
@MR_ALTERNATIVE_BINDIR@/mrzcpd \
@@ -88,6 +89,7 @@ command="update-alternatives --altdir @CMAKE_INSTALL_PREFIX@/altdir \
mrzcpd.service \
@CMAKE_INSTALL_PREFIX@/@MR_INSTALL_SYSTEM@/mrzcpd.service "
eval $command
+fi
%systemd_post mrenv.service mrzcpd.service mrtunnat.service mrzcpd_hwdb_setup.service mrzcpd_hugepages_setup.service
/sbin/ldconfig
diff --git a/cmake/PostUninstall.in b/cmake/PostUninstall.in
index 13f0a89..8c94d9f 100644
--- a/cmake/PostUninstall.in
+++ b/cmake/PostUninstall.in
@@ -1,5 +1,7 @@
%systemd_postun_with_restart mrenv.service mrzcpd.service mrtunnat.service
/sbin/ldconfig
-command="update-alternatives --remove mrzcpd @CMAKE_INSTALL_PREFIX@/@MR_INSTALL_BINDIR@/mrzcpd --altdir @CMAKE_INSTALL_PREFIX@/altdir"
+if [ $ 1 -gt 0 ]; then
+ command="update-alternatives --remove mrzcpd @CMAKE_INSTALL_PREFIX@/@MR_INSTALL_BINDIR@/mrzcpd --altdir @CMAKE_INSTALL_PREFIX@/altdir"
eval $command
+fi