This PR updates the function flushing the network tables and the ARP table. It separates the two, renaming the whole function to networkflush and makes flushing ARP optional by appending --arp. Deletion of the network table is now done via FTL's /action/flush/arp endpoint.
Documentation: https://github.com/pi-hole/docs/pull/1253
Related PR in the FTL repo: https://github.com/pi-hole/FTL/pull/2541
In some cases `kill -RTMIN` can send incorrect signal value to the FTL causing it to terminate instead of performing lists reload.
https://github.com/pi-hole/FTL/issues/2573
Get session authentication information via single jq operation,
setting defaults if no data returned.
Simplify jq test for valid JSON data
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
Count list and gravity matches using jq in a single step.
Use jq's map to simplify list processing, eliminating intermediate
jsons.
Eliminate while loop for each lists's final output and formatting.
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
Currently, if the FTL update check returns 404, hence the FTL branch does not seem to exist, an error message is printed, but the update continues, only the FTL update is skipped.
This can lead to setups with v5 FTL and v6 core/web, failing at config migration, where FTL is invoked with a v6-only command.
With this change, the update aborts immediately if the FTL branch is invalid, like it does in case of other FTL update check errors (other HTTP error codes than 404 or other curl errors). Hence it continues only if FTL is up-to-date already, or a new version from the given branch has been found.
Signed-off-by: MichaIng <micha@dietpi.com>
The return code of `FTLdetect()` is used in the installer to know whether FTL has been installed or not.
The function however returns an error only, if the download of FTL fails, not if checking for a latest version/update of FTL fails. This way, installs and rapairs can continue without or with ourdated FTL until `pihole-FTL migrate v6`, which hangs endlessly, if it is a v5 FTL.
This commit handles the return code in `FTLdetect()`, and lets it return true only if FTL download succeeded, or if the update check succeeded and FTL is up-to-date. Else, it could neither be repaired, nor installed, and the error message should give a hint what went wrong, hence exit.
`FTLdetect()` is not called by any other script, hence this change has no surprising effect elsewhere.
Additionally, a syntax error in the `FTLcheckUpdate()` function itself is fixed, which masks the `check_download_exists()` return code, hence always leads to error code 4, if the FTL branch is not `master`.
Signed-off-by: MichaIng <micha@dietpi.com>