I'm having a very simple unit-file which comes with a service which I package to a RPM-file. This RPM-file is built and installed on Fedora 28.
My service-file could not be simpler:
[Unit]
Description=Hello Work
[Service]
ExecStart=/usr/bin/executable
[Install]
WantedBy=multi-user.target
In my spec file I added these sections:
%post
%systemd_post %{name}.service
%preun
%systemd_preun %{name}.service
%postun
%systemd_postun_with_restart %{name}.service
The service file is copied correctly via
mkdir -p %{buildroot}%{_unitdir}/
cp %{name}.service %{buildroot}%{_unitdir}/
in the %install-section.
When I install the package, the service is not started. When I run manually
systemctl enable <service-name>
it works.
Where is my mistake that the installation does not enable and start my service?