From: Andrew Tridgell Date: Sun, 3 Jun 2007 12:07:07 +0000 (+1000) Subject: make the init scripts more portable about location of system config files X-Git-Tag: tevent-0.9.20~348^2~2582 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=e763874872a65f5d70fe80b0cc2fa87baa826041;p=thirdparty%2Fsamba.git make the init scripts more portable about location of system config files (This used to be ctdb commit 65f3e2bc722e314b2c51c3bfdc544b408a8a64cf) --- diff --git a/ctdb/config/ctdb.init b/ctdb/config/ctdb.init index ad7bd705312..35a1d3d34cb 100755 --- a/ctdb/config/ctdb.init +++ b/ctdb/config/ctdb.init @@ -34,19 +34,15 @@ fi # 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 diff --git a/ctdb/config/events b/ctdb/config/events index 854b2ac7711..58af6a85862 100755 --- a/ctdb/config/events +++ b/ctdb/config/events @@ -2,8 +2,8 @@ ############################ # main event script for ctdb -. /etc/sysconfig/ctdb . /etc/ctdb/functions +loadconfig ctdb cmd="$1" shift diff --git a/ctdb/config/events.d/nfs b/ctdb/config/events.d/nfs index b9b5a403da1..965199661f3 100644 --- a/ctdb/config/events.d/nfs +++ b/ctdb/config/events.d/nfs @@ -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 diff --git a/ctdb/config/events.d/nfslock b/ctdb/config/events.d/nfslock index da857ce97c9..72279b27974 100644 --- a/ctdb/config/events.d/nfslock +++ b/ctdb/config/events.d/nfslock @@ -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 diff --git a/ctdb/config/events.d/samba b/ctdb/config/events.d/samba index 5d08213adab..f17f7eac986 100644 --- a/ctdb/config/events.d/samba +++ b/ctdb/config/events.d/samba @@ -3,8 +3,8 @@ PATH=/bin:/usr/bin:$PATH -. /etc/sysconfig/ctdb . /etc/ctdb/functions +loadconfig ctdb cmd="$1" shift diff --git a/ctdb/config/functions b/ctdb/config/functions index 4eb8f4a3d62..f557d629107 100644 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -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 diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout index da169575a65..3f645ec732e 100755 --- a/ctdb/config/statd-callout +++ b/ctdb/config/statd-callout @@ -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