From 6d83559ea42644ed39e21c76cef8a1974f3dcab0 Mon Sep 17 00:00:00 2001 From: Joe Julian Date: Tue, 8 Sep 2015 09:53:54 -0700 Subject: common-ha: distribution neutral location of config files work on systems with config files in directories other than /etc/sysconfig. BUG: 1251821 Change-Id: I009946623b508ba422a4881913455218d8846055 Signed-off-by: Joe Julian Reviewed-on: http://review.gluster.org/12132 Tested-by: NetBSD Build System Tested-by: Gluster Build System Reviewed-by: soumya k Reviewed-by: Kaleb KEITHLEY Reviewed-on: http://review.gluster.org/13723 Tested-by: Kaleb KEITHLEY Smoke: Gluster Build System NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- extras/ganesha/scripts/create-export-ganesha.sh | 26 ++++++++++++++++--------- extras/ganesha/scripts/dbus-send.sh | 23 +++++++++++++++------- extras/ganesha/scripts/ganesha-ha.sh | 23 +++++++++++++++------- 3 files changed, 49 insertions(+), 23 deletions(-) (limited to 'extras/ganesha') diff --git a/extras/ganesha/scripts/create-export-ganesha.sh b/extras/ganesha/scripts/create-export-ganesha.sh index ab7c282af79..bd884b4c4a8 100755 --- a/extras/ganesha/scripts/create-export-ganesha.sh +++ b/extras/ganesha/scripts/create-export-ganesha.sh @@ -5,10 +5,24 @@ #An export file specific to a volume #is created in GANESHA_DIR/exports. +# Try loading the config from any of the distro +# specific configuration locations +if [ -f /etc/sysconfig/ganesha ] + then + . /etc/sysconfig/ganesha +fi +if [ -f /etc/conf.d/ganesha ] + then + . /etc/conf.d/ganesha +fi +if [ -f /etc/default/ganesha ] + then + . /etc/default/ganesha +fi + GANESHA_DIR=${1%/} VOL=$2 CONF= -CONFFILE= function check_cmd_status() { @@ -42,14 +56,8 @@ function find_rhel7_conf done } -cfgline=$(grep ^CONFFILE= /etc/sysconfig/ganesha) -eval $(echo ${cfgline} | grep -F ^CONFFILE=) - -if [ -z $CONFFILE ] - then - cfgline=$(grep ^OPTIONS= /etc/sysconfig/ganesha) - eval $(echo ${cfgline} | grep -F ^OPTIONS=) - find_rhel7_conf $cfgline +if [ -z $CONFFILE ]; then + find_rhel7_conf $OPTIONS fi CONF=${CONFFILE:-/etc/ganesha/ganesha.conf} diff --git a/extras/ganesha/scripts/dbus-send.sh b/extras/ganesha/scripts/dbus-send.sh index 5f268eb37c2..45644fd6f71 100755 --- a/extras/ganesha/scripts/dbus-send.sh +++ b/extras/ganesha/scripts/dbus-send.sh @@ -1,11 +1,25 @@ #/bin/bash +# Try loading the config from any of the distro +# specific configuration locations +if [ -f /etc/sysconfig/ganesha ] + then + . /etc/sysconfig/ganesha +fi +if [ -f /etc/conf.d/ganesha ] + then + . /etc/conf.d/ganesha +fi +if [ -f /etc/default/ganesha ] + then + . /etc/default/ganesha +fi + declare -i EXPORT_ID GANESHA_DIR=${1%/} OPTION=$2 VOL=$3 CONF= -CONFFILE= function find_rhel7_conf { @@ -24,14 +38,9 @@ function find_rhel7_conf done } -cfgline=$(grep ^CONFFILE= /etc/sysconfig/ganesha) -eval $(echo ${cfgline} | grep -F ^CONFFILE=) - if [ -z $CONFFILE ] then - cfgline=$(grep ^OPTIONS= /etc/sysconfig/ganesha) - eval $(echo ${cfgline} | grep -F ^OPTIONS=) - find_rhel7_conf $cfgline + find_rhel7_conf $OPTIONS fi diff --git a/extras/ganesha/scripts/ganesha-ha.sh b/extras/ganesha/scripts/ganesha-ha.sh index 533056b3f24..308ffabf7f2 100644 --- a/extras/ganesha/scripts/ganesha-ha.sh +++ b/extras/ganesha/scripts/ganesha-ha.sh @@ -30,8 +30,22 @@ SERVICE_MAN="DISTRO_NOT_FOUND" RHEL6_PCS_CNAME_OPTION="--name" SECRET_PEM="/var/lib/glusterd/nfs/secret.pem" +# Try loading the config from any of the distro +# specific configuration locations +if [ -f /etc/sysconfig/ganesha ] + then + . /etc/sysconfig/ganesha +fi +if [ -f /etc/conf.d/ganesha ] + then + . /etc/conf.d/ganesha +fi +if [ -f /etc/default/ganesha ] + then + . /etc/default/ganesha +fi + GANESHA_CONF= -CONFFILE= function find_rhel7_conf { @@ -50,14 +64,9 @@ function find_rhel7_conf done } -cfgline=$(grep ^CONFFILE= /etc/sysconfig/ganesha) -eval $(echo ${cfgline} | grep -F ^CONFFILE=) - if [ -z $CONFFILE ] then - cfgline=$(grep ^OPTIONS= /etc/sysconfig/ganesha) - eval $(echo ${cfgline} | grep -F ^OPTIONS=) - find_rhel7_conf $cfgline + find_rhel7_conf $OPTIONS fi -- cgit