Split removePiholeFiles into functions for each category.
Reorder execution so that:
Pihole-FTL is stopped and removed before shutdown scripts are removed.
User and group are removed before needed commands are removed.
Remove database and log files in user-specified non-default locations,
and use local directories from basic install.sh, falling back to defaults.
Remove use of sudo as the script already checks that it is called as root.
Advise user of location of crontab backup if is created
Make use of service control functions, command detection and default
directories from basic_install.sh
Align variable names with current basic-install.sh
Disable pihole-FTL service immediately, if systemctl is available
Call systemd daemon-reload after removing service files (on systemd systems)
Signed-off-by: Rob Gill <rrobgill@protonmail.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>
Add cron-daemon virtual package as an alternative dependency. This way
pihole-meta by default still depends on cron, but allows installation of
systemd-cron, which completely replaces cron daemon and package. With
systemd-cron functionality of crontab files and /etc/cron.* directories
works expected, as systemd-cron generates systemd timers from cron
files.
Signed-off-by: Ihor Urazov <iurazov@healthjoy.com>
Alters the test for IPv4 route so the installer doesn't fail instantly on IPv6-only.
Gives user a dialog to proceed with IPv6 only installation
Switches DNS server options to only contain IPv6 addresses.
Signed-off-by: Rob Gill <rrobgill@protonmail.com>
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
^-----------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
In ./advanced/Scripts/update.sh line 39:
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
^-----------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
In ./advanced/Scripts/updatecheck.sh line 45:
readonly ADMIN_INTERFACE_DIR=$(getFTLConfigValue "webserver.paths.webroot")$(getFTLConfigValue "webserver.paths.webhome")
^-----------------^ SC2155 (warning): Declare and assign separately to avoid masking return values.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>
local status=$(curl --head --silent "https://ftl.pi-hole.net/${1}" | head -n 1)
^----^ SC2155 (warning): Declare and assign separately to avoid masking return values.
In ./automated install/basic-install.sh line 2076:
elif [ $? -eq 2 ]; then
^-- SC2319 (warning): This $? refers to a condition, not a command. Assign to a variable to avoid it being overwritten.
Signed-off-by: Adam Warner <me@adamwarner.co.uk>