Fix the binary detection for ARMv6 and simplify the router overall

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2023-10-21 19:13:45 +02:00
parent ca7836bf71
commit 45687d675b
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD

View file

@ -1875,29 +1875,27 @@ get_binary_name() {
local rev local rev
rev=$(echo "${cpu_arch}" | grep -o '[0-9]*') rev=$(echo "${cpu_arch}" | grep -o '[0-9]*')
if [[ "${machine}" == "aarch64" ]]; then if [[ "${machine}" == "aarch64" ]]; then
# If AArch64 is found (e.g., BCM2711 in Raspberry Pi 4)
printf "%b %b Detected AArch64 (64 Bit ARM) architecture\\n" "${OVER}" "${TICK}" printf "%b %b Detected AArch64 (64 Bit ARM) architecture\\n" "${OVER}" "${TICK}"
# set the binary to be used
l_binary="pihole-FTL-arm64" l_binary="pihole-FTL-arm64"
elif [[ "${cpu_arch}" == "armv6"* ]]; then elif [[ "${cpu_arch}" == "v6"* ]]; then
# If ARMv6 is found (e.g., BCM2835 in Raspberry Pi 1 and Zero)
printf "%b %b Detected ARMv6 architecture\\n" "${OVER}" "${TICK}" printf "%b %b Detected ARMv6 architecture\\n" "${OVER}" "${TICK}"
# set the binary to be used (e.g., BCM2835 as found in Raspberry Pi Zero and Model 1) l_binary="pihole-FTL-armv6"
elif [[ "${cpu_arch}" == "v7"* || "${rev}" -ge 7 ]]; then
# If ARMv7 or higher is found (e.g., BCM2836 in Raspberry PI 2 Mod. B)
# This path is also used for ARMv8 when the OS is in 32bit mode
# (e.g., BCM2837 in Raspberry Pi Model 3B, or BCM2711 in Raspberry Pi 4)
printf "%b %b Detected ARMv7 (or newer) architecture (%s)\\n" "${OVER}" "${TICK}" "${cpu_arch}"
l_binary="pihole-FTL-armv7"
elif [[ "${rev}" -gt 6 ]]; then
# Otherwise, if ARMv7 is found (e.g., BCM2836 in Raspberry Pi Model 2)
printf "%b %b Detected ARMv7 architecture (%s)\\n" "${OVER}" "${TICK}" "${cpu_arch}"
l_binary="pihole-FTL-armv6" l_binary="pihole-FTL-armv6"
else else
# If ARMv8 or higher is found (e.g., BCM2837 as found in Raspberry Pi Model 3B) # Otherwise, Pi-hole does not support this architecture
if [[ "${cpu_arch}" == "v7" || "${rev}" -gt 7 ]]; then printf "%b %b This processor architecture is not supported by Pi-hole (%s)\\n" "${OVER}" "${CROSS}" "${cpu_arch}"
printf "%b %b Detected ARMv7 (or newer) architecture (%s)\\n" "${OVER}" "${TICK}" "${cpu_arch}" l_binary=""
# set the binary to be used
l_binary="pihole-FTL-armv7"
elif [[ "${rev}" -gt 6 ]]; then
# Otherwise, if ARMv7 is found (e.g., BCM2836 as found in Raspberry Pi Model 2)
printf "%b %b Detected ARMv7 architecture (%s)\\n" "${OVER}" "${TICK}" "${cpu_arch}"
# set the binary to be used
l_binary="pihole-FTL-armv6"
else
# Otherwise, Pi-hole does not support this architecture
printf "%b %b This processor architecture is not supported by Pi-hole (%s)\\n" "${OVER}" "${CROSS}" "${cpu_arch}"
l_binary=""
fi
fi fi
elif [[ "${machine}" == "x86_64" ]]; then elif [[ "${machine}" == "x86_64" ]]; then
# This gives the processor of packages dpkg installs (for example, "i386") # This gives the processor of packages dpkg installs (for example, "i386")
@ -1912,9 +1910,8 @@ get_binary_name() {
printf "%b %b Detected 32bit (i686) architecture\\n" "${OVER}" "${TICK}" printf "%b %b Detected 32bit (i686) architecture\\n" "${OVER}" "${TICK}"
l_binary="pihole-FTL-386" l_binary="pihole-FTL-386"
else else
# 64bit # 64bit OS
printf "%b %b Detected x86_64 architecture\\n" "${OVER}" "${TICK}" printf "%b %b Detected x86_64 architecture\\n" "${OVER}" "${TICK}"
# set the binary to be used
l_binary="pihole-FTL-amd64" l_binary="pihole-FTL-amd64"
fi fi
elif [[ "${machine}" == "riscv64" ]]; then elif [[ "${machine}" == "riscv64" ]]; then