88290e4f7b0400bfeb9e47affaab8ec5e0f6c472
[packages/trusty/cirros-testvm.git] / cirros-testvm / src-cirros / buildroot-2015.05 / package / targetcli-fb / S50target
1 #!/bin/sh
2 #
3 # Restore / clear the Linux "SCSI target" driver configuration with `targetctl`
4 #
5
6 start() {
7         local ret
8
9         echo -n "Restoring target configuration: "
10         /usr/bin/targetctl restore >/dev/null 2>&1
11         ret=$?
12         echo "done"
13
14         return $ret
15 }
16
17 stop() {
18         local ret
19
20         echo -n "Clearing target configuration: "
21         /usr/bin/targetctl clear >/dev/null 2>&1
22         ret=$?
23         echo "done"
24
25         return $ret
26 }
27
28 restart() {
29         stop
30         start
31 }
32
33 case "$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
46 esac