mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-12-24 07:38:16 +03:00
ac5a96fada
Squashed commit of the following: commit f920006277f39b74c803139af2a9039aa45effae Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Fri Nov 8 16:14:41 2024 +0300 all: fix pre-commit; upd dnsproxy commit391f79b244
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 7 18:53:28 2024 +0300 scripts: imp install commit35324db80b
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 7 18:20:23 2024 +0300 all: imp docs, scripts commitd2724cfaef
Author: Ainar Garipov <A.Garipov@AdGuard.COM> Date: Thu Nov 7 17:26:23 2024 +0300 all: upd go, deps, tools, scripts
26 lines
587 B
Bash
Executable file
26 lines
587 B
Bash
Executable file
#!/bin/sh
|
|
|
|
# shellcheck disable=SC2154
|
|
conf_file="${SNAP_DATA}/AdGuardHome.yaml"
|
|
readonly conf_file
|
|
|
|
if ! [ -f "$conf_file" ]; then
|
|
xdg-open 'http://localhost:3000'
|
|
|
|
exit
|
|
fi
|
|
|
|
# Get the admin interface port from the configuration.
|
|
#
|
|
# shellcheck disable=SC2016
|
|
awk_prog='/^[^[:space:]]/ { is_http = /^http:/ };/^[[:space:]]+address:/ { if (is_http) print $2 }'
|
|
readonly awk_prog
|
|
|
|
bind_port="$(awk "$awk_prog" "$conf_file" | awk -F ':' '{print $NF}')"
|
|
readonly bind_port
|
|
|
|
if [ "$bind_port" = '' ]; then
|
|
xdg-open 'http://localhost:3000'
|
|
else
|
|
xdg-open "http://localhost:${bind_port}"
|
|
fi
|