[ofa-general] [PATCH] opensm/scripts: make configurable scripts

Sasha Khapyorsky sashak at voltaire.com
Sun Feb 24 10:25:20 PST 2008


Make configurable opensm.init, redhat-opensm.init, opensmd and sldd.sh
scripts.

Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
 opensm/scripts/opensm.init.in        |    5 ++++-
 opensm/scripts/opensmd.in            |   21 ++++++++++++---------
 opensm/scripts/redhat-opensm.init.in |   14 +++++++++-----
 opensm/scripts/sldd.sh.in            |    9 ++++++---
 4 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/opensm/scripts/opensm.init.in b/opensm/scripts/opensm.init.in
index d717279..da23b36 100644
--- a/opensm/scripts/opensm.init.in
+++ b/opensm/scripts/opensm.init.in
@@ -38,6 +38,9 @@
 # notice, one of the license notices in the documentation
 # and/or other materials provided with the distribution.
 
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+
 # Source function library.
 if [[ -s /etc/init.d/functions ]]; then
     . /etc/init.d/functions
@@ -55,7 +58,7 @@ fi
 
 start () {
     echo -n "Starting opensm: "
-    /usr/sbin/opensm -B $OPTIONS > /dev/null
+    @sbindir@/opensm -B $OPTIONS > /dev/null
     if [[ $RETVAL -eq 0 ]]; then
         touch /var/lock/subsys/opensm
         success
diff --git a/opensm/scripts/opensmd.in b/opensm/scripts/opensmd.in
index 848d1cd..0b150f7 100755
--- a/opensm/scripts/opensmd.in
+++ b/opensm/scripts/opensmd.in
@@ -27,23 +27,26 @@
 # and/or other materials provided with the distribution.
 #
 #
-# processname: /usr/sbin/opensm
-# config: /etc/opensm.conf
+# processname: @sbindir@/opensm
+# config: @sysconfig@/opensm.conf
 # pidfile: /var/run/opensm.pid
 
-if [ ! -f /etc/opensm.conf ]; then
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+
+CONFIG=@sysconfdir@/ofa/opensm.conf
+
+if [ ! -f @CONFIG@ ]; then
     exit 0
 fi
 
-. /etc/opensm.conf
-
-CONFIG=/etc/opensm.conf
+. @COFNIG
 
-prog=/usr/sbin/opensm
+prog=@sbindir@/opensm
 bin=${prog##*/}
 
 # Handover daemon for updating guid2lid cache file
-sldd_prog=/usr/sbin/sldd.sh
+sldd_prog=@sbindir@/sldd.sh
 sldd_bin=${sldd_prog##*/}
 sldd_pid_file=/var/run/sldd.pid
 
@@ -122,7 +125,7 @@ else
     TIMEOUT_FLAG="-t ${TIMEOUT}"
 fi
 
-if [[ -z $OSM_LOG || "$OSM_LOG" == "/var/log/osm.log" ]]; then
+if [[ -z $OSM_LOG || "$OSM_LOG" == "/var/log/opensm.log" ]]; then
     OSM_LOG_FLAG=""
 else
     OSM_LOG_FLAG="-f ${OSM_LOG}"
diff --git a/opensm/scripts/redhat-opensm.init.in b/opensm/scripts/redhat-opensm.init.in
index 3e00403..4ce6605 100755
--- a/opensm/scripts/redhat-opensm.init.in
+++ b/opensm/scripts/redhat-opensm.init.in
@@ -37,23 +37,27 @@
 #
 #  $Id: openib-1.0-opensm.init,v 1.5 2006/08/02 18:18:23 dledford Exp $
 #
-# processname: /usr/sbin/opensm
-# config: /etc/ofa/opensm.conf
+# processname: @sbindir@/opensm
+# config: @sysconfdir@/ofa/opensm.conf
 # pidfile: /var/run/opensm.pid
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+
 . /etc/rc.d/init.d/functions
 
-CONFIG=/etc/ofa/opensm.conf
+CONFIG=@sysconfdir@/ofa/opensm.conf
 if [ ! -f $CONFIG ]; then
     exit 0
 fi
 
 . $CONFIG
 
-prog=/usr/sbin/opensm
+prog=@sbindir@/opensm
 bin=${prog##*/}
 
 # Handover daemon for updating guid2lid cache file
-sldd_prog=/usr/sbin/sldd.sh
+sldd_prog=@sbindir@/sldd.sh
 sldd_bin=${sldd_prog##*/}
 sldd_pid_file=/var/run/sldd.pid
 
diff --git a/opensm/scripts/sldd.sh.in b/opensm/scripts/sldd.sh.in
index 21f6126..a6f660f 100755
--- a/opensm/scripts/sldd.sh.in
+++ b/opensm/scripts/sldd.sh.in
@@ -38,10 +38,13 @@
 # the semi-static LID assignment table from the master SM to all standby SMs.
 # A standby SM, becoming a master . needs to obey the copied semi static LID assignment table.
 
-# config: /etc/opensm.conf
+prefix=@prefix@
+exec_prefix=@exec_prefix@
 
-[ -f /etc/sysconfig/opensm.conf ] && CONFIG=/etc/sysconfig/opensm.conf
-[ -f /etc/ofa/opensm.conf ] && CONFIG=/etc/ofa/opensm.conf
+# config: @sysconfdir@/ofa/opensm.conf
+
+[ -f @sysconfdir@/sysconfig/opensm.conf ] && CONFIG=@sysconfdir@/sysconfig/opensm.conf
+[ -f @sysconfdir@/ofa/opensm.conf ] && CONFIG=@sysconfdir@/ofa/opensm.conf
 
 SLDD_DEBUG=${SLDD_DEBUG:-0}
 
-- 
1.5.4.1.122.gaa8d




More information about the general mailing list