xref: /OK3568_Linux_fs/buildroot/package/targetcli-fb/S50target (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1#!/bin/sh
2#
3# Restore / clear the Linux "SCSI target" driver configuration with `targetctl`
4#
5
6start() {
7	local ret
8
9	printf "Restoring target configuration: "
10	/usr/bin/targetctl restore >/dev/null 2>&1
11	ret=$?
12	echo "done"
13
14	return $ret
15}
16
17stop() {
18	local ret
19
20	printf "Clearing target configuration: "
21	/usr/bin/targetctl clear >/dev/null 2>&1
22	ret=$?
23	echo "done"
24
25	return $ret
26}
27
28restart() {
29	stop
30	start
31}
32
33case "$1" in
34	start)
35		start
36		;;
37	stop)
38		stop
39		;;
40	restart)
41		restart
42		;;
43	*)
44		echo "Usage: $0 {start|stop|restart}"
45		exit 1
46esac
47