This is the mail archive of the cluster-cvs@sourceware.org mailing list for the cluster.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cluster: STABLE3 - gfs2: improve init script


Gitweb:        http://git.fedorahosted.org/git/cluster.git?p=cluster.git;a=commitdiff;h=8b893d039c21e63b785bf637bf22718aa2ea3de6
Commit:        8b893d039c21e63b785bf637bf22718aa2ea3de6
Parent:        95b9d0a259843b36a0e82325fdb3cf3b53226642
Author:        Fabio M. Di Nitto <fdinitto@redhat.com>
AuthorDate:    Fri Jan 9 12:09:52 2009 +0100
Committer:     Fabio M. Di Nitto <fdinitto@redhat.com>
CommitterDate: Fri Jan 9 14:12:12 2009 +0100

gfs2: improve init script

based on Marian Marinov submission for gfs2 init script,
simplify the init script distro overrides to make the script
easily readable again and also easier to write.

Set also a secure PATH.

Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
---
 gfs2/init.d/gfs2.in |   39 +++++++++++++++++++--------------------
 1 files changed, 19 insertions(+), 20 deletions(-)

diff --git a/gfs2/init.d/gfs2.in b/gfs2/init.d/gfs2.in
index 35688a0..241e3f9 100644
--- a/gfs2/init.d/gfs2.in
+++ b/gfs2/init.d/gfs2.in
@@ -15,14 +15,25 @@
 # Description:		mount/unmount gfs2 filesystems configured in /etc/fstab
 ### END INIT INFO
 
+# set secure PATH
+PATH="/bin:/usr/bin:/sbin:/usr/sbin:@SBINDIR@"
+
+success()
+{
+    echo -ne "[  OK  ]\r"
+}
+
+failure()
+{
+    echo -ne "[FAILED]\r"
+}
+
 # rpm based distros
 if [ -d /etc/sysconfig ]; then
 	[ -f @INITDDIR@/functions ] && . @INITDDIR@/functions
 	[ -f /etc/sysconfig/cluster ] && . /etc/sysconfig/cluster
 	[ -f /etc/sysconfig/gfs2 ] && . /etc/sysconfig/gfs2
 	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/gfs2"
-	success=success
-	failure=failure
 fi
 
 # deb based distros
@@ -30,20 +41,8 @@ if [ -d /etc/default ]; then
 	[ -f /etc/default/cluster ] && . /etc/default/cluster
 	[ -f /etc/default/gfs2 ] && . /etc/default/gfs2
 	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/gfs2"
-	success=success
-	failure=failure
 fi
 
-local_success()
-{
-    echo -ne "[  OK  ]\r"
-}
-
-local_failure()
-{
-    echo -ne "[FAILED]\r"
-}
-
 #
 # This script's behavior is modeled closely after the netfs script.  
 #
@@ -60,10 +59,10 @@ case "$1" in
 		rtrn=$?
 		if [ $rtrn = 0 ]; then
 			touch $LOCK_FILE
-			$success
+			success
 			echo
 		else
-			$failure
+			failure
 			echo
 		fi
 	fi
@@ -81,10 +80,10 @@ case "$1" in
 			umount -a -t gfs2
 			rtrn=$?
 			if [ $rtrn = 0 ]; then
-				$success
+				success
 				echo
 			else
-				$failure
+				failure
 				echo
 			fi
 			
@@ -94,10 +93,10 @@ case "$1" in
 				umount -l -a -t gfs2
 				rtrn=$?
 				if [ $rtrn = 0 ]; then
-					$success
+					success
 					echo
 				else
-					$failure
+					failure
 					echo
 				fi
 				break


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]