initial import
This commit is contained in:
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'
|
||||
}
|
||||
Reference in New Issue
Block a user