Blob Blame History Raw
Name:           targetd
License:        GPLv3
Group:          System Environment/Libraries
Summary:        Service to make storage remotely configurable
Version:        0.2.2
Release:        1%{?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
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
* Mon Jun 25 2012  Andy Grover <agrover@redhat.com> - 0.2.1-1
- Initial packaging