b536926e86
update OBS-URL: https://build.opensuse.org/request/show/347036 OBS-URL: https://build.opensuse.org/package/show/network:utilities/nbd?expand=0&rev=35
192 lines
6.4 KiB
RPMSpec
192 lines
6.4 KiB
RPMSpec
#
|
|
# spec file for package nbd
|
|
#
|
|
# Copyright (c) 2015 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/
|
|
#
|
|
|
|
|
|
Name: nbd
|
|
Version: 3.12.1
|
|
Release: 0
|
|
Summary: Network Block Device Server and Client Utilities
|
|
License: GPL-2.0+
|
|
Group: Productivity/Networking/Other
|
|
Url: http://nbd.sourceforge.net/
|
|
Source0: http://downloads.sourceforge.net/project/%{name}/%{name}/%{version}/%{name}-%{version}.tar.xz
|
|
Source1: %{name}-server.service
|
|
Source2: init.nbd-server
|
|
Source3: config.example
|
|
Source4: nbd-server.sysconfig
|
|
Patch2: nbd-2.9.25-close.diff
|
|
Patch3: nbd-2.9.25-doxyfile.diff
|
|
BuildRequires: doxygen
|
|
BuildRequires: glib2-devel >= 2.26.0
|
|
BuildRequires: xz
|
|
Requires(pre): %fillup_prereq
|
|
Requires(pre): coreutils
|
|
Suggests: nbd-doc
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
%if 0%{?suse_version} >= 1210
|
|
BuildRequires: systemd-rpm-macros
|
|
%systemd_requires
|
|
%else
|
|
Requires(pre): %insserv_prereq
|
|
%endif
|
|
|
|
%description
|
|
This package contains nbd-server. It is the server backend for the nbd
|
|
network block device driver that's in the Linux kernel.
|
|
|
|
nbd can be used to have a filesystem stored on another machine. It does
|
|
provide a block device, not a file system; so unless you put a
|
|
clustering filesystem on top of it, you can't access it simultaneously
|
|
from more than one client. Use NFS or a real cluster FS (such as
|
|
ocfs2) if you want to do this. nbd-server can export a file (which may
|
|
contain a filesystem image) or a partition. Swapping over nbd is
|
|
possible as well, though it's said not to be safe against OOM and
|
|
should not be used for that case. nbd-server also has a copy-on-write
|
|
mode where changes are saved to a separate file and thrown away when
|
|
the connection closes.
|
|
|
|
The package also contains the nbd-client tools, which you need to
|
|
configure the nbd devices on the client side.
|
|
|
|
%package doc
|
|
Summary: Network Block Device Server and Client Utilities
|
|
Group: Productivity/Networking/Other
|
|
Requires: nbd = %{version}
|
|
|
|
%description doc
|
|
This package contains the HTML documentation for the network block
|
|
device (nbd) utilities.
|
|
|
|
nbd can be used to have a filesystem stored on another machine. It does
|
|
provide a block device, not a file system; so unless you put a
|
|
clustering filesystem on top of it, you can't access it simultaneously
|
|
from more than one client. Use NFS or a real cluster FS (such as
|
|
ocfs2) if you want to do this. nbd-server can export a file (which may
|
|
contain a filesystem image) or a partition. Swapping over nbd is
|
|
possible as well, though it's said not to be safe against OOM and
|
|
should not be used for that case. nbd-server also has a copy-on-write
|
|
mode where changes are saved to a separate file and thrown away when
|
|
the connection closes.
|
|
|
|
%prep
|
|
%setup -q
|
|
%patch2 -p1
|
|
%patch3 -p1
|
|
|
|
%build
|
|
export CFLAGS="%{optflags} -fstack-protector -fno-strict-aliasing"
|
|
%configure
|
|
|
|
make %{?_smp_mflags}
|
|
doxygen doc/Doxyfile.in
|
|
|
|
%install
|
|
make install DESTDIR=%{buildroot} man_MANS='nbd-client.8 nbd-server.1 nbd-server.5 nbd-trdump.1'
|
|
mkdir -p %{buildroot}%{_sysconfdir}/init.d
|
|
mkdir -p %{buildroot}%{_prefix}/bin
|
|
|
|
%if 0%{?suse_version} >= 1210
|
|
install -D -m 0644 %{SOURCE1} %{buildroot}/%{_unitdir}/%{name}-server.service
|
|
ln -s %{_sbindir}/service %{buildroot}%{_sbindir}/rc%{name}-server
|
|
%else
|
|
install %{SOURCE2} %{buildroot}%{_initddir}/nbd-server
|
|
ln -s ../..%{_initddir}/nbd-server %{buildroot}%{_sbindir}/rc%{name}-server
|
|
%endif
|
|
|
|
#echo "#Port file options" > $RPM_BUILD_ROOT/etc/nbd-server.conf
|
|
mkdir -p %{buildroot}%{_sysconfdir}/nbd-server
|
|
touch %{buildroot}%{_sysconfdir}/nbd-server/config
|
|
touch %{buildroot}%{_sysconfdir}/nbd-server/allow
|
|
install -D -m 0644 %{SOURCE3} %{buildroot}%{_sysconfdir}/nbd-server/config.example
|
|
install -D -m 0644 %{SOURCE4} %{buildroot}%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}-server
|
|
|
|
%files
|
|
%defattr(-,root,root)
|
|
%attr(0755,root,root) %{_sbindir}/nbd-client
|
|
%attr(0755,root,root) %{_bindir}/nbd-server
|
|
%attr(0755,root,root) %{_bindir}/nbd-trdump
|
|
%{_sbindir}/rcnbd-server
|
|
%if 0%{?suse_version} >= 1210
|
|
%{_unitdir}/%{name}-server.service
|
|
%else
|
|
%{_initddir}/%{name}-server
|
|
%endif
|
|
%{_mandir}/man1/nbd-server.1.gz
|
|
%{_mandir}/man1/nbd-trdump.1.gz
|
|
%{_mandir}/man5/nbd-server.5.gz
|
|
%{_mandir}/man8/nbd-client.8.gz
|
|
%doc README.md
|
|
%dir %{_sysconfdir}/nbd-server
|
|
%ghost %config(noreplace) %{_sysconfdir}/nbd-server/config
|
|
%ghost %config(noreplace) %{_sysconfdir}/nbd-server/allow
|
|
%config %{_sysconfdir}/nbd-server/config.example
|
|
%{_localstatedir}/adm/fillup-templates/sysconfig.%{name}-server
|
|
|
|
%files doc
|
|
%defattr(-,root,root)
|
|
%doc doc/html
|
|
|
|
%post
|
|
%if 0%{?suse_version} >= 1210
|
|
%service_add_post %{name}-server.service
|
|
%fillup_only -n nbd-server
|
|
%else
|
|
%{fillup_and_insserv -f nbd-server}
|
|
%endif
|
|
if test -e %{_sysconfdir}/nbd-server.conf; then
|
|
# Do we have to create a generic section?
|
|
unset generic
|
|
if test -e %{_sysconfdir}/nbd-server/config; then generic=1; fi
|
|
grep -vE '^(#|[[:blank:]]*$)' %{_sysconfdir}/nbd-server.conf |
|
|
while read port file opts; do
|
|
if test -z "$generic"; then
|
|
echo > %{_sysconfdir}/nbd-server/config
|
|
echo "[generic]" >> %{_sysconfdir}/nbd-server/config
|
|
echo " # No generic options yet" >> %{_sysconfdir}/nbd-server/config
|
|
echo >> %{_sysconfdir}/nbd-server/config
|
|
generic=1
|
|
fi
|
|
FN=${file%/*}
|
|
nm="cvt.$port.${FN##*/}.${file##*/}"
|
|
echo " ... convert $port $file $opts -> $nm"
|
|
%{_bindir}/nbd-server $port $file $opts -o "$nm" >> %{_sysconfdir}/nbd-server/config
|
|
done
|
|
mv %{_sysconfdir}/nbd-server.conf %{_sysconfdir}/nbd-server.conf.converted
|
|
fi
|
|
|
|
%postun
|
|
%if 0%{?suse_version} >= 1210
|
|
%service_del_postun %{name}-server.service
|
|
%else
|
|
%insserv_cleanup
|
|
%restart_on_update nbd-server
|
|
%endif
|
|
|
|
%pre
|
|
%if 0%{?suse_version} >= 1210
|
|
%service_add_pre %{name}-server.service
|
|
%endif
|
|
|
|
%preun
|
|
%if 0%{?suse_version} >= 1210
|
|
%service_del_preun %{name}-server.service
|
|
%else
|
|
%{stop_on_removal nbd-server}
|
|
%endif
|
|
|
|
%changelog
|