mirror of
https://github.com/redlib-org/redlib-instances.git
synced 2024-11-13 18:06:15 -05:00
lazily check if onion or i2p sites exist in instances.json before running jq.
This commit is contained in:
parent
f19da6ca8d
commit
dfba0f285b
@ -728,14 +728,18 @@ main ()
|
||||
# (a mapfile would not ideal here since a pipe is required, inducing a
|
||||
# subshell, meaning nothing will actually get added to
|
||||
# imported_nonwww)
|
||||
IFS=$'\n' imported_nonwww=($(jq -Mcer '.instances[] | select(.onion or .i2p)' "${import_nonwww_from_file}"))
|
||||
rc=$?
|
||||
|
||||
if [[ ${rc} -ne 0 ]]
|
||||
then
|
||||
echo >&2 "Failed to read onion instances from existing JSON file."
|
||||
return 1
|
||||
if grep -q ".onion" "${import_nonwww_from_file}" || grep -q ".i2p" "${import_nonwww_from_file}" ; then
|
||||
IFS=$'\n' imported_nonwww=($(jq -Mcer '.instances[] | select(.onion or .i2p)' "${import_nonwww_from_file}"))
|
||||
rc=$?
|
||||
else
|
||||
rc=0
|
||||
fi
|
||||
|
||||
if [[ ${rc} -ne 0 ]]
|
||||
then
|
||||
echo >&2 "Failed to read onion instances from existing JSON file."
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check to see if we have tor. If we don't, then we will have to import
|
||||
|
Loading…
Reference in New Issue
Block a user