File 0017-rc.target.suse-Clean-up-startup-sequence.patch of Package lio-utils.216

From 5c83b244ea0c767ed9aa2a10406cf7b34e6bfff7 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
Date: Fri, 1 Feb 2013 14:29:12 +0100
Subject: rc.target.suse: Clean up startup sequence

Instead of sourcing all file in /etc/target we only should be
looking at files with '.sh' suffix. This eases the task of
creating backup files and makes startup logic easier.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 scripts/rc.target.suse | 33 ++++++---------------------------
 1 file changed, 6 insertions(+), 27 deletions(-)

diff --git a/scripts/rc.target.suse b/scripts/rc.target.suse
index c812430..423c30a 100644
--- a/scripts/rc.target.suse
+++ b/scripts/rc.target.suse
@@ -101,43 +101,22 @@ function tcm_check() {
 }
 
 function run_fabric_cfs_ops() {
-	for i in $( ls $CONFIGFS_SCRIPT_DIR); do
+	for i in $CONFIGFS_SCRIPT_DIR/*.sh; do
 
-		CONFIGFS_SCRIPT_PATH="$CONFIGFS_SCRIPT_DIR/$i"
-		if [ ! -f $CONFIGFS_SCRIPT_PATH ]; then
+		if [ ! -f $i ]; then
 			continue
 		fi
 		# target core is handled in run_tcm_cfs_ops()
-		if [ $i == "tcm_start.sh" ]; then
+		if [ ${i##*/} == "tcm_start.sh" ]; then
 			continue
 		fi
 		# iscsi-target fabric module is handled in run_lio_target_cfs_ops()
-		if [ $i == "lio_start.sh" ]; then
-			continue
-		fi
-		# Skip RPM package save+orig+new
-		if [[ $i =~ ".rpmsave" ]]; then
-			continue
-		fi
-
-		if [[ $i =~ ".rpmorig" ]]; then
-			continue
-		fi
-
-		if [[ $i =~ ".rpmnew" ]]; then
-			continue
-		fi
-		# Skip dpkg dist
-                if [[ $i =~ ".dpkg-dist" ]]; then
-                        continue
-                fi
-		# Skip emacs state files
-		if [[ $i =~ ~$ ]]; then
+		if [ ${i##*/} == "lio_start.sh" ]; then
 			continue
 		fi
 
-		echo -n $"Calling ConfigFS script $CONFIGFS_SCRIPT_PATH: "
-		sh ${CONFIGFS_SCRIPT_PATH} > /dev/null 2>&1
+		echo -n $"Calling ConfigFS script $i: "
+		sh $i > /dev/null 2>&1
 		if [ $RET != 0 ]; then
 		    rc_failed 1
 		fi
-- 
1.8.1.4

openSUSE Build Service is sponsored by