public inbox for cluster-cvs@sourceware.org
help / color / mirror / Atom feed
* gfs2-utils: master - gfs2: improve init script
@ 2009-01-09 13:13 Fabio M. Di Nitto
  0 siblings, 0 replies; only message in thread
From: Fabio M. Di Nitto @ 2009-01-09 13:13 UTC (permalink / raw)
  To: cluster-cvs-relay

Gitweb:        http://git.fedorahosted.org/git/gfs2-utils.git?p=gfs2-utils.git;a=commitdiff;h=b908c9f2a3d5d9e4663badb25c2184d49ae0cd1c
Commit:        b908c9f2a3d5d9e4663badb25c2184d49ae0cd1c
Parent:        b256d3972d008b4511d12bccb3da4c87e087462d
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:57 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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2009-01-09 13:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-01-09 13:13 gfs2-utils: master - gfs2: improve init script Fabio M. Di Nitto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).