diff --git a/nbd-client.service b/nbd-client.service new file mode 100644 index 0000000..7af5ca4 --- /dev/null +++ b/nbd-client.service @@ -0,0 +1,12 @@ +[Unit] +Description=NBD client connection for %i +Documentation=man:nbd-client(8) man:nbdtab(5) +After=network-online.target + +[Service] +Type=forking +ExecStart=/usr/sbin/nbd-client %i +ExecStop=/usr/sbin/nbd-client -d /dev/%i + +[Install] +WantedBy=multi-user.target diff --git a/nbd.changes b/nbd.changes index ccbd121..5c6057e 100644 --- a/nbd.changes +++ b/nbd.changes @@ -1,3 +1,10 @@ +------------------------------------------------------------------- +Thu Sep 7 13:21:03 UTC 2017 - olaf@aepfle.de + +- Add nbd-client.service which will provide a nbd@.service to + allow other units to require a nbd@nbd0.service if /etc/nbdtab + is configured accordingly + ------------------------------------------------------------------- Thu Jun 8 12:07:49 UTC 2017 - mpluskal@suse.com diff --git a/nbd.spec b/nbd.spec index 1e03507..cc2df02 100644 --- a/nbd.spec +++ b/nbd.spec @@ -27,6 +27,7 @@ Source0: http://downloads.sourceforge.net/project/%{name}/%{name}/%{versi Source1: %{name}-server.service Source3: config.example Source4: nbd-server.sysconfig +Source5: nbd-client.service BuildRequires: pkgconfig BuildRequires: systemd-rpm-macros BuildRequires: pkgconfig(glib-2.0) >= 2.26.0 @@ -64,6 +65,8 @@ make %{?_smp_mflags} %make_install # install systemd unit +install -D -p -m 0644 %{SOURCE5} \ + %{buildroot}/%{_unitdir}/%{name}@.service install -D -p -m 0644 %{SOURCE1} \ %{buildroot}/%{_unitdir}/%{name}-server.service ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-server @@ -119,6 +122,7 @@ fi %{_bindir}/nbd-trdump %{_sbindir}/min-nbd-client %{_sbindir}/rcnbd-server +%{_unitdir}/%{name}@.service %{_unitdir}/%{name}-server.service %{_mandir}/man1/nbd-server.1%{ext_man} %{_mandir}/man1/nbd-trdump.1%{ext_man}