1
0
mirror of https://github.com/samba-team/samba.git synced 2025-02-07 01:58:28 +03:00

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 <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
This commit is contained in:
Martin Schwenke 2022-07-21 14:22:25 +10:00 committed by Amitay Isaacs
parent db37043bc5
commit b20ccaa36d

View File

@ -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" ] || \