summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/bisect-database-dumps15
1 files changed, 9 insertions, 6 deletions
diff --git a/bin/bisect-database-dumps b/bin/bisect-database-dumps
index d788d1f..f92e835 100755
--- a/bin/bisect-database-dumps
+++ b/bin/bisect-database-dumps
@@ -3,8 +3,11 @@
# bisect through the database dumps to see when a specific thing
# appeared first
+expr="$1"
+shift
+
dumps=$(
- find '/data/backup/mysql' -mindepth 1 -maxdepth 1 -name 'database-*.xz' -exec ls -tr {} + \
+ find '/data/backup/mysql' -mindepth 1 -maxdepth 1 -name 'database-*.xz' "$@" -exec ls -tr {} + \
| sort
)
@@ -13,8 +16,8 @@ has=$(
tail -n1
)
-if ! xzgrep -q "$@" "${has}"; then
- >&2 printf 'cannot find "%s" in the latest dump - swapping directions\n' "$*"
+if ! xzgrep -q "${expr}" "${has}"; then
+ >&2 printf 'cannot find "%s" in the latest dump - swapping directions\n' "${expr}"
dumps=$(
printf '%s\n' "${dumps}" | \
tac
@@ -23,7 +26,7 @@ if ! xzgrep -q "$@" "${has}"; then
printf '%s\n' "$dumps" | \
tail -n1
)
- if ! xzgrep -q "$@" "${has}"; then
+ if ! xzgrep -q "${expr}" "${has}"; then
>&2 printf 'cannot find "%s" in the earliest dump either - swapping directions did not help\n' "$*"
exit 1
fi
@@ -34,7 +37,7 @@ has_not=$(
head -n1
)
-if xzgrep -q "$@" "${has_not}"; then
+if xzgrep -q "${expr}" "${has_not}"; then
>&2 printf 'first dump does also have "%s"\n' "$*"
exit 1
fi
@@ -57,7 +60,7 @@ while [ "${count}" -gt 2 ]; do
'
)
>&2 printf 'looking into "%s" ... ' "${pivot}"
- if xzgrep -q "$@" "${pivot}"; then
+ if xzgrep -q "${expr}" "${pivot}"; then
>&2 printf 'has'
has="${pivot}"
else