From dcaa685d9606c1f471e00f5fe866d21271593e29 Mon Sep 17 00:00:00 2001 From: "Jose A. Rivera" Date: Fri, 5 Jun 2015 09:20:59 -0500 Subject: [PATCH] ctdb: Change use of 'which' to 'type' in scripts. While 'which' is a very common tool, on many distros it is not a requirement that it be installed. 'type' is a shell built-in specified by the Open Group, and is found in shells like bash, dash, and ksh across multiple OSes. Signed-off-by: Jose A. Rivera --- ctdb/config/events.d/00.ctdb | 4 ++-- ctdb/config/events.d/60.ganesha | 2 +- ctdb/config/functions | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ctdb/config/events.d/00.ctdb b/ctdb/config/events.d/00.ctdb index 21ca77b..0e25e50 100755 --- a/ctdb/config/events.d/00.ctdb +++ b/ctdb/config/events.d/00.ctdb @@ -17,8 +17,8 @@ select_tdb_checker () { # Find the best TDB consistency check available. use_tdb_tool_check=false - which tdbtool >/dev/null 2>&1 && found_tdbtool=true - which tdbdump >/dev/null 2>&1 && found_tdbdump=true + type tdbtool >/dev/null 2>&1 && found_tdbtool=true + type tdbdump >/dev/null 2>&1 && found_tdbdump=true if $found_tdbtool && echo "help" | tdbtool | grep -q check ; then use_tdb_tool_check=true diff --git a/ctdb/config/events.d/60.ganesha b/ctdb/config/events.d/60.ganesha index fc17098..cd735be 100755 --- a/ctdb/config/events.d/60.ganesha +++ b/ctdb/config/events.d/60.ganesha @@ -229,7 +229,7 @@ case "$1" in # For platforms where rpc.statd does not exist, we skip # the check completely p="rpc.statd" - which $p >/dev/null 2>/dev/null && \ + type $p >/dev/null 2>/dev/null && \ nfs_check_rpc_service "statd" \ % 10 "verbose restart:b unhealthy" \ -ge 6 "verbose unhealthy" \ diff --git a/ctdb/config/functions b/ctdb/config/functions index 340b1e5..ec69583 100755 --- a/ctdb/config/functions +++ b/ctdb/config/functions @@ -337,7 +337,7 @@ _nfs_check_rpc_common () # Some platforms don't have separate programs for all services. case "$_prog_name" in statd) - which "rpc.${_prog_name}" >/dev/null 2>&1 || return 0 + type "rpc.${_prog_name}" >/dev/null 2>&1 || return 0 esac case "$_prog_name" in @@ -1430,7 +1430,7 @@ iptables_wrapper () } # AIX (and perhaps others?) doesn't have mktemp -if ! which mktemp >/dev/null 2>&1 ; then +if ! type mktemp >/dev/null 2>&1 ; then mktemp () { _dir=false -- 2.4.2