Skip to content

Commit

Permalink
Remove dependency on gzcat
Browse files Browse the repository at this point in the history
  • Loading branch information
infostreams committed Jun 19, 2019
1 parent 7d3abb2 commit 5e867bc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/db-load
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ if [ "$#" -gt 3 ]; then
shift 1
echo "${colored_alias}Start restoring tables matching $1${COLOR_NC}"
extract="${bin}/drivers/mysql/vendor/extract_sql/extract_sql.pl"
tables=$(gzcat "${file}" | ${extract} --listTables | grep -e "$1")
tables=$(gunzip -c "${file}" | ${extract} --listTables | grep -e "$1")
fi

for table in $tables; do
Expand Down
2 changes: 1 addition & 1 deletion bin/db-save
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ echo "${colored_alias}"
code=$?

# calculate hash of this dump
hash=$(gzcat "${file}" | grep -v "^--" | grep -v "^/\*" | grep -v "^$" | shasum -a 512224 | cut -d " " -f 1)
hash=$(gunzip -c "${file}" | grep -v "^--" | grep -v "^/\*" | grep -v "^$" | shasum -a 512224 | cut -d " " -f 1)

# check if we already have a dump with that hash
count=$(find "${dumps}" -type f 2>/dev/null | grep -c "${hash}" | sed -e 's/^[[:space:]]*//')
Expand Down
4 changes: 2 additions & 2 deletions bin/db-structure
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ find_snapshot_from_any_server "${snapshot}"

if [ -f "${file}" ]; then
extract="${bin}/drivers/mysql/vendor/extract_sql/extract_sql.pl"
tables=$(gzcat "${file}" | ${extract} --listTables)
tables=$(gunzip -c "${file}" | ${extract} --listTables)

for table in $tables
do
gzcat "${file}" | ${extract} -t "${table}" | grep -v "^--" | grep -v "^/\*" | grep -v "^$" | grep -v "INSERT INTO" | grep -v "^LOCK TABLES" | grep -v "^UNLOCK TABLES" | grep -v "^DROP"
gunzip -c "${file}" | ${extract} -t "${table}" | grep -v "^--" | grep -v "^/\*" | grep -v "^$" | grep -v "INSERT INTO" | grep -v "^LOCK TABLES" | grep -v "^UNLOCK TABLES" | grep -v "^DROP"
done
exit 0
else
Expand Down

0 comments on commit 5e867bc

Please sign in to comment.