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 # ==============================================================================