summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCoprDistGit <infra@openeuler.org>2025-09-18 08:14:53 +0000
committerCoprDistGit <infra@openeuler.org>2025-09-18 08:14:53 +0000
commit397d1d8f401a75c0447266f624e258e317817532 (patch)
tree6c1db9e078b4819de6a6628211bb8b73282b5a23
parent081d6aef81c7b3133880226bc7af0631dfca4d3c (diff)
automatic import of aops-mcpopeneuler24.03_LTS_SP1
-rw-r--r--aops-mcp.spec15
1 files changed, 12 insertions, 3 deletions
diff --git a/aops-mcp.spec b/aops-mcp.spec
index 6e88197..6e67cb0 100644
--- a/aops-mcp.spec
+++ b/aops-mcp.spec
@@ -54,15 +54,24 @@ ln -s /opt/%{name}/venv/bin/aops-mcp %{buildroot}%{_bindir}/aops-mcp
%post
# systemd 配置
-%systemd_post aops-mcp.service
+if [ $1 -eq 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
+ # Initial installation
+ /usr/lib/systemd/systemd-update-helper install-system-units aops-mcp.service || :
+fi
%preun
# 卸载前停止服务
-%systemd_preun aops-mcp.service
+if [ $1 -eq 0 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
+ # Package removal, not upgrade
+ /usr/lib/systemd/systemd-update-helper remove-system-units aops-mcp.service || :
+fi
%postun
# 清理配置
-%systemd_postun_with_restart aops-mcp.service
+if [ $1 -ge 1 ] && [ -x "/usr/lib/systemd/systemd-update-helper" ]; then
+ # Package upgrade, not uninstall
+ /usr/bin/systemctl try-restart aops-mcp.service || :
+fi
%files
%dir /opt/%{name}