Name: targetd
License: GPLv3
Group: System Environment/Libraries
Summary: Service to make storage remotely configurable
Version: 0.2.2
Release: 3%{?dist}
URL: https://github.com/agrover/targetd
Source: https://github.com/downloads/agrover/%{name}/%{name}-%{version}.tar.gz
Source1: targetd.service
Source2: targetd.yaml
BuildArch: noarch
Requires: targetcli PyYAML python-setproctitle python-lvm
Requires(post): systemd-units
Requires(preun): systemd-units
Requires(postun): systemd-units
%description
targetd turns the machine into a remotely-configurable storage appliance.
It supports an HTTP/jsonrpc-2.0 interface to let a remote
administrator allocate volumes from an LVM volume group, and export
those volumes over iSCSI.
%prep
%setup -q
%build
gzip --stdout targetd.8 > targetd.8.gz
%install
mkdir -p %{buildroot}%{_bindir}
mkdir -p %{buildroot}%{_mandir}/man8/
mkdir -p %{buildroot}%{_unitdir}
mkdir -p %{buildroot}%{_sysconfdir}/target/
install -m 755 targetd %{buildroot}%{_bindir}
install -m 644 %{SOURCE1} %{buildroot}%{_unitdir}/targetd.service
install -m 644 %{SOURCE2} %{buildroot}%{_sysconfdir}/target/targetd.yaml
install -m 644 targetd.8.gz %{buildroot}%{_mandir}/man8/
%post
if [ $1 -eq 1 ] ; then
# Initial installation
/bin/systemctl daemon-reload >/dev/null 2>&1 || :
fi
%preun
if [ $1 -eq 0 ] ; then
# Package removal, not upgrade
/bin/systemctl --no-reload disable targetd.service > /dev/null 2>&1 || :
/bin/systemctl stop targetd.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 targetd.service >/dev/null 2>&1 || :
fi
%files
%{_bindir}/targetd
%{_unitdir}/targetd.service
%doc LICENSE README.md API.md client
%{_mandir}/man8/targetd.8.gz
%config(noreplace) %{_sysconfdir}/target/targetd.yaml
%changelog
* Sat Jul 21 2012 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 0.2.2-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_18_Mass_Rebuild
* Mon Jun 25 2012 Andy Grover <agrover@redhat.com> - 0.2.2-2
- Add proper pkg requires
* Mon Jun 25 2012 Andy Grover <agrover@redhat.com> - 0.2.2-1
- Initial packaging