Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/bisect-database-dumps
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-01-16 23:18:53 +0100
committerErich Eckner <git@eckner.net>2020-01-16 23:19:00 +0100
commit2d1c9c9d16c9d1f6e5dba4a50d623d14c66ff899 (patch)
tree4b92c38fc6c06b77cdac7ab70e4130f0eb6974b7 /bin/bisect-database-dumps
parentcde3b3a8b64069210fdc5f74ba8facd2b8d56a3c (diff)
bin/bisect-database-dumps: make used dumps more selectable
Diffstat (limited to 'bin/bisect-database-dumps')
-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