diff options
author | Sergei Golubchik <serg@mariadb.org> | 2017-10-10 22:47:18 +0200 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2018-02-12 12:46:34 +0100 |
commit | 355ee6877beccf27bcd07d845c985fc1a2845aca (patch) | |
tree | 121d859feb21130dbe22ac8e4ec976d6999baff4 /scripts/mysqld_safe.sh | |
parent | 2232784f0094ae7e81f5033fe8f3499e15224fed (diff) | |
download | mariadb-git-355ee6877beccf27bcd07d845c985fc1a2845aca.tar.gz |
MDEV-13946 Server RPMs have dependency on "which"
cleanup. use "command -v" instead of "which"
simplify some checks.
Diffstat (limited to 'scripts/mysqld_safe.sh')
-rw-r--r-- | scripts/mysqld_safe.sh | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/scripts/mysqld_safe.sh b/scripts/mysqld_safe.sh index c0be1ea6e60..5797bdc68d7 100644 --- a/scripts/mysqld_safe.sh +++ b/scripts/mysqld_safe.sh @@ -103,35 +103,6 @@ EOF exit 1 } -my_which () -{ - save_ifs="${IFS-UNSET}" - IFS=: - ret=0 - for file - do - for dir in $PATH - do - if [ -f "$dir/$file" ] - then - echo "$dir/$file" - continue 2 - fi - done - - ret=1 #signal an error - break - done - - if [ "$save_ifs" = UNSET ] - then - unset IFS - else - IFS="$save_ifs" - fi - return $ret # Success -} - find_in_bin() { if test -x "$MY_BASEDIR_VERSION/bin/$1" then @@ -220,7 +191,8 @@ wsrep_pick_url() { log_error "WSREP: 'wsrep_urls' is DEPRECATED! Use wsrep_cluster_address to specify multiple addresses instead." - if ! which nc >/dev/null; then + if ! command -v nc >/dev/null + then log_error "ERROR: nc tool not found in PATH! Make sure you have it installed." return 1 fi @@ -646,8 +618,7 @@ plugin_dir="${plugin_dir}${PLUGIN_VARIANT}" # Ensure that 'logger' exists, if it's requested if [ $want_syslog -eq 1 ] then - my_which logger > /dev/null 2>&1 - if [ $? -ne 0 ] + if ! command -v logger > /dev/null then log_error "--syslog requested, but no 'logger' program found. Please ensure that 'logger' is in your PATH, or do not specify the --syslog option to mysqld_safe." exit 1 @@ -878,7 +849,7 @@ fi if @TARGET_LINUX@ && test $flush_caches -eq 1 then # Locate sync, ensure it exists. - if ! my_which sync > /dev/null 2>&1 + if ! command -v sync > /dev/null then log_error "sync command not found, required for --flush-caches" exit 1 @@ -890,7 +861,7 @@ then fi # Locate sysctl, ensure it exists. - if ! my_which sysctl > /dev/null 2>&1 + if ! command -v sysctl > /dev/null then log_error "sysctl command not found, required for --flush-caches" exit 1 @@ -934,7 +905,7 @@ cmd="`mysqld_ld_preload_text`$NOHUP_NICENESS" if @TARGET_LINUX@ && test $numa_interleave -eq 1 then # Locate numactl, ensure it exists. - if ! my_which numactl > /dev/null 2>&1 + if ! command -v numactl > /dev/null then log_error "numactl command not found, required for --numa-interleave" exit 1 |