Bugfix for install.sh
This commit is contained in:
parent
5e48b98c5c
commit
0fe38472e9
1 changed files with 7 additions and 8 deletions
15
install.sh
15
install.sh
|
|
@ -158,25 +158,24 @@ echo -e "INFO: reporter.sh has been made executable.\n"
|
||||||
|
|
||||||
# =========================== AbuseIPDB API token ===========================
|
# =========================== AbuseIPDB API token ===========================
|
||||||
max_attempts=4
|
max_attempts=4
|
||||||
attempts=0
|
|
||||||
valid_token=false
|
|
||||||
|
|
||||||
while [[ $attempts -lt $max_attempts ]]; do
|
for ((attempts = 0; attempts < max_attempts; attempts++)); do
|
||||||
read -rsp "$ Please enter your AbuseIPDB API token: " api_key
|
read -rsp "$ Please enter your AbuseIPDB API token: " api_key
|
||||||
echo
|
echo
|
||||||
|
|
||||||
if validate_token "$api_key"; then
|
if validate_token "$api_key"; then
|
||||||
valid_token=true
|
valid_token=true
|
||||||
break
|
break
|
||||||
else
|
fi
|
||||||
attempts_left=$((max_attempts - attempts - 1))
|
|
||||||
|
attempts_left=$((max_attempts - attempts - 1))
|
||||||
|
if (( attempts_left > 0 )); then
|
||||||
echo "WARN: Invalid API token format. Please enter an 80-character hexadecimal string. You have $attempts_left/$max_attempts attempts left."
|
echo "WARN: Invalid API token format. Please enter an 80-character hexadecimal string. You have $attempts_left/$max_attempts attempts left."
|
||||||
((attempts++))
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
if [[ "$valid_token" == "false" ]]; then
|
if [[ "${valid_token:-false}" != true ]]; then
|
||||||
echo -e "\nFAIL: Maximum number of attempts reached. Installation aborted!"
|
echo "FAIL: Maximum number of attempts reached. Installation aborted!"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue