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

Gitweb:        http://git.fedorahosted.org/git/gfs1-utils.git?p=gfs1-utils.git;a=commitdiff;h=b0de7167264f3a061550c817504e869351e4ba75
Commit:        b0de7167264f3a061550c817504e869351e4ba75
Parent:        550676720582ed686d56e0812830ad039f490e11
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:21:52 2009 +0100

gfs: 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>
---
 gfs/init.d/Makefile |    1 +
 gfs/init.d/gfs.in   |   39 +++++++++++++++++++--------------------
 2 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/gfs/init.d/Makefile b/gfs/init.d/Makefile
index 2ad74ac..097d83c 100644
--- a/gfs/init.d/Makefile
+++ b/gfs/init.d/Makefile
@@ -11,6 +11,7 @@ include $(OBJDIR)/make/uninstall.mk
 
 $(TARGET): $(S)/$(TARGET).in
 	cat $(S)/$(TARGET).in | sed \
+		-e 's#@SBINDIR@#${sbindir}#g' \
 		-e 's#@INITDDIR@#${initddir}#g' \
 	> $(TARGET)
 
diff --git a/gfs/init.d/gfs.in b/gfs/init.d/gfs.in
index c3bf59a..a233148 100644
--- a/gfs/init.d/gfs.in
+++ b/gfs/init.d/gfs.in
@@ -15,14 +15,25 @@
 # Description:		mount/unmount gfs 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/gfs ] && . /etc/sysconfig/gfs
 	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/subsys/gfs"
-	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/gfs ] && . /etc/default/gfs
 	[ -z "$LOCK_FILE" ] && LOCK_FILE="/var/lock/gfs"
-	success=local_success
-	failure=local_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 gfs
 			rtrn=$?
 			if [ $rtrn = 0 ]; then
-				$success
+				success
 				echo
 			else
-				$failure
+				failure
 				echo
 			fi
 
@@ -94,10 +93,10 @@ case "$1" in
 				umount -l -a -t gfs
 				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:22 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:22 gfs1-utils: master - gfs: 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).