[scsi-target-utils] update to 1.0.22-2

Andy Grover grover at fedoraproject.org
Fri Dec 16 02:29:59 UTC 2011


commit ae144d8b7a0a155f690b8261ce161292e6551aaf
Author: Andy Grover <agrover at redhat.com>
Date:   Thu Dec 15 18:29:52 2011 -0800

    update to 1.0.22-2
    
    Signed-off-by: Andy Grover <agrover at redhat.com>

 scsi-target-utils.spec |   43 ++++++++++++++++++++++++-------------------
 sysconfig.tgtd         |    5 ++++-
 tgtd.service           |   31 +++++++++++++++++++++++++++++++
 3 files changed, 59 insertions(+), 20 deletions(-)
---
diff --git a/scsi-target-utils.spec b/scsi-target-utils.spec
index 6de1238..86d346d 100644
--- a/scsi-target-utils.spec
+++ b/scsi-target-utils.spec
@@ -1,13 +1,13 @@
 Name:           scsi-target-utils
 Version:        1.0.22
-Release:        1%{?dist}
+Release:        2%{?dist}
 Summary:        The SCSI target daemon and utility programs
 
 Group:          System Environment/Daemons
 License:        GPLv2
 URL:            http://stgt.sourceforge.net/
 Source0:        https://github.com/fujita/tgt/tarball/v%{version}
-Source1:        tgtd.init
+Source1:        tgtd.service
 Source2:        sysconfig.tgtd
 Source3:        targets.conf
 Patch0:         scsi-target-utils-redhatify-docs.patch
@@ -16,19 +16,18 @@ Patch2:         scsi-target-utils-dynamic-link-iser.patch
 
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 
-BuildRequires:  pkgconfig libxslt docbook-style-xsl
+BuildRequires:  pkgconfig libxslt docbook-style-xsl systemd-units
 %ifnarch s390 s390x
 BuildRequires:  libibverbs-devel librdmacm-devel
 %endif
-Requires(post): chkconfig
-Requires(preun): chkconfig
-Requires(preun): initscripts
 Requires: lsof sg3_utils
+Requires(post): systemd-units
 
 %description
 The SCSI target package contains the daemon and tools to setup a SCSI targets.
 Currently, software iSCSI targets are supported.
 
+%ifnarch s390 s390x
 %package iser
 Summary:        iSER (RDMA) support for SCSI Target
 Group:          System Environment/Daemons
@@ -39,7 +38,7 @@ Requires:       %{name}%{?_isa} = %{version}-%{release}
 
 The SCSI target iser package adds support for ISCSI
 Extensions for RDMA (ISER) to scsi-target-utils.
-
+%endif
 
 %prep
 %setup -q -n fujita-tgt-3e216c9
@@ -57,12 +56,12 @@ Extensions for RDMA (ISER) to scsi-target-utils.
 %{__install} -d %{buildroot}%{_sbindir}
 %{__install} -d %{buildroot}%{_mandir}/man5
 %{__install} -d %{buildroot}%{_mandir}/man8
-%{__install} -d %{buildroot}%{_initrddir}
+%{__install} -d %{buildroot}%{_unitdir}
 %{__install} -d %{buildroot}%{_sysconfdir}/tgt
 %{__install} -d %{buildroot}%{_sysconfdir}/sysconfig
 
 %{__install} -p -m 0755 scripts/tgt-setup-lun %{buildroot}%{_sbindir}
-%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_initrddir}/tgtd
+%{__install} -p -m 0755 %{SOURCE1} %{buildroot}%{_unitdir}
 %{__install} -p -m 0755 scripts/tgt-admin %{buildroot}/%{_sbindir}/tgt-admin
 %{__install} -p -m 0644 doc/manpages/targets.conf.5 %{buildroot}/%{_mandir}/man5
 %{__install} -p -m 0644 doc/manpages/tgtadm.8 %{buildroot}/%{_mandir}/man8
