clean up systemd

This commit is contained in:
Than Ngo 2020-09-04 15:00:54 +02:00
parent d590bdfb38
commit bd1bae9a41

View File

@ -1,5 +1,3 @@
%bcond_with systemd
Name: powerpc-utils
Version: 1.3.8
Release: 1%{?dist}
@ -70,7 +68,7 @@ Utilities needed when installing Fedora on PowerPC systems.
%build
export CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing"
./autogen.sh
%configure %{?_with_systemd} --disable-werror
%configure --with-systemd=%{_unitdir} --disable-werror
make %{?_smp_mflags}
@ -100,43 +98,35 @@ ln -s serv_config.8 %{buildroot}%{_mandir}/man8/uspchrp.8
rm -f $RPM_BUILD_ROOT%{_sbindir}/snap $RPM_BUILD_ROOT%{_mandir}/man8/snap.8*
%post
%if %{with systemd}
systemctl daemon-reload
systemctl start hcn-init.service
systemctl enable hcn-init.service
#systemctl start hcn-init.service
#systemctl enable hcn-init.service
# update the smt.state file with current SMT
/usr/sbin/smtstate --save
%endif
%preun
%if %{with systemd}
svc=$(systemctl list-units -la | grep -Fq smtstate.service; echo $?)
if [ "$svc" = "0" ]; then
systemctl stop smtstate.service
systemctl disable smtstate.service
fi
if systemctl is-enabled hcn-init.service |grep -q "enabled"; then
systemctl stop hcn-init.service
systemctl disable hcn-init.service
fi
%endif
#if systemctl is-enabled hcn-init.service |grep -q "enabled"; then
# systemctl stop hcn-init.service
# systemctl disable hcn-init.service
#fi
%postun
%if %{with systemd}
systemctl daemon-reload
%endif
%files
%attr(644, -, -) %doc README Changelog
%if %{with systemd}
/usr/sbin/smtstate
%doc README Changelog
%dir /var/lib/powerpc-utils
/var/lib/powerpc-utils/smt.state
/lib/systemd/system/smtstate.service
/lib/systemd/system/smt_off.service
/lib/systemd/system/hcn-init.service
/usr/share/man/man8/smtstate.8.gz
%endif
%{_unitdir}/smtstate.service
%{_unitdir}/smt_off.service
%{_unitdir}/hcn-init.service
%{_bindir}/amsstat
%{_sbindir}/activate_firmware
%{_sbindir}/bootlist
@ -169,6 +159,7 @@ systemctl daemon-reload
%{_sbindir}/hcnrmhcn
%{_sbindir}/hcnversion
%{_sbindir}/vcpustat
%{_sbindir}/smtstate
%{_mandir}/man1/amsstat.1*
%{_mandir}/man5/lparcfg.5*
@ -197,7 +188,8 @@ systemctl daemon-reload
%{_mandir}/man8/pseries_platform.8*
%{_mandir}/man8/update_flash_nv.8*
%{_mandir}/man8/uspchrp.8*
%{_mandir}/man8/vcpustat.8*
%{_mandir}/man8/vcpustat.8.gz
%{_mandir}/man8/smtstate.8.gz
%files core
%license COPYING