Rev 449: make the init scripts more portable about location of system config files in http://samba.org/~tridge/ctdb

tridge at samba.org tridge at samba.org
Sun Jun 3 12:07:08 GMT 2007


------------------------------------------------------------
revno: 449
revision-id: tridge at samba.org-20070603120707-py0wul4gatwvkcer
parent: tridge at samba.org-20070603105424-u3l4oixhczc2triy
committer: Andrew Tridgell <tridge at samba.org>
branch nick: tridge
timestamp: Sun 2007-06-03 22:07:07 +1000
message:
  make the init scripts more portable about location of system config files
modified:
  config/ctdb.init               ctdb.init-20070527204758-biuh7znabuwan3zn-6
  config/events                  events-20070529030121-04fjh63cxfh8v1pj-1
  config/events.d/nfs            nfs-20070601141008-hy3h4qgbk1jd2jci-1
  config/events.d/nfslock        nfslock-20070601105340-vlcvnp6euoj3zdwy-2
  config/events.d/samba          samba-20070601105340-vlcvnp6euoj3zdwy-3
  config/functions               functions-20070601105405-gajwirydr5a9zd6x-1
  config/statd-callout           statdcallout-20070531010857-6sdlz455vusye5y5-1
=== modified file 'config/ctdb.init'
--- a/config/ctdb.init	2007-06-03 09:24:52 +0000
+++ b/config/ctdb.init	2007-06-03 12:07:07 +0000
@@ -34,19 +34,15 @@
 # Avoid using root's TMPDIR
 unset TMPDIR
 
+. /etc/ctdb/functions
+loadconfig network
+loadconfig ctdb
+
 # check networking is up (for redhat)
-[ -f /etc/sysconfig/network ] && {
-    . /etc/sysconfig/network
-    [ ${NETWORKING} = "no" ] && exit 0
-}
+[ ${NETWORKING} = "no" ] && exit 0
 
 CTDB_OPTIONS=""
 
-# pull in admin specified config for ctdb
-if [ -f /etc/sysconfig/ctdb ]; then
-   . /etc/sysconfig/ctdb 
-fi
-
 [ -z "$CTDB_RECOVERY_LOCK" ] && {
     echo "You must configure the location of the CTDB_RECOVERY_LOCK"
     exit 1

=== modified file 'config/events'
--- a/config/events	2007-06-02 09:40:07 +0000
+++ b/config/events	2007-06-03 12:07:07 +0000
@@ -2,8 +2,8 @@
 ############################
 # main event script for ctdb
 
-. /etc/sysconfig/ctdb
 . /etc/ctdb/functions
+loadconfig ctdb
 
 cmd="$1"
 shift

=== modified file 'config/events.d/nfs'
--- a/config/events.d/nfs	2007-06-03 04:39:27 +0000
+++ b/config/events.d/nfs	2007-06-03 12:07:07 +0000
@@ -1,8 +1,8 @@
 #!/bin/sh
 # script to manage nfs in a clustered environment
 
-. /etc/sysconfig/nfs
 . /etc/ctdb/functions
+loadconfig nfs
 
 [ -z $CTDB_MANAGES_NFS ] && exit 0
 [ $CTDB_MANAGES_NFS != "yes" ] && exit 0

=== modified file 'config/events.d/nfslock'
--- a/config/events.d/nfslock	2007-06-03 04:39:27 +0000
+++ b/config/events.d/nfslock	2007-06-03 12:07:07 +0000
@@ -1,8 +1,8 @@
 #!/bin/sh
 # event strict to manage lockd and statd in a cluster environment
 
-. /etc/sysconfig/nfs
 . /etc/ctdb/functions
+loadconfig nfs
 
 [ -z $CTDB_MANAGES_NFS ] && exit 0
 [ $CTDB_MANAGES_NFS != "yes" ] && exit 0

=== modified file 'config/events.d/samba'
--- a/config/events.d/samba	2007-06-03 04:39:27 +0000
+++ b/config/events.d/samba	2007-06-03 12:07:07 +0000
@@ -3,8 +3,8 @@
 
 PATH=/bin:/usr/bin:$PATH
 
-. /etc/sysconfig/ctdb
 . /etc/ctdb/functions
+loadconfig ctdb
 
 cmd="$1"
 shift

=== modified file 'config/functions'
--- a/config/functions	2007-06-02 09:40:07 +0000
+++ b/config/functions	2007-06-03 12:07:07 +0000
@@ -1,5 +1,16 @@
 # utility functions for ctdb event scripts
 
+#######################################
+# pull in a system config file, if any
+loadconfig() {
+    name="$1"
+    if [ -f /etc/sysconfig/$name ]; then
+	. /etc/sysconfig/$name
+    elif [ -f /etc/default/$name ]; then
+	. /etc/default/$name
+    fi
+}
+
 
 ######################################################
 # simulate /sbin/service on platforms that don't have it

=== modified file 'config/statd-callout'
--- a/config/statd-callout	2007-06-02 09:45:06 +0000
+++ b/config/statd-callout	2007-06-03 12:07:07 +0000
@@ -5,8 +5,8 @@
 # /etc/sysconfig/nfs:
 #   STATD_HOSTNAME="myhostname -H /etc/ctdb/statd-callout"
 
-
-. /etc/sysconfig/nfs
+. /etc/ctdb/functions
+loadconfig nfs
 
 [ -z "$STATD_SHARED_DIRECTORY" ] && exit 0
 



More information about the samba-cvs mailing list