@@ -74,22 +73,24 @@ Extensions for RDMA (ISER) to scsi-target-utils.
 pushd usr
 %{__make} install ISCSI_RDMA=1 DESTDIR=%{buildroot} sbindir=%{_sbindir} libdir=%{_libdir}/tgt
 
-
 %post
-/sbin/chkconfig --add tgtd
-
-%postun
-if [ "$1" -ge "1" ] ; then
-     /sbin/service tgtd condrestart > /dev/null 2>&1 || :
+if [ $1 -eq 1 ]; then
+    systemctl daemon-reload >/dev/null 2>&1 || :
 fi
 
 %preun
-if [ "$1" = "0" ] ; then
-     /sbin/service tgtd stop > /dev/null 2>&1 || :
-     /sbin/chkconfig --del tgtd
+if [ $1 -eq 0 ]; then
+    systemctl --no-reload disable fcoe.service >/dev/null 2>&1 || :
+    systemctl stop fcoe.service >/dev/null 2>&1 || :
+fi
+
+%postun
+if [ $1 -ge 1 ]; then
+    systemctl try-restart %{name}.service >/dev/null 2>&1 || :
 fi
 
 
+
 %clean
 %{__rm} -rf %{buildroot}
 
@@ -104,7 +105,7 @@ fi
 %{_sbindir}/tgtimg
 %{_mandir}/man5/*
 %{_mandir}/man8/*
-%{_initrddir}/tgtd
+%{_unitdir}/tgtd.service
 %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/sysconfig/tgtd
 %attr(0600,root,root) %config(noreplace) %{_sysconfdir}/tgt/targets.conf
 
@@ -113,6 +114,10 @@ fi
 
 
 %changelog
+* Thu Dec 15 2011 Andy Grover <agrover at redhat.com> - 1.0.22-2
+- Convert to systemd init (based on fcoe-utils.spec)
+- Correct arch excludes for subpackage only
+
 * Sat Dec 3 2011 Andy Grover <agrover at redhat.com> - 1.0.22-1
 - New upstream release
 - Remove patch scsi-target-utils-hack-check-for-eventfd.patch,
diff --git a/sysconfig.tgtd b/sysconfig.tgtd
index 976e94e..64df6a3 100644
--- a/sysconfig.tgtd
+++ b/sysconfig.tgtd
@@ -1,2 +1,5 @@
+# options for tgtd
+TGTD_OPTS=""
+
 # configuration file
-#TGTD_CONFIG=/etc/tgt/targets.conf
+TGTD_CONFIG=/etc/tgt/targets.conf
diff --git a/tgtd.service b/tgtd.service
new file mode 100644
index 0000000..cc2c1c7
--- /dev/null
+++ b/tgtd.service
@@ -0,0 +1,31 @@
+[Unit]
+Description=tgtd iSCSI target daemon
+After=network.target
+
+[Service]
+EnvironmentFile=/etc/sysconfig/tgtd
+
+ExecStart=/usr/sbin/tgtd -f $TGTD_OPTS
+# Put tgtd into "offline" state until all the targets are configured.
+# We don't want initiators to (re)connect and fail the connection
+# if it's not ready.
+ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v offline
+# Configure the targets.
+ExecStartPost=/usr/sbin/tgt-admin -e -c $TGTD_CONFIG
+# Put tgtd into "ready" state.
+ExecStartPost=/usr/sbin/tgtadm --op update --mode sys --name State -v ready
+
+# Update configuration for targets. Only targets which
+# are not in use will be updated.
+ExecReload=/usr/bin/tgt-admin --update ALL -c $TGTD_CONFIG
+
+# NOTE: Shutdown of the iscsi target may cause data corruption
+# for initiators that are connected.
+ExecStop=/usr/sbin/tgtadm --op update --mode sys --name State -v offline
+# Remove all targets. It only removes targets which are not in use.
+ExecStop=/usr/sbin/tgt-admin --update ALL -c /dev/null
+# tgtd will exit if all targets were removed
+ExecStop=/usr/sbin/tgtadm --op delete --mode system
+
+[Install]
+WantedBy=multi-user.target


More information about the scm-commits mailing list