commit 11c50985850684aa0e7616062711e19aba5c57da4bdcc73e4e9ecbea99053029 Author: OBS User unknown Date: Mon Jan 15 23:26:31 2007 +0000 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/nbd?expand=0&rev=1 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/init.nbd-server b/init.nbd-server new file mode 100644 index 0000000..8051636 --- /dev/null +++ b/init.nbd-server @@ -0,0 +1,170 @@ +#!/bin/sh +# /etc/init.d/nbd-server +# and its symbolic link +# /usr)sbin/rcnbd-server +# +# Template system startup script for some example service/daemon FOO +# +# LSB compatible service control script; see http://www.linuxbase.org/spec/ +# +### BEGIN INIT INFO +# Provides: nbd-server +# Required-Start: $syslog $remote_fs +# Should-Start: $time ypbind sendmail +# Required-Stop: $syslog $remote_fs +# Should-Stop: $time ypbind sendmail +# Default-Start: 3 5 +# Default-Stop: 0 1 2 6 +# Short-Description: nbd server +# Description: Start nbd server +### END INIT INFO +# + +# Check for missing binaries (stale symlinks should not happen) +# Note: Special treatment of stop for LSB conformance +NBD_BIN=/usr/bin/nbd-server +test -x $NBD_BIN || { echo "$NBD_BIN not installed"; + if [ "$1" = "stop" ]; then exit 0; + else exit 5; fi; } + +# Check for existence of needed config file and read it +NBD_CONFIG=/etc/nbd-server.conf +test -r $NBD_CONFIG || { echo "$NBD_CONFIG not existing"; + if [ "$1" = "stop" ]; then exit 0; + else exit 6; fi; } + +# Shell functions sourced from /etc/rc.status: +. /etc/rc.status + +# Reset status of this service +rc_reset + +case "$1" in + start) + echo -n "Starting nbd-server " + ## Start daemon with startproc(8). If this fails + ## the return value is set appropriately by startproc. + declare -i started + started=0 + while read port file options; do + if test -z "$port"; then continue; fi + if test "${port:0:1}" = "#"; then continue; fi + echo -n " $port" + #/sbin/startproc -p /var/run/nbd-server.$port.pid $NBD_BIN $port $file $options + $NBD_BIN $port $file $options + rc_check + let started+=1 + done < $NBD_CONFIG + # Remember status and be verbose + if test $_rc_status = 0 -a $started = 0; then + rc_status -s + else + true + rc_status -v + fi + ;; + stop) + echo -n "Shutting down nbd-server " + ## Stop daemon with killproc(8) and if this fails + ## killproc sets the return value according to LSB. + + while read port file options; do + if test -z "$port"; then continue; fi + if test "${port:0:1}" = "#"; then continue; fi + echo -n " $port" + /sbin/killproc -p /var/run/nbd-server.$port.pid $NBD_BIN $port $file $options + done < $NBD_CONFIG + + # Remember status and be verbose + rc_status -v + ;; + try-restart|condrestart) + ## Do a restart only if the service was active before. + ## Note: try-restart is now part of LSB (as of 1.9). + ## RH has a similar command named condrestart. + if test "$1" = "condrestart"; then + echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}" + fi + $0 status + if test $? = 0; then + $0 restart + else + rc_reset # Not running is not a failure. + fi + # Remember status and be quiet + rc_status + ;; + restart) + ## Stop the service and regardless of whether it was + ## running or not, start it again. + $0 stop + $0 start + + # Remember status and be quiet + rc_status + ;; + force-reload) + ## Signal the daemon to reload its config. Most daemons + ## do this on signal 1 (SIGHUP). + ## If it does not support it, restart the service if it + ## is running. + + echo -n "Reload service nbd-server " + ## if it supports it: + /sbin/killproc -HUP $NBD_BIN + #touch /var/run/nbd-server.pid + rc_status -v + + ## Otherwise: + #$0 try-restart + #rc_status + ;; + reload) + ## Like force-reload, but if daemon does not support + ## signaling, do nothing (!) + + # If it supports signaling: + echo -n "Reload service nbd-server " + /sbin/killproc -HUP $NBD_BIN + #touch /var/run/nbd-server.pid + rc_status -v + + ## Otherwise if it does not support reload: + #rc_failed 3 + #rc_status -v + ;; + status) + echo -n "Checking for service nbd-server " + ## Check status with checkproc(8), if process is running + ## checkproc will return with exit status 0. + + # NOTE: checkproc returns LSB compliant status values. + while read port file options; do + if test -z "$port"; then continue; fi + if test "${port:0:1}" = "#"; then continue; fi + echo -n " $port" + if ! test -r /var/run/nbd-server.$port.pid; then rc_failed 3; echo -n ":DIS"; continue; fi + read PID + To connect to a server running on port 2000 at host + "server.domain.com", using the client's block special file +- "/dev/nd0": ++ "/dev/nbd0": + nbd-client server.domain.com 2000 +- /dev/nd0 ++ /dev/nbd0 + + + To connect to a server running on port 2001 at host + "swapserver.domain.com", using the client's block special +- file "/dev/nd1", for swap purposes: +- nbd-client swapserver.domain.com 2001 /dev/nd1 ++ file "/dev/nbd1", for swap purposes: ++ nbd-client swapserver.domain.com 2001 /dev/nbd1 + -swap + + + To disconnect the above connection again (after making + sure the block special file is not in use anymore): +- nbd-client -d /dev/nd1 ++ nbd-client -d /dev/nbd1 + + + diff --git a/nbd-types.diff b/nbd-types.diff new file mode 100644 index 0000000..5dd9431 --- /dev/null +++ b/nbd-types.diff @@ -0,0 +1,56 @@ +Index: cliserv.h +=================================================================== +--- cliserv.h.orig ++++ cliserv.h +@@ -34,16 +34,19 @@ typedef unsigned long long u64; + #else + #error I need at least some 64-bit type + #endif + ++#ifndef NBD_H_LINUX + /* 2.6.18 and above use __be* rather than u* */ + #define __be32 u32 + #define __be64 u64 ++#endif + + #ifdef NBD_H_LOCAL + #include "nbd.h" + #else + #ifdef NBD_H_LINUX ++#include + #include + #endif // NBD_H_LINUX + #endif // NBD_H_LOCAL + +Index: configure.ac +=================================================================== +--- configure.ac.orig ++++ configure.ac +@@ -74,21 +74,19 @@ AC_MSG_CHECKING(where to find a working + dnl We need to check for NBD_CMD_DISC, but that's part of an enum, it is not + dnl #define'd. Therefore, we check for something which is differently #define'd + dnl in the old or new versions, even if we don't really care about that. + dnl This might break at some time, but it should work for now, so... +-AC_TRY_COMPILE([#define u32 int +-#define u64 int +-#define __be32 int +-#define __be64 int ++AC_TRY_COMPILE([#define u32 __u32 ++#define u64 __u64 ++#include + #include "nbd.h" + ], + [int foo=NBD_CMD_DISC], + [AC_DEFINE(NBD_H_LOCAL, 1, Set to 1 if a (kernel 2.6) nbd.h can be found in the current directory) + NBD_H='"nbd.h"'], +- AC_TRY_COMPILE([#define u32 int +-#define u64 int +-#define __be32 int +-#define __be64 int ++ AC_TRY_COMPILE([#define u32 __u32 ++#define u64 __u64 ++#include + #include + ], + [int foo=NBD_CMD_DISC], + [AC_DEFINE(NBD_H_LINUX, 1, Set to 1 if a (kernel 2.6) nbd.h can be found in the linux directory in the search path) NBD_H=''], diff --git a/nbd.changes b/nbd.changes new file mode 100644 index 0000000..aaa33ef --- /dev/null +++ b/nbd.changes @@ -0,0 +1,78 @@ +------------------------------------------------------------------- +Sat Nov 18 01:49:07 CET 2006 - garloff@suse.de + +- Add nbd-server init script (parses /etc/nbd-server.conf). + +------------------------------------------------------------------- +Thu Oct 19 14:03:52 CEST 2006 - garloff@suse.de + +- Update to nbd-2.8.7: + * A fix for build against nbd.h for kernel 2.6.18 (and above, + presumably) + +------------------------------------------------------------------- +Fri Oct 13 00:50:12 CEST 2006 - ro@suse.de + +- include linux/types.h before linux/nbd.h + +------------------------------------------------------------------- +Mon Aug 7 15:32:39 CEST 2006 - garloff@suse.de + +- Update to nbd-2.8.6: + * performance/reliability improvements: Use select() rather than + accept() and waitpid() with WNOHANG rather than wait(). +- Update to nbd-2.8.5: + * -persist option. + * Add export verification. + * Make sure queue is empty for write requests to read-only export. +- Update to nbd-2.8.4: + * Includes the previous fix (closing server socket) + +------------------------------------------------------------------- +Mon Mar 6 14:14:26 CET 2006 - garloff@suse.de + +- Make sure children quit when they finish serving, rather than + trying to do stuff with a server socket that they've closed + already in a loop. Whoops. (Fix from nbd-2.8.4.) + +------------------------------------------------------------------- +Wed Jan 25 21:38:34 CET 2006 - mls@suse.de + +- converted neededforbuild to BuildRequires + +------------------------------------------------------------------- +Mon Jan 23 16:07:50 CET 2006 - garloff@suse.de + +- Enable -fstack-protector. + +------------------------------------------------------------------- +Mon Jan 9 14:41:25 CET 2006 - garloff@suse.de + +- Update to nbd-2.8.3: + * CVE-2005-3534. + * A fix for 64bit systems regarding the BLKGETSIZE ioctl(). + * Better handling of SIGCHLD. + +------------------------------------------------------------------- +Tue Dec 20 00:05:22 CET 2005 - garloff@suse.de + +- Update to nbd-2.8.2: + * Enable LFS by default. + +------------------------------------------------------------------- +Wed Nov 2 22:27:40 CET 2005 - dmueller@suse.de + +- don't build as root + +------------------------------------------------------------------- +Fri Oct 28 10:22:59 CEST 2005 - garloff@suse.de + +- Update to version 2.8.1. +- Documentation added. + +------------------------------------------------------------------- +Mon Jul 4 18:24:39 CEST 2005 - garloff@suse.de + +- Initial creation of package. + +------------------------------------------------------------------- diff --git a/nbd.spec b/nbd.spec new file mode 100644 index 0000000..8f58685 --- /dev/null +++ b/nbd.spec @@ -0,0 +1,140 @@ +# +# spec file for package nbd (Version 2.8.7) +# +# Copyright (c) 2006 SUSE LINUX Products GmbH, Nuernberg, Germany. +# This file and all modifications and additions to the pristine +# package are under the same license as the package itself. +# +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + +# norootforbuild + +Name: nbd +BuildRequires: doxygen glib2-devel +PreReq: %insserv_prereq +Version: 2.8.7 +Release: 12 +License: GNU General Public License (GPL) +Group: Productivity/Networking/Other +Autoreqprov: on +Source: %{name}-%{version}.tar.bz2 +Source2: init.nbd-server +Patch1: nbd-doc.diff +Patch2: nbd-types.diff +Summary: Network Block Device Server and Client Utilities +URL: http://nbd.sourceforge.net/ +Prefix: /usr +BuildRoot: %{_tmppath}/%{name}-%{version}-build + +%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. + + + +Authors: +-------- + Wouter Verhelst + Anton Altaparmakov + Pavel Machek + Paul Clements + +%prep +%setup +%patch1 -p1 +%patch2 +touch nbd-client.8 + +%build +autoreconf --force --install +export CFLAGS="$RPM_OPT_FLAGS -fstack-protector" +#export CFLAGS="$RPM_OPT_FLAGS" +./configure --with-gnu-ld --prefix=/usr --mandir=%{_mandir} \ + --infodir=%{_infodir} --libdir=%{_libdir} --libexecdir=%{_libdir} \ + --program-prefix="" --build=%{_target_cpu}-suse-linux +make +doxygen + +%install +make install DESTDIR=$RPM_BUILD_ROOT man_MANS='nbd-client.8 nbd-server.1' +mkdir -p $RPM_BUILD_ROOT/etc/init.d +install %SOURCE2 $RPM_BUILD_ROOT/etc/init.d/nbd-server +mkdir -p $RPM_BUILD_ROOT/usr/bin +ln -s ../../etc/init.d/nbd-server $RPM_BUILD_ROOT/usr/bin/rcnbd-server +echo "#Port file options" > $RPM_BUILD_ROOT/etc/nbd-server.conf + +%files +%defattr(-,root,root) +%attr(0755,root,root) /usr/sbin/nbd-client +%attr(0755,root,root) /usr/bin/nbd-server +%attr(0755,root,root) /etc/init.d/nbd-server +%attr(0755,root,root) /usr/bin/rcnbd-server +%{_mandir}/man1/nbd-server.1.gz +%{_mandir}/man8/nbd-client.8.gz +%doc README +%doc doc/html +%config(noreplace) /etc/nbd-server.conf + +%post +%{fillup_and_insserv -f nbd-server} + +%postun +%{insserv_cleanup} + +%changelog -n nbd +* Sat Nov 18 2006 - garloff@suse.de +- Add nbd-server init script (parses /etc/nbd-server.conf). +* Thu Oct 19 2006 - garloff@suse.de +- Update to nbd-2.8.7: + * A fix for build against nbd.h for kernel 2.6.18 (and above, + presumably) +* Fri Oct 13 2006 - ro@suse.de +- include linux/types.h before linux/nbd.h +* Mon Aug 07 2006 - garloff@suse.de +- Update to nbd-2.8.6: + * performance/reliability improvements: Use select() rather than + accept() and waitpid() with WNOHANG rather than wait(). +- Update to nbd-2.8.5: + * -persist option. + * Add export verification. + * Make sure queue is empty for write requests to read-only export. +- Update to nbd-2.8.4: + * Includes the previous fix (closing server socket) +* Mon Mar 06 2006 - garloff@suse.de +- Make sure children quit when they finish serving, rather than + trying to do stuff with a server socket that they've closed + already in a loop. Whoops. (Fix from nbd-2.8.4.) +* Wed Jan 25 2006 - mls@suse.de +- converted neededforbuild to BuildRequires +* Mon Jan 23 2006 - garloff@suse.de +- Enable -fstack-protector. +* Mon Jan 09 2006 - garloff@suse.de +- Update to nbd-2.8.3: + * CVE-2005-3534. + * A fix for 64bit systems regarding the BLKGETSIZE ioctl(). + * Better handling of SIGCHLD. +* Tue Dec 20 2005 - garloff@suse.de +- Update to nbd-2.8.2: + * Enable LFS by default. +* Wed Nov 02 2005 - dmueller@suse.de +- don't build as root +* Fri Oct 28 2005 - garloff@suse.de +- Update to version 2.8.1. +- Documentation added. +* Mon Jul 04 2005 - garloff@suse.de +- Initial creation of package. diff --git a/ready b/ready new file mode 100644 index 0000000..473a0f4