Skip to content

Commit

Permalink
Add maillist archiver
Browse files Browse the repository at this point in the history
  • Loading branch information
contrun committed Jul 18, 2024
1 parent d1b929f commit 99a2a1c
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions dot_bin/executable_maillist-archiver.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#!/usr/bin/env bash
set -euo pipefail

usage() {
echo "$0 -u MAILMAN_URL"
}

MAILMAN_URL=
while getopts "u:" opt; do
case $opt in
u)
MAILMAN_URL="$OPTARG"
;;
\?)
echo "Invalid option: -$OPTARG" >&2
usage
exit 1
;;
esac
done

if [[ -z "$MAILMAN_URL" ]]; then
usage
exit 1
fi

wget -O- -q "$MAILMAN_URL" | grep -E -o 'href="[^"]+\.txt(\.gz)?"' | cut -f2 -d\" | while read -r filename; do
wget "$MAILMAN_URL/$filename"
if [[ "$filename" == *.gz ]]; then
gunzip "$filename"
fi
done

0 comments on commit 99a2a1c

Please sign in to comment.