Address review comments

Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
DL6ER 2023-10-22 08:32:52 +02:00
parent 369ccf13a8
commit 842a9d7778
No known key found for this signature in database
GPG key ID: 00135ACBD90B28DD

View file

@ -90,7 +90,6 @@ IPV6_ADDRESS=${IPV6_ADDRESS}
QUERY_LOGGING=true QUERY_LOGGING=true
WEBPORT=8080 WEBPORT=8080
PRIVACY_LEVEL=0 PRIVACY_LEVEL=0
CACHE_SIZE=10000
if [ -z "${USER}" ]; then if [ -z "${USER}" ]; then
USER="$(id -un)" USER="$(id -un)"
@ -301,11 +300,11 @@ package_manager_detect() {
PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true" PKG_COUNT="${PKG_MANAGER} -s -o Debug::NoLocking=true upgrade | grep -c ^Inst || true"
# Update package cache # Update package cache
update_package_cache || exit 1 update_package_cache || exit 1
# Packages required to perform the os_check (stored as an array) # Packages required to perform the os_check and FTL binary detection
OS_CHECK_DEPS=(grep dnsutils binutils) OS_CHECK_DEPS=(grep dnsutils binutils)
# Packages required to run this install script (stored as an array) # Packages required to run this install script
INSTALLER_DEPS=(git iproute2 dialog ca-certificates) INSTALLER_DEPS=(git iproute2 dialog ca-certificates)
# Packages required to run Pi-hole (stored as an array) # Packages required to run Pi-hole
PIHOLE_DEPS=(cron curl iputils-ping psmisc sudo unzip idn2 libcap2-bin dns-root-data libcap2 netcat-openbsd procps jq) PIHOLE_DEPS=(cron curl iputils-ping psmisc sudo unzip idn2 libcap2-bin dns-root-data libcap2 netcat-openbsd procps jq)
# If apt-get is not found, check for rpm. # If apt-get is not found, check for rpm.
@ -1856,29 +1855,30 @@ remove_dir() {
} }
get_binary_name() { get_binary_name() {
# Get the OS architecture (we cannot use uname -m as this may return an incorrect architecture when buildx-compiling with QEMU for arm) local l_binary
local machine local machine
machine=$(uname -m) machine=$(uname -m)
local l_binary
local str="Detecting processor" local str="Detecting processor"
printf " %b %s..." "${INFO}" "${str}" printf " %b %s..." "${INFO}" "${str}"
# If the machine is arm or aarch
if [[ "${machine}" == "arm"* || "${machine}" == *"aarch"* ]]; then # If the machine is aarch64 (armv8)
# ARM 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}"
l_binary="pihole-FTL-arm64"
elif [[ "${machine}" == "arm"* ]]; then
# ARM 32 bit
# Get supported processor from other binaries installed on the system # Get supported processor from other binaries installed on the system
# We cannot really rely on the output of $(uname -m) above as this may
# return an incorrect architecture when buildx-compiling with QEMU
local cpu_arch local cpu_arch
cpu_arch=$(readelf -A "$(command -v sh)" | grep Tag_CPU_arch | awk '{ print $2 }') cpu_arch=$(readelf -A "$(command -v sh)" | grep Tag_CPU_arch | awk '{ print $2 }')
# Get the revision from the CPU architecture # Get the revision from the CPU architecture
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 [[ "${rev}" -eq 6 ]]; then
# If AArch64 is found (e.g., BCM2711 in Raspberry Pi 4)
printf "%b %b Detected AArch64 (64 Bit ARM) architecture\\n" "${OVER}" "${TICK}"
l_binary="pihole-FTL-arm64"
elif [[ "${rev}" -eq 6 ]]; then
# If ARMv6 is found (e.g., BCM2835 in Raspberry Pi 1 and Zero) # 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}"
l_binary="pihole-FTL-armv6" l_binary="pihole-FTL-armv6"