mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-24 13:50:17 +00:00
Use new FTL binary names
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
ec82aec55f
commit
667418c71d
2 changed files with 29 additions and 41 deletions
|
@ -1951,39 +1951,29 @@ get_binary_name() {
|
|||
if [[ "${lib}" == "/lib/ld-linux-aarch64.so.1" ]]; then
|
||||
printf "%b %b Detected AArch64 (64 Bit ARM) processor\\n" "${OVER}" "${TICK}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-aarch64-linux-gnu"
|
||||
l_binary="pihole-FTL-arm64"
|
||||
elif [[ "${lib}" == "/lib/ld-linux-armhf.so.3" ]]; then
|
||||
# Hard-float available: Use gnueabihf binaries
|
||||
# If ARMv8 or higher is found (e.g., BCM2837 as found in Raspberry Pi Model 3B)
|
||||
if [[ "${rev}" -gt 7 ]]; then
|
||||
printf "%b %b Detected ARMv8 (or newer) processor\\n" "${OVER}" "${TICK}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv8-linux-gnueabihf"
|
||||
l_binary="pihole-FTL-armv8"
|
||||
elif [[ "${rev}" -eq 7 ]]; then
|
||||
# Otherwise, if ARMv7 is found (e.g., BCM2836 as found in Raspberry Pi Model 2)
|
||||
printf "%b %b Detected ARMv7 processor (with hard-float support)\\n" "${OVER}" "${TICK}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv7-linux-gnueabihf"
|
||||
l_binary="pihole-FTL-armv7"
|
||||
else
|
||||
# Otherwise, use the ARMv6 binary (e.g., BCM2835 as found in Raspberry Pi Zero and Model 1)
|
||||
printf "%b %b Detected ARMv6 processor (with hard-float support)\\n" "${OVER}" "${TICK}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv6-linux-gnueabihf"
|
||||
l_binary="pihole-FTL-armv6"
|
||||
fi
|
||||
else
|
||||
# No hard-float support found: Use gnueabi binaries
|
||||
# Use the ARMv4-compliant binary only if we detected an ARMv4T core
|
||||
if [[ "${rev}" -eq 4 ]]; then
|
||||
printf "%b %b Detected ARMv4 processor\\n" "${OVER}" "${TICK}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv4-linux-gnueabi"
|
||||
# Otherwise, use the ARMv5 binary. To date (end of 2020), all modern ARM processors
|
||||
# are backwards-compatible to the ARMv5
|
||||
else
|
||||
printf "%b %b Detected ARMv5 (or newer) processor\\n" "${OVER}" "${TICK}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-armv5-linux-gnueabi"
|
||||
fi
|
||||
# No hard-float support found
|
||||
printf "%b %b%b ARM processor without hard-float support detected%b\\n" "${OVER}" "${COL_LIGHT_RED}" "${CROSS}" "${COL_NC}"
|
||||
l_binary=""
|
||||
fi
|
||||
elif [[ "${machine}" == "x86_64" ]]; then
|
||||
# This gives the processor of packages dpkg installs (for example, "i386")
|
||||
|
@ -1996,16 +1986,16 @@ get_binary_name() {
|
|||
# in the past (see https://github.com/pi-hole/pi-hole/pull/2004)
|
||||
if [[ "${dpkgarch}" == "i386" ]]; then
|
||||
printf "%b %b Detected 32bit (i686) processor\\n" "${OVER}" "${TICK}"
|
||||
l_binary="pihole-FTL-linux-x86_32"
|
||||
l_binary="pihole-FTL-386"
|
||||
else
|
||||
# 64bit
|
||||
printf "%b %b Detected x86_64 processor\\n" "${OVER}" "${TICK}"
|
||||
# set the binary to be used
|
||||
l_binary="pihole-FTL-linux-x86_64"
|
||||
l_binary="pihole-FTL-amd64"
|
||||
fi
|
||||
elif [[ "${machine}" == "riscv64" ]]; then
|
||||
printf "%b %b Detected riscv64 processor\\n" "${OVER}" "${TICK}"
|
||||
l_binary="pihole-FTL-riscv64-linux-gnu"
|
||||
l_binary="pihole-FTL-riscv64"
|
||||
else
|
||||
# Something else - we try to use 32bit executable and warn the user
|
||||
if [[ ! "${machine}" == "i686" ]]; then
|
||||
|
@ -2015,7 +2005,7 @@ get_binary_name() {
|
|||
else
|
||||
printf "%b %b Detected 32bit (i686) processor\\n" "${OVER}" "${TICK}"
|
||||
fi
|
||||
l_binary="pihole-FTL-linux-x86_32"
|
||||
l_binary="pihole-FTL-linux-386"
|
||||
fi
|
||||
|
||||
# Returning a string value via echo
|
||||
|
@ -2180,6 +2170,16 @@ main() {
|
|||
fi
|
||||
fi
|
||||
|
||||
# Check if there is a usable FTL binary available on this architecture - do
|
||||
# this early on as FTL is a hard dependency for Pi-hole
|
||||
local funcOutput
|
||||
funcOutput=$(get_binary_name) #Store output of get_binary_name here
|
||||
# Abort early if this processor is not supported (get_binary_name returnS empty string)
|
||||
if [[ "${funcOutput}" == "" ]]; then
|
||||
printf " %b Upgrade/install aborted\\n" "${CROSS}" "${DISTRO_NAME}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if SELinux is Enforcing and exit before doing anything else
|
||||
checkSelinux
|
||||
|
||||
|
@ -2249,9 +2249,7 @@ main() {
|
|||
# Create the pihole user
|
||||
create_pihole_user
|
||||
|
||||
# Check if FTL is installed - do this early on as FTL is a hard dependency for Pi-hole
|
||||
local funcOutput
|
||||
funcOutput=$(get_binary_name) #Store output of get_binary_name here
|
||||
# Download and install FTL
|
||||
local binary
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}" #binary name will be the last line of the output of get_binary_name (it always begins with pihole-FTL)
|
||||
local theRest
|
||||
|
|
|
@ -268,9 +268,9 @@ def test_FTL_detect_aarch64_no_errors(host):
|
|||
assert expected_stdout in detectPlatform.stdout
|
||||
|
||||
|
||||
def test_FTL_detect_armv4t_no_errors(host):
|
||||
def test_FTL_detect_armv4t_no_install(host):
|
||||
"""
|
||||
confirms only armv4t package is downloaded for FTL engine
|
||||
confirms armv4t architecture is not supported
|
||||
"""
|
||||
# mock uname to return armv4t platform
|
||||
mock_command("uname", {"-m": ("armv4t", "0")}, host)
|
||||
|
@ -288,22 +288,17 @@ def test_FTL_detect_armv4t_no_errors(host):
|
|||
source /opt/pihole/basic-install.sh
|
||||
create_pihole_user
|
||||
funcOutput=$(get_binary_name)
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}"
|
||||
theRest="${funcOutput%pihole-FTL*}"
|
||||
FTLdetect "${binary}" "${theRest}"
|
||||
"""
|
||||
)
|
||||
expected_stdout = info_box + " FTL Checks..."
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + (" Detected ARMv4 processor")
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Downloading and Installing FTL"
|
||||
expected_stdout = cross_box + (" ARM processor without hard-float support detected")
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
||||
|
||||
def test_FTL_detect_armv5te_no_errors(host):
|
||||
def test_FTL_detect_armv5te_no_install(host):
|
||||
"""
|
||||
confirms only armv5te package is downloaded for FTL engine
|
||||
confirms armv5te architecture is not supported
|
||||
"""
|
||||
# mock uname to return armv5te platform
|
||||
mock_command("uname", {"-m": ("armv5te", "0")}, host)
|
||||
|
@ -321,16 +316,11 @@ def test_FTL_detect_armv5te_no_errors(host):
|
|||
source /opt/pihole/basic-install.sh
|
||||
create_pihole_user
|
||||
funcOutput=$(get_binary_name)
|
||||
binary="pihole-FTL${funcOutput##*pihole-FTL}"
|
||||
theRest="${funcOutput%pihole-FTL*}"
|
||||
FTLdetect "${binary}" "${theRest}"
|
||||
"""
|
||||
)
|
||||
expected_stdout = info_box + " FTL Checks..."
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + (" Detected ARMv5 (or newer) processor")
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
expected_stdout = tick_box + " Downloading and Installing FTL"
|
||||
expected_stdout = cross_box + (" ARM processor without hard-float support detected")
|
||||
assert expected_stdout in detectPlatform.stdout
|
||||
|
||||
|
||||
|
@ -375,7 +365,7 @@ def test_FTL_detect_armv7l_no_errors(host):
|
|||
"""
|
||||
# mock uname to return armv7l platform
|
||||
mock_command("uname", {"-m": ("armv7l", "0")}, host)
|
||||
# mock ldd to respond with ld-linux-armhf shared library
|
||||
# mock ldd to respond with ld-linux-armhf shared lib rary
|
||||
mock_command(
|
||||
"ldd",
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue