From 067fe5bcce0303f427fbe9351f043d330c7030ce Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Thu, 6 Oct 2016 17:13:23 +0200 Subject: luci-mod-admin-full: figure out diagnostics host in postinstall Attempt to infer the default diagnostics host for nslookup / ping / traceroute from the various URLs in /etc/os-release. Fall back to "openwrt.org" if no host is found to preserve backwards compatibility. Signed-off-by: Jo-Philipp Wich --- .../root/etc/uci-defaults/50_luci-mod-admin-full | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 modules/luci-mod-admin-full/root/etc/uci-defaults/50_luci-mod-admin-full (limited to 'modules/luci-mod-admin-full/root') 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 000000000..372eb1512 --- /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 -- cgit v1.2.3