fetch: use glob expansion instead of find, for speed

This commit is contained in:
Lucas 2021-07-31 21:30:07 +00:00
parent f9f951867c
commit 09bfd184a2

View File

@ -1,6 +1,6 @@
#!/bin/sh
# fetch
# Written in 2019-2020 by Lucas
# Written in 2019-2021 by Lucas
# CC0 1.0 Universal/Public domain - No rights reserved
#
# To the extent possible under law, the author(s) have dedicated all
@ -25,11 +25,6 @@ fetch_cmd()
fi
}
find_dir()
{
find "$ARCHIVE_BASEDIR" -type d -name "$1"
}
torsocks=torsocks
while getopts T flag; do
case $flag in
@ -58,7 +53,7 @@ for url; do
if grep -q "^$url\$" "$everything"; then
printf "%s: already fetched %s\n" "${0##*/}" "$url" >&2
printf "%s/file\n" "$(find_dir "$sha")"
printf "%s\n" "$ARCHIVE_BASEDIR"/*/*/*/"$sha"/file
continue
fi