summaryrefslogtreecommitdiffhomepage
path: root/modules/luci-mod-admin-full
diff options
context:
space:
mode:
Diffstat (limited to 'modules/luci-mod-admin-full')
-rwxr-xr-xmodules/luci-mod-admin-full/root/etc/uci-defaults/50_luci-mod-admin-full22
1 files changed, 22 insertions, 0 deletions
diff --git a/modules/luci-mod-admin-full/root/etc/uci-defaults/50_luci-mod-admin-full b/modules/luci-mod-admin-full/root/etc/uci-defaults/50_luci-mod-admin-full
new file mode 100755
index 0000000000..372eb15122
--- /dev/null
+++ b/modules/luci-mod-admin-full/root/etc/uci-defaults/50_luci-mod-admin-full
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+if [ "$(uci -q get luci.diag)" != "internal" ]; then
+ host=""
+
+ if [ -s /etc/os-release ]; then
+ . /etc/os-release
+ host="${HOME_URL:-${BUG_URL:-$LEDE_DEVICE_MANUFACTURER_URL}}"
+ host="${host#*://}"
+ host="${host%%/*}"
+ fi
+
+ uci -q batch <<-EOF >/dev/null
+ set luci.diag=internal
+ set luci.diag.dns='${host:-openwrt.org}'
+ set luci.diag.ping='${host:-openwrt.org}'
+ set luci.diag.route='${host:-openwrt.org}'
+ commit luci
+ EOF
+fi
+
+exit 0