Migrate to systemd.

This commit is contained in:
Jon Ciesla 2012-04-19 13:21:57 -05:00
parent ded4c4c695
commit 63efad3e09
2 changed files with 47 additions and 9 deletions

View File

@ -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 <limburgher@gmail.com> - 1.1-7
- Migrate to systemd, BZ 789926.
* Fri Jan 13 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_17_Mass_Rebuild

10
stinit.service Normal file
View File

@ -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