summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Penteker <tek@serverop.de>2012-06-01 20:59:42 +0200
committerThomas Penteker <tek@serverop.de>2012-06-01 20:59:42 +0200
commite88e8d9fdbf5b9bdb37c5cfb90cdf5c939eee019 (patch)
tree0dce0fddbd523d9505e6657c1243bc7098ef0052
parent2e5b19ff05cd69b953f08e86c5752f6f9fa58f9e (diff)
downloadcontrib-e88e8d9fdbf5b9bdb37c5cfb90cdf5c939eee019.tar.gz
contrib-e88e8d9fdbf5b9bdb37c5cfb90cdf5c939eee019.tar.xz
nbd: initial import
-rw-r--r--nbd/.footprint19
-rw-r--r--nbd/.md5sum3
-rw-r--r--nbd/Pkgfile23
-rw-r--r--nbd/README57
-rw-r--r--nbd/allow7
-rwxr-xr-xnbd/nbd-server28
6 files changed, 137 insertions, 0 deletions
diff --git a/nbd/.footprint b/nbd/.footprint
new file mode 100644
index 000000000..43f3c9c49
--- /dev/null
+++ b/nbd/.footprint
@@ -0,0 +1,19 @@
+drwxr-xr-x root/root etc/
+drwxr-xr-x root/root etc/nbd-server/
+-rw------- root/root etc/nbd-server/allow
+drwxr-xr-x root/root etc/rc.d/
+-rwxr-xr-x root/root etc/rc.d/nbd-server
+drwxr-xr-x root/root usr/
+drwxr-xr-x root/root usr/bin/
+-rwxr-xr-x root/root usr/bin/nbd-server
+-rwxr-xr-x root/root usr/bin/nbd-trdump
+drwxr-xr-x root/root usr/man/
+drwxr-xr-x root/root usr/man/man1/
+-rw-r--r-- root/root usr/man/man1/nbd-server.1.gz
+-rw-r--r-- root/root usr/man/man1/nbd-trdump.1.gz
+drwxr-xr-x root/root usr/man/man5/
+-rw-r--r-- root/root usr/man/man5/nbd-server.5.gz
+drwxr-xr-x root/root usr/man/man8/
+-rw-r--r-- root/root usr/man/man8/nbd-client.8.gz
+drwxr-xr-x root/root usr/sbin/
+-rwxr-xr-x root/root usr/sbin/nbd-client
diff --git a/nbd/.md5sum b/nbd/.md5sum
new file mode 100644
index 000000000..6ae57de5a
--- /dev/null
+++ b/nbd/.md5sum
@@ -0,0 +1,3 @@
+ad396c78ed08bf536d8e8824bdf0ce1e allow
+e0e9d96abe068ee4f6fecd58635450ac nbd-3.1.1.tar.bz2
+77436b3003eb851b14061cac93ab1d29 nbd-server
diff --git a/nbd/Pkgfile b/nbd/Pkgfile
new file mode 100644
index 000000000..d31bc289e
--- /dev/null
+++ b/nbd/Pkgfile
@@ -0,0 +1,23 @@
+# Description: Share or use block devices via TCP
+# URL: http://nbd.sourceforge.net/
+# Maintainer: Thomas Penteker, tek at serverop dot de
+# Depends on:
+
+name=nbd
+version=3.1.1
+release=1
+source=(nbd-server allow \
+ http://downloads.sourceforge.net/project/nbd/nbd/$version/$name-$version.tar.bz2)
+
+build() {
+ cd $name-$version
+ ./configure --prefix=/usr \
+ --mandir=/usr/man \
+ --sysconfdir=/etc
+ make
+ make DESTDIR=$PKG install
+ install -d $PKG/etc/nbd-server
+ install -D -m 600 $SRC/allow $PKG/etc/nbd-server/allow
+ install -D -m 755 $SRC/nbd-server $PKG/etc/rc.d/nbd-server
+
+}
diff --git a/nbd/README b/nbd/README
new file mode 100644
index 000000000..916b9a15c
--- /dev/null
+++ b/nbd/README
@@ -0,0 +1,57 @@
+(Partially taken from the nbd-source)
+
+You have to have support for CONFIG_BLK_DEV_NBD in your kernel.
+
+Since there's a problem with nbd and the cfq I/O scheduler,
+you may want to set it to deadline:
+
+echo 'deadline' > /sys/block/nbd0/queue/scheduler
+
+(repeat the above for nbd1, nbd2, etc, if you need more than one device)
+
+Next, start the server. You can use a file or a block device for that, e.g.
+
+nbd-server 1234 /home/wouter/nbd-export
+
+Note that the filename must be an absolute path; i.e., something like
+/path/to/file, not ../file. See the nbd-server manpage for details on
+any available options.
+
+Finally, you'll be able to start the client, e.g.
+
+nbd-client 10.0.0.1 1234 /dev/nb0
+
+nbd-client must be ran as root; the same is not true for nbd-server (but
+do make sure that /var/run is writeable by the server that nbd-server
+runs as; otherwise, you won't get a PID file, though the server will
+keep running).
+
+nbd-server can be configured by modifying
+/etc/nbd-server/config, and should look something like this:
+
+# This is a comment
+[generic]
+ # The [generic] section is required, even if nothing is specified
+ # there.
+ # When either of these options are specified, nbd-server drops
+ # privileges to the given user and group after opening ports, but
+ # _before_ opening files.
+ user = nbd
+ group = nbd
+[export1]
+ exportname = /export/nbd/export1-file
+ port = 12345
+ authfile = /export/nbd/export1-authfile
+ timeout = 30
+ filesize = 10000000
+ readonly = false
+ multifile = false
+ copyonwrite = false
+ prerun = dd if=/dev/zero of=%s bs=1k count=500
+ postrun = rm -f %s
+[otherexport]
+ exportname = /export/nbd/experiment
+ port = 12346
+ # The other options are all optional.
+
+extended documentation can be found in nbd-server(5)
diff --git a/nbd/allow b/nbd/allow
new file mode 100644
index 000000000..9af1ff475
--- /dev/null
+++ b/nbd/allow
@@ -0,0 +1,7 @@
+# nbd-server access configuration file
+# list of hosts allowed to connect to our exportet
+#
+
+#127.0.0.1
+# CIDR notation is allowed also
+#192.168.0.0/8
diff --git a/nbd/nbd-server b/nbd/nbd-server
new file mode 100755
index 000000000..2aa36286c
--- /dev/null
+++ b/nbd/nbd-server
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# /etc/rc.d/nbd-server: start/stop nbd daemon
+#
+
+case $1 in
+start)
+ /usr/bin/nbd-server -p /var/run/nbd-server.pid -l /etc/nbd-server/allow
+ ;;
+stop)
+ if [ -f /var/run/nbd-server.pid ]; then
+ kill `cat /var/run/nbd-server.pid`
+ rm -f /var/run/nbd-server.pid
+ else
+ killall -q /usr/sbin/nbd-server
+ fi
+ ;;
+restart)
+ $0 stop
+ sleep 2
+ $0 start
+ ;;
+*)
+ echo "usage: $0 [start|stop|restart]"
+ ;;
+esac
+
+# End of file

Generated by cgit