diff --git a/.gitignore b/.gitignore index e69de29..e799649 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/targetd-0.2.2.tar.gz diff --git a/sources b/sources index e69de29..2067c25 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +6f450f5e82a674f1f7126c49528464ab targetd-0.2.2.tar.gz diff --git a/targetd.service b/targetd.service new file mode 100644 index 0000000..27ac073 --- /dev/null +++ b/targetd.service @@ -0,0 +1,11 @@ +[Unit] +Description=targetd storage array API daemon +Requires=targetcli.service +After=targetcli.service + +[Service] +ExecStart=/usr/bin/targetd + +[Install] +WantedBy=multi-user.target + diff --git a/targetd.spec b/targetd.spec new file mode 100644 index 0000000..f093b91 --- /dev/null +++ b/targetd.spec @@ -0,0 +1,69 @@ +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 - 0.2.1-1 +- Initial packaging diff --git a/targetd.yaml b/targetd.yaml new file mode 100644 index 0000000..dd7bf67 --- /dev/null +++ b/targetd.yaml @@ -0,0 +1,8 @@ +# See http://www.yaml.org/spec/1.2/spec.html for more on YAML. + +# defaults below; uncomment and edit +#pool_name: vg-targetd +#user: admin +#password: targetd +#ssl: false +#target_name: iqn.2003-01.org.example.mach1:1234