initial import
This commit is contained in:
59
nbd/PKGBUILD
Normal file
59
nbd/PKGBUILD
Normal file
@@ -0,0 +1,59 @@
|
||||
# Maintainer: Jesus E. <heckyel@riseup.net>
|
||||
|
||||
|
||||
pkgname='nbd'
|
||||
pkgver='3.21'
|
||||
pkgrel='1'
|
||||
pkgdesc='Tools for network block devices'
|
||||
pkgdesc+=', allowing you to use remote block devices over TCP/IP'
|
||||
arch=('i686' 'x86_64')
|
||||
url='https://nbd.sourceforge.io/'
|
||||
license=('GPL-2')
|
||||
depends=('glib2' 'gnutls' 'libnl')
|
||||
backup=('etc/nbd-server/config')
|
||||
source=("https://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tar.xz"
|
||||
'config' 'nbd-client.confd' 'nbd-client.initd'
|
||||
'nbd-server.confd' 'nbd-server.initd')
|
||||
install="${pkgname}.install"
|
||||
sha512sums=('5dc238e6f45eb230a6f92493a8c3b4891dee98fc47e120e59c3ca31c0a698537ca03f78e43c5e7089d93d548a22b5e3853ba228536d2fc688c3edf4a590fdb3f'
|
||||
'e9247fcf12d477ffda2eadbb5217daab13051adc727eb5a8bccb284306d57d50e68dedcd812925f305136c76326d2f3b8066f0bb57492e62113ec0d73ff08fc1'
|
||||
'5c7a15ed23fee269f51a32213b93c23d9deb26091f4ec31920db0c315097a74538ace0d9ab547e8bedeaa751e86364645518d83002cb665685953e486e18545d'
|
||||
'00d46669ca9ffcd43eb79641743ec4313143347ab1bb6a608f6bf005dcb916ebf69010b34a6c958462e424427581e222ae839d6a9256358c427c48dbaab14c71'
|
||||
'4d04962035e50a1e561fc29b8853675db5b28e830ef62b5e3328f79ef8c7d9ecd34196518cd78e2b3244fb895ae93d0ff779d9955cb58ed0370ac89d019cbadc'
|
||||
'19074b4d83f7201324549b1eaa35f0af96656eae4ec8010a84b30db97d601c51ef4a56576d30181ef6ae2a92c47fd1e3ae38e53d51655d9eeebe6c1c6b8ec962')
|
||||
|
||||
build() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
|
||||
./configure \
|
||||
--prefix='/usr' \
|
||||
--sysconfdir='/etc' \
|
||||
--enable-syslog
|
||||
|
||||
make V='1'
|
||||
}
|
||||
|
||||
# checks still fail...
|
||||
#check() {
|
||||
# cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
#
|
||||
# make 'check'
|
||||
#}
|
||||
|
||||
package() {
|
||||
cd "${srcdir}/${pkgname}-${pkgver}"
|
||||
|
||||
make DESTDIR="${pkgdir}" 'install'
|
||||
|
||||
install -Dm '644' "${srcdir}/config" -t "${pkgdir}/etc/nbd-server"
|
||||
for i in "${pkgname}-client.confd" "${pkgname}-server.confd"; do
|
||||
install -Dm '644' "${srcdir}/${i}" -t "${pkgdir}/etc/conf.d"
|
||||
done
|
||||
for i in "${pkgname}-client.initd" "${pkgname}-server.initd"; do
|
||||
install -Dm '644' "${srcdir}/${i}" -t "${pkgdir}/etc/init.d"
|
||||
done
|
||||
unset i
|
||||
|
||||
install -Dm '644' 'doc/README' -t "${pkgdir}/usr/share/doc/${pkgname}/"
|
||||
install -Dm '644' 'COPYING' -t "${pkgdir}/usr/share/licenses/${pkgname}/"
|
||||
}
|
||||
21
nbd/config
Normal file
21
nbd/config
Normal file
@@ -0,0 +1,21 @@
|
||||
[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
|
||||
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.
|
||||
10
nbd/nbd-client.confd
Normal file
10
nbd/nbd-client.confd
Normal file
@@ -0,0 +1,10 @@
|
||||
# /etc/conf.d/nbd-client
|
||||
|
||||
# Options to pass to the above command
|
||||
# This default setting should work fine.
|
||||
NBDCLIENT_OPTS=""
|
||||
|
||||
# If you use hostnames above, then you should depend on dns
|
||||
# being up & running before we try to run. Otherwise, you
|
||||
# can disable this.
|
||||
rc_use="dns"
|
||||
31
nbd/nbd-client.initd
Normal file
31
nbd/nbd-client.initd
Normal file
@@ -0,0 +1,31 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2022 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
depend() {
|
||||
before 'cron' 'portmap'
|
||||
after 'net' 'openvpn'
|
||||
use 'dns' 'logger'
|
||||
}
|
||||
|
||||
checkconfig() {
|
||||
if ! type nbd-client > '/dev/null' 2>&1; then
|
||||
eerror 'Please edit /etc/conf.d/nbd-client'
|
||||
eerror "Unable to locate the client command ${NBDCLIENT_CMD}!"
|
||||
return '1'
|
||||
fi
|
||||
if [ -z "${NBDCLIENT_OPTS}" ]; then
|
||||
eerror 'Please edit /etc/conf.d/nbd-client'
|
||||
eerror 'I need to know what server/options to use!'
|
||||
return '1'
|
||||
fi
|
||||
return '0'
|
||||
}
|
||||
|
||||
start() {
|
||||
checkconfig || return "${?}"
|
||||
|
||||
ebegin "Setting the NBD client '${NBDCLIENT_CMD}'"
|
||||
nbd-client "${NBDCLIENT_OPTS}"
|
||||
eend "${?}" 'Failed to setup'
|
||||
}
|
||||
6
nbd/nbd-server.confd
Normal file
6
nbd/nbd-server.confd
Normal file
@@ -0,0 +1,6 @@
|
||||
# /etc/conf.d/nbd-server
|
||||
|
||||
# Options to pass to the nbd-server process
|
||||
# Most people should leave this line alone ...
|
||||
# however, if you know what you're doing, feel free to tweak
|
||||
NBD_OPTS=""
|
||||
21
nbd/nbd-server.initd
Normal file
21
nbd/nbd-server.initd
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/sbin/openrc-run
|
||||
# Copyright 2022 Hyperbola Project
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
description='nbd - the network block devices server'
|
||||
pidfile='/run/nbd-server.pid'
|
||||
command='/usr/bin/nbd-server'
|
||||
command_args="${NBD_OPTS}"
|
||||
start_stop_daemon_args="--pidfile ${pidfile}"
|
||||
|
||||
depend() {
|
||||
use net dns logger
|
||||
}
|
||||
|
||||
start_pre() {
|
||||
if [ ! -f /etc/nbd-server/config ]; then
|
||||
eerror 'Please create /etc/nbd-server/config'
|
||||
return '1'
|
||||
fi
|
||||
return '0'
|
||||
}
|
||||
15
nbd/nbd.install
Normal file
15
nbd/nbd.install
Normal file
@@ -0,0 +1,15 @@
|
||||
#!/bin/sh
|
||||
|
||||
post_install() {
|
||||
getent group 'nbd' &> '/dev/null' || groupadd 'nbd' > '/dev/null'
|
||||
getent passwd 'nbd' &> '/dev/null' || useradd -g 'nbd' -d '/var/empty' \
|
||||
-c 'Network Block Devices' -s '/bin/nologin' 'nbd' > '/dev/null'
|
||||
nbd_shell="$(getent passwd 'ntp' | cut -d: -f7)"
|
||||
if [ "${nbd_shell}" != '/bin/nologin' ]; then
|
||||
chsh -s '/bin/nologin' 'nbd' &> '/dev/null'
|
||||
fi
|
||||
}
|
||||
|
||||
post_upgrade(){
|
||||
post_install
|
||||
}
|
||||
Reference in New Issue
Block a user