diff options
author | Bernard Spil <brnrd@FreeBSD.org> | 2016-07-24 22:01:14 +0200 |
---|---|---|
committer | Nirbhay Choubey <nirbhay@mariadb.com> | 2016-11-21 15:38:33 -0500 |
commit | f16ead51fbbf03ca51db9343960785b431fab157 (patch) | |
tree | b0999f9f5ee52919ed5ab494cf3f69d24f0fed16 /scripts | |
parent | 665045f985787d77318a17ccddd67ec3ff92f7bc (diff) | |
download | mariadb-git-f16ead51fbbf03ca51db9343960785b431fab157.tar.gz |
POSIX-ify wsrep scripts
- Replace #!/bin/bash with #!/bin/sh
- Split username:password using POSIX compat %% and ##
- Don't use array for FILTERS
- Replace == tests with POSIX-compat =
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/wsrep_sst_common.sh | 5 | ||||
-rw-r--r-- | scripts/wsrep_sst_rsync.sh | 14 |
2 files changed, 9 insertions, 10 deletions
diff --git a/scripts/wsrep_sst_common.sh b/scripts/wsrep_sst_common.sh index f173a861e85..466bb46b382 100644 --- a/scripts/wsrep_sst_common.sh +++ b/scripts/wsrep_sst_common.sh @@ -154,9 +154,8 @@ readonly WSREP_SST_OPT_AUTH # Splitting AUTH into potential user:password pair if ! wsrep_auth_not_set then - readonly AUTH_VEC=(${WSREP_SST_OPT_AUTH//:/ }) - WSREP_SST_OPT_USER="${AUTH_VEC[0]:-}" - WSREP_SST_OPT_PSWD="${AUTH_VEC[1]:-}" + WSREP_SST_OPT_USER="${WSREP_SST_OPT_AUTH%%:*}" + WSREP_SST_OPT_PSWD="${WSREP_SST_OPT_AUTH##*:}" fi readonly WSREP_SST_OPT_USER readonly WSREP_SST_OPT_PSWD diff --git a/scripts/wsrep_sst_rsync.sh b/scripts/wsrep_sst_rsync.sh index bc9cbd5f4db..9b57af53603 100644 --- a/scripts/wsrep_sst_rsync.sh +++ b/scripts/wsrep_sst_rsync.sh @@ -1,4 +1,4 @@ -#!/bin/bash -ue +#!/bin/sh -ue # Copyright (C) 2010-2014 Codership Oy # @@ -23,7 +23,7 @@ RSYNC_CONF= # rsync configuration file RSYNC_REAL_PID= # rsync process id OS=$(uname) -[ "$OS" == "Darwin" ] && export -n LD_LIBRARY_PATH +[ "$OS" = "Darwin" ] && export -n LD_LIBRARY_PATH # Setting the path for lsof on CentOS export PATH="/usr/sbin:/sbin:$PATH" @@ -144,8 +144,8 @@ fi # --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') # New filter - exclude everything except dirs (schemas) and innodb files -FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' - -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*') +FILTER="-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' + -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*'" if [ "$WSREP_SST_OPT_ROLE" = "donor" ] then @@ -211,7 +211,7 @@ then RC=0 rsync --owner --group --perms --links --specials \ --ignore-times --inplace --dirs --delete --quiet \ - $WHOLE_FILE_OPT "${FILTER[@]}" "$WSREP_SST_OPT_DATA/" \ + $WHOLE_FILE_OPT "${FILTER}" "$WSREP_SST_OPT_DATA/" \ rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$? if [ "$RC" -ne 0 ]; then @@ -246,8 +246,8 @@ then pushd "$WSREP_SST_OPT_DATA" >/dev/null count=1 - [ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo) - [ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu) + [ "$OS" = "Linux" ] && count=$(grep -c processor /proc/cpuinfo) + [ "$OS" = "Darwin" -o "$OS" = "FreeBSD" ] && count=$(sysctl -n hw.ncpu) find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" -print0 | \ xargs -I{} -0 -P $count \ |