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