Commit f16ead51 authored by Bernard Spil's avatar Bernard Spil Committed by Nirbhay Choubey

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 =
parent 665045f9
...@@ -154,9 +154,8 @@ readonly WSREP_SST_OPT_AUTH ...@@ -154,9 +154,8 @@ readonly WSREP_SST_OPT_AUTH
# Splitting AUTH into potential user:password pair # Splitting AUTH into potential user:password pair
if ! wsrep_auth_not_set if ! wsrep_auth_not_set
then then
readonly AUTH_VEC=(${WSREP_SST_OPT_AUTH//:/ }) WSREP_SST_OPT_USER="${WSREP_SST_OPT_AUTH%%:*}"
WSREP_SST_OPT_USER="${AUTH_VEC[0]:-}" WSREP_SST_OPT_PSWD="${WSREP_SST_OPT_AUTH##*:}"
WSREP_SST_OPT_PSWD="${AUTH_VEC[1]:-}"
fi fi
readonly WSREP_SST_OPT_USER readonly WSREP_SST_OPT_USER
readonly WSREP_SST_OPT_PSWD readonly WSREP_SST_OPT_PSWD
......
#!/bin/bash -ue #!/bin/sh -ue
# Copyright (C) 2010-2014 Codership Oy # Copyright (C) 2010-2014 Codership Oy
# #
...@@ -23,7 +23,7 @@ RSYNC_CONF= # rsync configuration file ...@@ -23,7 +23,7 @@ RSYNC_CONF= # rsync configuration file
RSYNC_REAL_PID= # rsync process id RSYNC_REAL_PID= # rsync process id
OS=$(uname) OS=$(uname)
[ "$OS" == "Darwin" ] && export -n LD_LIBRARY_PATH [ "$OS" = "Darwin" ] && export -n LD_LIBRARY_PATH
# Setting the path for lsof on CentOS # Setting the path for lsof on CentOS
export PATH="/usr/sbin:/sbin:$PATH" export PATH="/usr/sbin:/sbin:$PATH"
...@@ -144,8 +144,8 @@ fi ...@@ -144,8 +144,8 @@ fi
# --exclude '*.[0-9][0-9][0-9][0-9][0-9][0-9]' --exclude '*.index') # --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 # New filter - exclude everything except dirs (schemas) and innodb files
FILTER=(-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes' FILTER="-f '- /lost+found' -f '- /.fseventsd' -f '- /.Trashes'
-f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*') -f '+ /wsrep_sst_binlog.tar' -f '+ /ib_lru_dump' -f '+ /ibdata*' -f '+ /*/' -f '- /*'"
if [ "$WSREP_SST_OPT_ROLE" = "donor" ] if [ "$WSREP_SST_OPT_ROLE" = "donor" ]
then then
...@@ -211,7 +211,7 @@ then ...@@ -211,7 +211,7 @@ then
RC=0 RC=0
rsync --owner --group --perms --links --specials \ rsync --owner --group --perms --links --specials \
--ignore-times --inplace --dirs --delete --quiet \ --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=$? rsync://$WSREP_SST_OPT_ADDR >&2 || RC=$?
if [ "$RC" -ne 0 ]; then if [ "$RC" -ne 0 ]; then
...@@ -246,8 +246,8 @@ then ...@@ -246,8 +246,8 @@ then
pushd "$WSREP_SST_OPT_DATA" >/dev/null pushd "$WSREP_SST_OPT_DATA" >/dev/null
count=1 count=1
[ "$OS" == "Linux" ] && count=$(grep -c processor /proc/cpuinfo) [ "$OS" = "Linux" ] && count=$(grep -c processor /proc/cpuinfo)
[ "$OS" == "Darwin" -o "$OS" == "FreeBSD" ] && count=$(sysctl -n hw.ncpu) [ "$OS" = "Darwin" -o "$OS" = "FreeBSD" ] && count=$(sysctl -n hw.ncpu)
find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" -print0 | \ find . -maxdepth 1 -mindepth 1 -type d -not -name "lost+found" -print0 | \
xargs -I{} -0 -P $count \ xargs -I{} -0 -P $count \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment