Commit 0e794c6a authored by angeloudy's avatar angeloudy

Make mariabackup.sh compatible on FreeBSD

parent 7e756437
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
. $(dirname $0)/wsrep_sst_common . $(dirname $0)/wsrep_sst_common
OS=$(uname)
ealgo="" ealgo=""
ekey="" ekey=""
ekeyfile="" ekeyfile=""
...@@ -333,6 +334,7 @@ read_cnf() ...@@ -333,6 +334,7 @@ read_cnf()
rebuild=$(parse_cnf sst rebuild 0) rebuild=$(parse_cnf sst rebuild 0)
ttime=$(parse_cnf sst time 0) ttime=$(parse_cnf sst time 0)
cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$') cpat=$(parse_cnf sst cpat '.*galera\.cache$\|.*sst_in_progress$\|.*\.sst$\|.*gvwstate\.dat$\|.*grastate\.dat$\|.*\.err$\|.*\.log$\|.*RPM_UPGRADE_MARKER$\|.*RPM_UPGRADE_HISTORY$')
[[ $OS == "FreeBSD" ]] && cpat=$(parse_cnf sst cpat '.*galera\.cache$|.*sst_in_progress$|.*\.sst$|.*gvwstate\.dat$|.*grastate\.dat$|.*\.err$|.*\.log$|.*RPM_UPGRADE_MARKER$|.*RPM_UPGRADE_HISTORY$')
ealgo=$(parse_cnf xtrabackup encrypt "") ealgo=$(parse_cnf xtrabackup encrypt "")
ekey=$(parse_cnf xtrabackup encrypt-key "") ekey=$(parse_cnf xtrabackup encrypt-key "")
ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "") ekeyfile=$(parse_cnf xtrabackup encrypt-key-file "")
...@@ -533,7 +535,11 @@ wait_for_listen() ...@@ -533,7 +535,11 @@ wait_for_listen()
local MODULE=$3 local MODULE=$3
for i in {1..50} for i in {1..50}
do do
if [ "$OS" = "FreeBSD" ];then
sockstat -46lp $PORT | grep -qE "^[^ ]* *(socat|nc) *[^ ]* *[^ ]* *[^ ]* *[^ ]*:$PORT" && break
else
ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break ss -p state listening "( sport = :$PORT )" | grep -qE 'socat|nc' && break
fi
sleep 0.2 sleep 0.2
done done
echo "ready ${ADDR}/${MODULE}//$sst_ver" echo "ready ${ADDR}/${MODULE}//$sst_ver"
...@@ -926,7 +932,11 @@ then ...@@ -926,7 +932,11 @@ then
wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories" wsrep_log_info "Cleaning the existing datadir and innodb-data/log directories"
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -regex $cpat -prune -o -exec rm -rfv {} 1>&2 \+ if [ "${OS}" = "FreeBSD" ]; then
find -E $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
else
find $ib_home_dir $ib_log_dir $ib_undo_dir $DATA -mindepth 1 -prune -regex $cpat -o -exec rm -rfv {} 1>&2 \+
fi
tempdir=$(parse_cnf mysqld log-bin "") tempdir=$(parse_cnf mysqld log-bin "")
if [[ -n ${tempdir:-} ]];then if [[ -n ${tempdir:-} ]];then
......
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