From b17ec1dc37a3e78574682798faf71fde1bb471f8 Mon Sep 17 00:00:00 2001 From: songyanchao Date: Mon, 1 Jul 2024 02:05:36 +0000 Subject: 🐞 fix: Correct error where rpm -u unintentionally triggers update-alternatives. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Correct error where rpm -u unintentionally triggers update-alternatives. --- .gitignore | 3 ++- cmake/PostInstall.in | 2 ++ cmake/PostUninstall.in | 4 +++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5c9ea97..81aa806 100644 --- a/.gitignore +++ b/.gitignore @@ -25,9 +25,10 @@ test/ptf_test/ptf_test /x64 /marsio1.VC.db .vscode/ +.cache/ .idea cmake-build-* cmake-build-* version.txt -Testing/ \ No newline at end of file +Testing/ diff --git a/cmake/PostInstall.in b/cmake/PostInstall.in index 4e9d5e3..eed699c 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 -eq 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..dc3bb52 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 -eq 0 ]; then + command="update-alternatives --remove mrzcpd @CMAKE_INSTALL_PREFIX@/@MR_INSTALL_BINDIR@/mrzcpd --altdir @CMAKE_INSTALL_PREFIX@/altdir" eval $command +fi -- cgit v1.2.3