summaryrefslogtreecommitdiff
path: root/community/nbd
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2013-08-13 01:33:19 -0700
committerroot <root@rshg054.dnsready.net>2013-08-13 01:33:19 -0700
commit7a65a910b77ad191d69881098c47f9b0c852d92e (patch)
tree9564e611af1442f8952a8cbddb3b0ad25ed71aab /community/nbd
parent60da6abff6c9577a783d72865f11de7a585e912e (diff)
Tue Aug 13 01:31:08 PDT 2013
Diffstat (limited to 'community/nbd')
-rw-r--r--community/nbd/PKGBUILD40
-rw-r--r--community/nbd/config33
-rw-r--r--community/nbd/nbd.install13
-rw-r--r--community/nbd/nbd.service10
4 files changed, 96 insertions, 0 deletions
diff --git a/community/nbd/PKGBUILD b/community/nbd/PKGBUILD
new file mode 100644
index 000000000..bc073921d
--- /dev/null
+++ b/community/nbd/PKGBUILD
@@ -0,0 +1,40 @@
+# $Id: PKGBUILD 90984 2013-05-16 23:49:59Z svenstaro $
+# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
+# Contributor: Christian Hesse <mail@eworm.de>
+# Contributor: Ionut Biru <ibiru@archlinux.org>
+# Contributor: Gerhard Brauer <gerbra@archlinux.de>
+
+pkgname=nbd
+pkgver=3.3
+pkgrel=3
+pkgdesc="tools for network block devices, allowing you to use remote block devices over TCP/IP"
+arch=('i686' 'x86_64')
+url="http://nbd.sourceforge.net"
+license=('GPL')
+source=(http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.bz2
+ config nbd.service)
+backup=('etc/nbd-server/config')
+depends=('glib2')
+install=nbd.install
+md5sums=('cde8fe6e870b8a7459f12e5dcf572d86'
+ '2d05d426b8c2708d5f8a0d028fcbae05'
+ '5d1acc143018117174f79eff15afa038')
+
+build(){
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ ./configure --prefix=/usr --sysconfdir=/etc --enable-syslog --sbindir=/usr/bin
+
+ make
+}
+
+package() {
+ cd "${srcdir}/${pkgname}-${pkgver}"
+
+ make DESTDIR="${pkgdir}" install
+
+ install -D -m644 "${srcdir}"/config "${pkgdir}"/etc/nbd-server/config
+ install -D -m644 "${srcdir}"/nbd.service "${pkgdir}"/usr/lib/systemd/system/nbd.service
+
+ install -D -m644 README "${pkgdir}"/usr/share/doc/nbd/README
+}
diff --git a/community/nbd/config b/community/nbd/config
new file mode 100644
index 000000000..777f0ef24
--- /dev/null
+++ b/community/nbd/config
@@ -0,0 +1,33 @@
+[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
+ # Since version 2.9.17, nbd-server will do exports on a name
+ # basis (the used name is the name of the section in which the
+ # export is specified). This however required an incompatible
+ # protocol change. To enable backwards-compatible port-based
+ # exports, uncomment the following line:
+ # oldstyle = true
+[export1]
+ exportname = /export/nbd/export1-file
+ # The following line will be ignored unless the
+ # "oldstyle = true" line in the generic section above is
+ # enabled.
+ #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
+ # The other options are all optional, except this one in case
+ # the oldstyle option is used in [generic]:
+ # port = 12346
diff --git a/community/nbd/nbd.install b/community/nbd/nbd.install
new file mode 100644
index 000000000..9e7a01e98
--- /dev/null
+++ b/community/nbd/nbd.install
@@ -0,0 +1,13 @@
+post_install() {
+ getent group "nbd" &>/dev/null || groupadd -r -g 44 nbd 1>/dev/null
+ getent passwd "nbd" &>/dev/null || useradd -r -u 44 -g nbd -d "/var/empty" -s "/bin/false" nbd 1>/dev/null
+}
+
+post_upgrade() {
+ post_install
+}
+
+pre_remove() {
+ getent passwd "nbd" &>/dev/null && userdel nbd 1>/dev/null
+ getent group "nbd" &>/dev/null && groupdel nbd 1>/dev/null
+}
diff --git a/community/nbd/nbd.service b/community/nbd/nbd.service
new file mode 100644
index 000000000..3d580514c
--- /dev/null
+++ b/community/nbd/nbd.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Network Block Device Server
+After=network.target
+
+[Service]
+Type=forking
+ExecStart=/usr/bin/nbd-server
+
+[Install]
+WantedBy=multi-user.target