From c0fde54d73ec7cafec4b6664a7f0359673772506 Mon Sep 17 00:00:00 2001 From: Darkangeel_hd <10299587+Darkangeel-hd@users.noreply.github.com> Date: Thu, 26 Feb 2026 22:28:22 +0100 Subject: [PATCH] Improves adguardhome-sync addon when running on alpine LXCs (#12362) * Update adguardhome-sync.sh Better handle edge case of `curl` not being installed on Alpine. Install `jq`, required by `fetch_and_deploy_gh_release()`, which if not installed makes the script error out with confusing stuff Rewritten `get_ip()` to make it also work on busybox environments (Alpine). * Update adguardhome-sync.sh `jq` is installed by some code inside of `fetch_and_deploy_gh_release` for debian So it doesn't make much sense to install it here. We only do so for alpine, as if its not installed it breaks the script --- tools/addon/adguardhome-sync.sh | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/tools/addon/adguardhome-sync.sh b/tools/addon/adguardhome-sync.sh index 9a32af294..480f7f198 100644 --- a/tools/addon/adguardhome-sync.sh +++ b/tools/addon/adguardhome-sync.sh @@ -7,8 +7,12 @@ if ! command -v curl &>/dev/null; then printf "\r\e[2K%b" '\033[93m Setup Source \033[m' >&2 - apt-get update >/dev/null 2>&1 - apt-get install -y curl >/dev/null 2>&1 + if [[ -f "/etc/alpine-release" ]]; then + apk -U add curl >/dev/null 2>&1 + else + apt-get update >/dev/null 2>&1 + apt-get install -y curl >/dev/null 2>&1 + fi fi source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/core.func) source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/tools.func) @@ -51,7 +55,7 @@ EOF # HELPER FUNCTIONS # ============================================================================== get_ip() { - hostname -I 2>/dev/null | awk '{print $1}' || echo "127.0.0.1" + ifconfig | grep -v '127.0.0.1' | grep -Eo 'inet (addr:)?([0-9]*\.){3}[0-9]*' | grep -m1 -Eo '([0-9]*\.){3}[0-9]*' || echo "127.0.0.1" } # ============================================================================== @@ -68,6 +72,16 @@ else exit 1 fi +# ============================================================================== +# DEPENDENCY CHECK +# ============================================================================== +if ! command -v jq &>/dev/null; then + printf "\r\e[2K%b" '\033[93m Installing jq \033[m' >&2 + if [[ "$OS" == "Alpine" ]]; then + apk -U add jq >/dev/null 2>&1 + fi +fi + # ============================================================================== # UNINSTALL # ==============================================================================