From 45687d675becf21f23953625c00efdb637531c21 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 21 Oct 2023 19:13:45 +0200 Subject: [PATCH] Fix the binary detection for ARMv6 and simplify the router overall Signed-off-by: DL6ER --- automated install/basic-install.sh | 37 ++++++++++++++---------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/automated install/basic-install.sh b/automated install/basic-install.sh index 443ee85e..054d8eef 100755 --- a/automated install/basic-install.sh +++ b/automated install/basic-install.sh @@ -1875,29 +1875,27 @@ get_binary_name() { local rev rev=$(echo "${cpu_arch}" | grep -o '[0-9]*') 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}" - # set the binary to be used 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}" - # 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" else - # If ARMv8 or higher is found (e.g., BCM2837 as found in Raspberry Pi Model 3B) - if [[ "${cpu_arch}" == "v7" || "${rev}" -gt 7 ]]; then - printf "%b %b Detected ARMv7 (or newer) architecture (%s)\\n" "${OVER}" "${TICK}" "${cpu_arch}" - # 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 + # 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 elif [[ "${machine}" == "x86_64" ]]; then # 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}" l_binary="pihole-FTL-386" else - # 64bit + # 64bit OS printf "%b %b Detected x86_64 architecture\\n" "${OVER}" "${TICK}" - # set the binary to be used l_binary="pihole-FTL-amd64" fi elif [[ "${machine}" == "riscv64" ]]; then