File targetcli-fb.spec of Package targetcli-fb

#
# spec file for package targetcli-fb
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define oname targetcli-fb
%define realver  2.1.fb43

Name:           %{oname}
Version:        2.1.43
Release:        1%{?dist}
Url:            http://github.com/agrover/%{oname}
Summary:        A command shell for managing the Linux LIO kernel target
License:        Apache-2.0
Group:          System/Management
Source:         %{oname}-%{realver}.tar.gz
Source1:        %{oname}.service
Conflicts:      targetcli
Requires:       python-configshell-fb
Requires:       python-rtslib-fb
Requires:       python-six
BuildArch:      noarch
BuildRequires:  fdupes
BuildRequires:  python-configshell-fb
BuildRequires:  python-devel
BuildRequires:  python-pyparsing
BuildRequires:  python-rtslib-fb
BuildRequires:  python-setuptools
BuildRequires:  systemd
%{?systemd_requires}
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
targetcli-fb is a command-line interface for configuring the LIO generic
SCSI target, present in 3.x Linux kernel versions.

targetcli-fb is a fork of the "targetcli" code written by RisingTide Systems.
The "-fb" differentiates between the original and this version. Please ensure
to use either all "fb" versions of the targetcli components -- targetcli,
rtslib, and configshell, or stick with all non-fb versions, since they are
no longer strictly compatible.

%prep
%setup -q -n %{oname}-%{realver}%{?extraver}

%build
%__python setup.py build

%install
%__python setup.py install --prefix=%{_prefix} --root=%{buildroot}
%__install -d -m755 %{buildroot}%{_sysconfdir}/target
%__install -d -m755 %{buildroot}%{_sysconfdir}/target/backup
%__install -d -m755 %{buildroot}%{_sbindir}
%fdupes %{buildroot}%{python_sitelib}
%__install -D -m644 targetcli.8 %{buildroot}%{_mandir}/man8/targetcli.8
%__install -D -m644 %{S:1} %{buildroot}%{_unitdir}/targetcli.service
%__ln_s %{_sbindir}/service %{buildroot}/%{_sbindir}/rctargetcli

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%post
%{service_add_post targetcli.service}

%postun
%{service_del_postun targetcli.service}

%pre
%{service_add_pre targetcli.service}

%preun
%{stop_on_removal targetcli}
%{service_del_preun targetcli.service}

%files
%defattr(-,root,root)
%doc COPYING README.md THANKS
%dir %{_sysconfdir}/target
%dir %{_sysconfdir}/target/backup
%{_bindir}/targetcli
%{python_sitelib}/*
%doc %{_mandir}/man8/targetcli.8.gz
%{_unitdir}/targetcli.service
%{_sbindir}/rctargetcli

%changelog
openSUSE Build Service is sponsored by