我正在尝试构建一个rpm包,以正确的方式启用systemd服务。
在我的rpm spec文件中,我添加了:
%{?systemd_requires}
BuildRequires: systemd
...
%postun
%systemd_postun yeah.service
我的rpm拷贝在/ usr / lib / systemd / system / yeah.service文件中。
但是在安装包之后,该服务仍然是禁用的:
root@ansible-1:1:~# systemctl status yeah
Unit yeah.service could not be found.
root@ansible-1:1:~# rpm -Uvh /home/intersec/delivery/yeah.rpm
Preparing... ################################# [100%]
Updating / installing...
1:yeah################################# [100%]
root@ansible-1:1:~# systemctl status yeah
● yeah.service - Yeah
Loaded: loaded (/usr/lib/systemd/system/yeah.service; disabled; vendor preset: disabled)
Active: inactive (dead)
怎么了?
拉乌尔
卸载后运行%postun
脚本。我想你也应该补充一下
%post
%systemd_post yeah.service