From: Martin Schwenke Date: Thu, 21 Jul 2022 04:22:25 +0000 (+1000) Subject: ctdb-scripts: Use "git config" as last resort to parse nfs.conf X-Git-Tag: tevent-0.13.0~42 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=b20ccaa36da23c8ee84b117b2e82e98bd2be4fcc;p=thirdparty%2Fsamba.git ctdb-scripts: Use "git config" as last resort to parse nfs.conf Some versions of nfs-utils (e.g. recent CentOS 7) use /etc/nfs.conf but do not include the nfsconf utility to extract values from the file. However, git has an excellent conf file parser, so use it as a last resort. Signed-off-by: Martin Schwenke Reviewed-by: Amitay Isaacs --- diff --git a/ctdb/config/statd-callout b/ctdb/config/statd-callout index 83fb92eccf0..38c155e4793 100755 --- a/ctdb/config/statd-callout +++ b/ctdb/config/statd-callout @@ -32,8 +32,13 @@ die () load_system_config "nfs" "nfs-common" # If NFS_HOSTNAME not set then try to pull it out of /etc/nfs.conf -if [ -z "$NFS_HOSTNAME" ] && type nfsconf >/dev/null 2>&1 ; then - NFS_HOSTNAME=$(nfsconf --get statd name) +if [ -z "$NFS_HOSTNAME" ]; then + if type nfsconf >/dev/null 2>&1; then + NFS_HOSTNAME=$(nfsconf --get statd name) + elif type git >/dev/null 2>&1; then + # git to the rescue! + NFS_HOSTNAME=$(git config --file=/etc/nfs.conf statd.name) + fi fi [ -n "$NFS_HOSTNAME" ] || \