summaryrefslogtreecommitdiff
path: root/package/targetcli-fb/S50target
diff options
context:
space:
mode:
authorChristophe Vu-Brugier <cvubrugier@fastmail.fm>2014-09-18 12:00:55 +0200
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2014-09-21 19:45:54 +0200
commit3867623c23ec0b1638d55dcb42e58f800de38785 (patch)
tree8117f7a6985308a67af76148a71c6534fb537174 /package/targetcli-fb/S50target
parente9d12828cd7e2e8ce50359ce490d8eb74198402c (diff)
targetcli-fb: new package
targetcli-fb is a command-line interface for configuring the LIO generic SCSI target, present in 3.x Linux kernel versions. Signed-off-by: Christophe Vu-Brugier <cvubrugier@fastmail.fm> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Diffstat (limited to 'package/targetcli-fb/S50target')
-rwxr-xr-xpackage/targetcli-fb/S50target46
1 files changed, 46 insertions, 0 deletions
diff --git a/package/targetcli-fb/S50target b/package/targetcli-fb/S50target
new file mode 100755
index 000000000..88290e4f7
--- /dev/null
+++ b/package/targetcli-fb/S50target
@@ -0,0 +1,46 @@
+#!/bin/sh
+#
+# Restore / clear the Linux "SCSI target" driver configuration with `targetctl`
+#
+
+start() {
+ local ret
+
+ echo -n "Restoring target configuration: "
+ /usr/bin/targetctl restore >/dev/null 2>&1
+ ret=$?
+ echo "done"
+
+ return $ret
+}
+
+stop() {
+ local ret
+
+ echo -n "Clearing target configuration: "
+ /usr/bin/targetctl clear >/dev/null 2>&1
+ ret=$?
+ echo "done"
+
+ return $ret
+}
+
+restart() {
+ stop
+ start
+}
+
+case "$1" in
+ start)
+ start
+ ;;
+ stop)
+ stop
+ ;;
+ restart)
+ restart
+ ;;
+ *)
+ echo "Usage: $0 {start|stop|restart}"
+ exit 1
+esac