32 lines
746 B
Plaintext
32 lines
746 B
Plaintext
#!/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'
|
|
}
|