mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-03-03 16:15:54 +00:00
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
This commit is contained in:
@@ -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
|
||||
# ==============================================================================
|
||||
|
||||
Reference in New Issue
Block a user