aports/community/targetcli/targetcli.initd
psykose e9142a6f9e community/targetcli: split out eend
if restoreconfig fails we correctly unmount, but eend is then 0 if
umount works, and we don't flag the failure

unroll it so the exitcode is based on the command only
2023-04-17 21:25:23 +02:00

31 lines
548 B
Bash
Executable File

#!/sbin/openrc-run
description="Administration tool for managing RisingTide Systems storage targets"
command="/usr/bin/targetcli"
depend() {
need dbus net
after firewall
}
start() {
ebegin "Starting ${RC_SVCNAME}"
for mod in $MODULES; do
modprobe $mod
done
mount -t configfs none /sys/kernel/config
$command restoreconfig clear_existing=true
ret=$?
if [ $ret -ne 0 ]; then
umount /sys/kernel/config
fi
eend $ret
}
stop() {
ebegin "Stopping ${RC_SVCNAME}"
$command clearconfig confirm=true
umount /sys/kernel/config
eend $?
}