diff --git a/mt-st.spec b/mt-st.spec index e713ca4..2e2e02f 100644 --- a/mt-st.spec +++ b/mt-st.spec @@ -1,20 +1,23 @@ Summary: Tool for controlling tape drives Name: mt-st Version: 1.1 -Release: 6%{?dist} +Release: 7%{?dist} License: GPL+ Group: Applications/System URL: ftp://ftp.ibiblio.org/pub/linux/system/backup Source0: ftp://metalab.unc.edu/pub/Linux/system/backup/mt-st-%{version}.tar.gz -Source1: stinit.init +Source1: stinit.service Patch0: mt-st-1.1-redhat.patch Patch1: mt-st-1.1-SDLT.patch Patch2: mt-st-0.7-config-files.patch Patch3: mt-st-0.9b-manfix.patch Patch4: mt-st-1.1-mtio.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) -Requires(post): chkconfig -Requires(preun): chkconfig +Requires(post): systemd-units +Requires(preun): systemd-units +Requires(postun): systemd-units +# For triggerun +Requires(post): systemd-sysv %description The mt-st package contains the mt and st tape drive management @@ -46,7 +49,7 @@ make CFLAGS="$RPM_OPT_FLAGS" %install rm -rf $RPM_BUILD_ROOT make install mandir=%{_mandir} -install -D -p -m 0755 %{SOURCE1} $RPM_BUILD_ROOT%{_initddir}/stinit +install -D -p -m 0644 %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/stinit.service %clean @@ -54,13 +57,35 @@ rm -rf $RPM_BUILD_ROOT %post -/sbin/chkconfig --add stinit +if [ $1 -eq 1 ] ; then + # Initial installation + /bin/systemctl daemon-reload >/dev/null 2>&1 || : +fi %preun -if [ $1 -eq 0 ]; then - /sbin/chkconfig --del stinit +if [ $1 -eq 0 ] ; then + # Package removal, not upgrade + /bin/systemctl --no-reload disable stinit.service > /dev/null 2>&1 || : + /bin/systemctl stop stinit.service > /dev/null 2>&1 || : fi +%postun +/bin/systemctl daemon-reload >/dev/null 2>&1 || : +if [ $1 -ge 1 ] ; then + # Package upgrade, not uninstall + /bin/systemctl try-restart stinit.service >/dev/null 2>&1 || : +fi + +%triggerun -- mt-st < 1.1-7 +# Save the current service runlevel info +# User must manually run systemd-sysv-convert --apply stinit +# to migrate them to systemd targets +/usr/bin/systemd-sysv-convert --save stinit >/dev/null 2>&1 ||: + +# Run these because the SysV package being removed won't do them +/sbin/chkconfig --del stinit >/dev/null 2>&1 || : +/bin/systemctl try-restart stinit.service >/dev/null 2>&1 || : + %files %defattr(-,root,root,-) @@ -68,10 +93,13 @@ fi /bin/mt /sbin/stinit %{_mandir}/man[18]/* -%{_initddir}/stinit +%{_unitdir}/stinit.service %changelog +* Thu Apr 19 2012 Jon Ciesla - 1.1-7 +- Migrate to systemd, BZ 789926. + * Fri Jan 13 2012 Fedora Release Engineering - 1.1-6 - Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild diff --git a/stinit.service b/stinit.service new file mode 100644 index 0000000..2e95078 --- /dev/null +++ b/stinit.service @@ -0,0 +1,10 @@ +[Unit] +Description=Initialize SCSI Tape Drives + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=/sbin/stinit -f /etc/stinit.def + +[Install] +WantedBy=multi-user.target