diff options
author | James Meyer <james.meyer@operamail.com> | 2012-08-07 20:35:37 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-08-07 20:35:37 (GMT) |
commit | c16d87c6431130c7ef4081ced7372ebbf1c83ad5 (patch) | |
tree | 111b28bd625d2771885fe18269550b3364667d96 /abs | |
parent | 2194e3567f7560cfbbe986444f0fc8cc4683922c (diff) | |
download | linhes_pkgbuild-c16d87c6431130c7ef4081ced7372ebbf1c83ad5.zip linhes_pkgbuild-c16d87c6431130c7ef4081ced7372ebbf1c83ad5.tar.gz linhes_pkgbuild-c16d87c6431130c7ef4081ced7372ebbf1c83ad5.tar.bz2 |
nbd: 3.2
Diffstat (limited to 'abs')
-rw-r--r-- | abs/extra/nbd/PKGBUILD | 42 | ||||
-rw-r--r-- | abs/extra/nbd/config | 33 | ||||
-rw-r--r-- | abs/extra/nbd/nbd | 39 | ||||
-rw-r--r-- | abs/extra/nbd/nbd.install | 13 | ||||
-rw-r--r-- | abs/extra/nbd/nbd.service | 10 |
5 files changed, 137 insertions, 0 deletions
diff --git a/abs/extra/nbd/PKGBUILD b/abs/extra/nbd/PKGBUILD new file mode 100644 index 0000000..e02e890 --- /dev/null +++ b/abs/extra/nbd/PKGBUILD @@ -0,0 +1,42 @@ +# $Id: PKGBUILD 73924 2012-07-17 05:54:37Z 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.2 +pkgrel=2 +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 nbd.service) +backup=('etc/nbd-server/config') +depends=('glib2') +install=nbd.install +md5sums=('9cafce4ecfb55e670d7ded4c8f4e6bc9' + '2d05d426b8c2708d5f8a0d028fcbae05' + 'e7b13a8b3369e11927d9917664557efa' + '5d1acc143018117174f79eff15afa038') + +build(){ + cd "${srcdir}/${pkgname}-${pkgver}" + + ./configure --prefix=/usr --sysconfdir=/etc + + make +} + +package() { + cd "${srcdir}/${pkgname}-${pkgver}" + + make DESTDIR="${pkgdir}" install + + install -D -m644 "${srcdir}"/config "${pkgdir}"/etc/nbd-server/config + install -D -m755 "${srcdir}"/nbd "${pkgdir}"/etc/rc.d/nbd + 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/abs/extra/nbd/config b/abs/extra/nbd/config new file mode 100644 index 0000000..777f0ef --- /dev/null +++ b/abs/extra/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/abs/extra/nbd/nbd b/abs/extra/nbd/nbd new file mode 100644 index 0000000..76d16c7 --- /dev/null +++ b/abs/extra/nbd/nbd @@ -0,0 +1,39 @@ +#!/bin/bash + +. /etc/rc.conf +. /etc/rc.d/functions + +PIDFILE="/var/run/nbd-server.pid" +PID=`cat $PIDFILE 2>/dev/null` +case "$1" in + start) + stat_busy "Starting Network Block Device Server" + if [ "$PID" = "" ]; then + /usr/bin/nbd-server + fi + if [ "$PID" != "" -o $? -gt 0 ]; then + stat_fail + else + add_daemon nbd + stat_done + fi + ;; + stop) + stat_busy "Stopping Network Block Device Server" + [ ! -z "$PID" ] && kill $PID &> /dev/null + rm -f $PIDFILE + if [ $? -gt 0 ]; then + stat_fail + else + rm_daemon nbd + stat_done + fi + ;; + restart) + $0 stop + sleep 1 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" +esac diff --git a/abs/extra/nbd/nbd.install b/abs/extra/nbd/nbd.install new file mode 100644 index 0000000..9e7a01e --- /dev/null +++ b/abs/extra/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/abs/extra/nbd/nbd.service b/abs/extra/nbd/nbd.service new file mode 100644 index 0000000..3d58051 --- /dev/null +++ b/abs/extra/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 |