From 81346f2d801ac637b32318a32c89ac91f84a3cdc Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 4 May 2021 10:59:27 +0200 Subject: [PATCH] ucentral: development update * add board information page to webui * fix github workflow, it actually reports fails now Signed-off-by: John Crispin --- .github/workflows/build-dev.yml | 2 +- build.sh | 3 +- docker/Dockerfile | 2 +- .../luci-static/resources/view/setup.js | 33 ++++++- .../luci/luci-mod-simple/root/sbin/certupdate | 3 + ...base-files-add-the-wlan-ap-repo-hash.patch | 95 +++++++++++++++---- profiles/ucentral-ap.yml | 3 + 7 files changed, 116 insertions(+), 25 deletions(-) diff --git a/.github/workflows/build-dev.yml b/.github/workflows/build-dev.yml index ddf8a929a..195fde91b 100644 --- a/.github/workflows/build-dev.yml +++ b/.github/workflows/build-dev.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - target: ['cig_wf188', 'cig_wf194c', 'cig_wf160d.yml', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'linksys_e8450', 'linksys_ea8300', 'mikrotik_rb91x', 'tplink_cpe210_v3', 'tplink_ex227', 'tplink_ex447', 'zyxel_gs1900-10hp'] + target: ['cig_wf188', 'cig_wf194c', 'cig_wf160d', 'edgecore_eap101', 'edgecore_eap102', 'edgecore_ecs4100-12ph', 'edgecore_ecw5211', 'linksys_e8450', 'linksys_ea8300', 'mikrotik_rb91x', 'tplink_cpe210_v3', 'tplink_ex227', 'tplink_ex447', 'zyxel_gs1900-10hp'] steps: - uses: actions/checkout@v2 diff --git a/build.sh b/build.sh index 5ff70ef44..6d67f5abc 100755 --- a/build.sh +++ b/build.sh @@ -24,5 +24,4 @@ cd - echo "### Building image ..." cd $BUILD_DIR -make -j$(nproc) V=s 2>&1 | tee build.log -echo "Done" +make -j$(nproc) V=s diff --git a/docker/Dockerfile b/docker/Dockerfile index aeca8e89f..95d845ace 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -5,7 +5,7 @@ RUN apt-get update \ && apt-get install -y \ time git-core build-essential gcc-multilib \ libncurses5-dev zlib1g-dev gawk flex gettext wget unzip python \ - python3 python3-pip python3-yaml openvswitch-common openvswitch-switch libssl-dev rsync \ + python3 python3-pip python3-yaml libssl-dev rsync \ && apt-get clean RUN git config --global user.email "you@example.com" RUN git config --global user.name "Your Name" diff --git a/feeds/ucentral/luci/luci-mod-simple/htdocs/luci-static/resources/view/setup.js b/feeds/ucentral/luci/luci-mod-simple/htdocs/luci-static/resources/view/setup.js index b3e2a99b3..a93b8dce8 100644 --- a/feeds/ucentral/luci/luci-mod-simple/htdocs/luci-static/resources/view/setup.js +++ b/feeds/ucentral/luci/luci-mod-simple/htdocs/luci-static/resources/view/setup.js @@ -26,6 +26,11 @@ var callSystemValidateFirmwareImage = rpc.declare({ reject: true }); +var callSystemBoard = rpc.declare({ + object: 'system', + method: 'board' +}); + function parseAddressAndNetmask(ipaddr, netmask) { var m = (ipaddr || '').match(/^(.+)\/(\d+)$/); if (m) { @@ -125,12 +130,16 @@ function showProgress(text, ongoing) { } } +var formSystemBoard; return view.extend({ load: function() { return Promise.all([ uci.load('network'), - uci.load('ucentral') + uci.load('ucentral'), + callSystemBoard().then(function(reply) { + formSystemBoard = reply; + }) ]); }, @@ -376,12 +385,18 @@ return view.extend({ uci.get('network', 'wan', 'dns')); var formdata = { + information: { + serial: formSystemBoard.hostname, + model: formSystemBoard.model, + version: formSystemBoard.release["tip-version"], + revision: formSystemBoard.release["tip-revision"] + }, wan: { proto: uci.get('network', 'wan', 'proto'), addr: addr_wan ? addr_wan[0] : null, mask: addr_wan ? addr_wan[1] : null, - gateway: addr_wan ? addr_wan[1] : null, - dns: addr_wan ? addr_wan[1] : null + gateway: addr_wan ? addr_wan[2] : null, + dns: addr_wan ? addr_wan[3] : null }, maintenance: {}, certificates: {redirector: null} @@ -390,9 +405,19 @@ return view.extend({ m = new form.JSONMap(formdata, _('Setup')); m.tabbed = true; + s = m.section(form.NamedSection, "information", 'information', _('Information')); + o = s.option(form.Value, 'serial', _('Serial')); + o.readonly = true; + o = s.option(form.Value, 'model', _('Model')); + o.readonly = true; + o = s.option(form.Value, 'version', _('Release')); + o.readonly = true; + o = s.option(form.Value, 'revision', _('Revision')); + o.readonly = true; + s = m.section(form.NamedSection, 'wan', 'wan', _('Connectivity')); - o = s.option(cbiRichListValue, 'proto'); + o = s.option(cbiRichListValue, 'proto', "Protocol"); o.value('dhcp', E('div', { 'style': 'white-space:normal' }, [ E('strong', [ _('Automatic address configuration (DHCP)') ]), E('br'), E('span', { 'class': 'hide-open' }) diff --git a/feeds/ucentral/luci/luci-mod-simple/root/sbin/certupdate b/feeds/ucentral/luci/luci-mod-simple/root/sbin/certupdate index f2048ce00..0d31ad289 100755 --- a/feeds/ucentral/luci/luci-mod-simple/root/sbin/certupdate +++ b/feeds/ucentral/luci/luci-mod-simple/root/sbin/certupdate @@ -2,6 +2,9 @@ cd /etc/ucentral/ tar xf /tmp/certs.tar +/etc/init.d/firstcontact disable +/etc/init.d/firstcontact stop +/etc/init.d/ucentral enable /etc/init.d/ucentral restart return 0 diff --git a/patches/0008-base-files-add-the-wlan-ap-repo-hash.patch b/patches/0008-base-files-add-the-wlan-ap-repo-hash.patch index 07671d6d0..403bc0431 100644 --- a/patches/0008-base-files-add-the-wlan-ap-repo-hash.patch +++ b/patches/0008-base-files-add-the-wlan-ap-repo-hash.patch @@ -1,60 +1,68 @@ -From b69fb05f4a476b4b57fb146904e6a435d009f9bd Mon Sep 17 00:00:00 2001 +From af8a5fcd98e0d1d0f0cca85c62a3551d3d589d88 Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 29 Aug 2020 08:25:41 +0200 -Subject: [PATCH 08/21] base-files: add the wlan-ap repo hash +Subject: [PATCH 01/25] base-files: add the wlan-ap repo hash currently the banner will show the revision of the build tree. This patch adds the hash of the wlan-ap tree. Signed-off-by: John Crispin --- - include/version.mk | 3 +++ - package/base-files/files/etc/banner | 1 + - package/base-files/files/etc/openwrt_release | 1 + - package/base-files/files/etc/openwrt_version | 1 + - scripts/getver.sh | 6 ++++++ - 5 files changed, 12 insertions(+) + include/version.mk | 7 +++++ + package/base-files/files/etc/banner | 1 + + package/base-files/files/etc/openwrt_release | 2 ++ + package/base-files/files/etc/openwrt_version | 1 + + ...p-revision-info-to-system.board-call.patch | 28 +++++++++++++++++++ + scripts/gen_config.py | 2 +- + scripts/getver.sh | 12 ++++++++ + 7 files changed, 52 insertions(+), 1 deletion(-) + create mode 100644 package/system/procd/patches/0001-procd-add-tip-revision-info-to-system.board-call.patch diff --git a/include/version.mk b/include/version.mk -index a4b47c8a57..dd5f9a20f9 100644 +index a4b47c8a57..214f32974b 100644 --- a/include/version.mk +++ b/include/version.mk -@@ -56,6 +56,8 @@ VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic) +@@ -56,6 +56,11 @@ VERSION_PRODUCT:=$(if $(VERSION_PRODUCT),$(VERSION_PRODUCT),Generic) VERSION_HWREV:=$(call qstrip,$(CONFIG_VERSION_HWREV)) VERSION_HWREV:=$(if $(VERSION_HWREV),$(VERSION_HWREV),v0) +VERSION_TIP:=$(shell $(TOPDIR)/scripts/getver.sh wlan-ap) ++ ++VERSION_TIP_VERSION:=$(shell $(TOPDIR)/scripts/getver.sh wlan-ap-version) ++VERSION_TIP_VERSION:=$(if $(VERSION_TIP_VERSION),$(VERSION_TIP_VERSION),devel) + define taint2sym $(CONFIG_$(firstword $(subst :, ,$(subst +,,$(subst -,,$(1)))))) endef -@@ -104,5 +106,6 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \ +@@ -104,5 +109,7 @@ VERSION_SED_SCRIPT:=$(SED) 's,%U,$(call sed_escape,$(VERSION_REPO)),g' \ -e 's,%u,$(call sed_escape,$(VERSION_HOME_URL)),g' \ -e 's,%s,$(call sed_escape,$(VERSION_SUPPORT_URL)),g' \ -e 's,%P,$(call sed_escape,$(VERSION_PRODUCT)),g' \ + -e 's,%a,$(call sed_escape,$(VERSION_TIP)),g' \ ++ -e 's,%x,$(call sed_escape,$(VERSION_TIP_VERSION)),g' \ -e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g' diff --git a/package/base-files/files/etc/banner b/package/base-files/files/etc/banner -index f73423bad4..53e3cfcf4a 100644 +index f73423bad4..65c175e1ef 100644 --- a/package/base-files/files/etc/banner +++ b/package/base-files/files/etc/banner @@ -4,5 +4,6 @@ |_______|| __|_____|__|__||________|__|__| |__| |__| W I R E L E S S F R E E D O M --------------------------------------------------- -+ ApNos-%a ++ ApNos-%a-%x %D %V, %C --------------------------------------------------- diff --git a/package/base-files/files/etc/openwrt_release b/package/base-files/files/etc/openwrt_release -index d03400ca05..11eb7f0361 100644 +index d03400ca05..0327c21f68 100644 --- a/package/base-files/files/etc/openwrt_release +++ b/package/base-files/files/etc/openwrt_release -@@ -5,3 +5,4 @@ DISTRIB_TARGET='%S' +@@ -5,3 +5,5 @@ DISTRIB_TARGET='%S' DISTRIB_ARCH='%A' DISTRIB_DESCRIPTION='%D %V %C' DISTRIB_TAINTS='%t' +DISTRIB_TIP='%a' ++DISTRIB_TIP_VERSION='%x' diff --git a/package/base-files/files/etc/openwrt_version b/package/base-files/files/etc/openwrt_version index 48157ed97f..bb0ef233ac 100644 --- a/package/base-files/files/etc/openwrt_version @@ -62,11 +70,58 @@ index 48157ed97f..bb0ef233ac 100644 @@ -1 +1,2 @@ +ApNos-%a %C +diff --git a/package/system/procd/patches/0001-procd-add-tip-revision-info-to-system.board-call.patch b/package/system/procd/patches/0001-procd-add-tip-revision-info-to-system.board-call.patch +new file mode 100644 +index 0000000000..4e8f05a700 +--- /dev/null ++++ b/package/system/procd/patches/0001-procd-add-tip-revision-info-to-system.board-call.patch +@@ -0,0 +1,28 @@ ++From b08e6ce0ebf0cd5aa7a6ed463a83160634ad9693 Mon Sep 17 00:00:00 2001 ++From: John Crispin ++Date: Tue, 4 May 2021 10:37:41 +0200 ++Subject: [PATCH] procd: add tip revision info to system.board call ++ ++Signed-off-by: John Crispin ++--- ++ system.c | 4 ++++ ++ 1 file changed, 4 insertions(+) ++ ++diff --git a/system.c b/system.c ++index 83aea42..8a87566 100644 ++--- a/system.c +++++ b/system.c ++@@ -197,6 +197,10 @@ static int system_board(struct ubus_context *ctx, struct ubus_object *obj, ++ key = "target"; ++ else if (!strcasecmp(key, "DISTRIB_DESCRIPTION")) ++ key = "description"; +++ else if (!strcasecmp(key, "DISTRIB_TIP")) +++ key = "tip-revision"; +++ else if (!strcasecmp(key, "DISTRIB_TIP_VERSION")) +++ key = "tip-version"; ++ else ++ continue; ++ ++-- ++2.25.1 ++ +diff --git a/scripts/gen_config.py b/scripts/gen_config.py +index 5bc7068ae7..b380a2e605 100755 +--- a/scripts/gen_config.py ++++ b/scripts/gen_config.py +@@ -62,7 +62,7 @@ def load_yaml(fname: str, profile: dict, include = True): + + if "include" in new and include: + for i in range(len(new["include"])): +- profile = load_yaml(new["include"][i], profile, False) ++ profile = load_yaml(new["include"][i], profile) + return profile + + diff --git a/scripts/getver.sh b/scripts/getver.sh -index dc3d1bb1c3..fe4fc4afbe 100755 +index dc3d1bb1c3..cd4d7aedf4 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh -@@ -3,6 +3,12 @@ export LANG=C +@@ -3,6 +3,18 @@ export LANG=C export LC_ALL=C [ -n "$TOPDIR" ] && cd $TOPDIR @@ -75,6 +130,12 @@ index dc3d1bb1c3..fe4fc4afbe 100755 + git log -n 1 --format="%h" + exit 0 +} ++ ++[ "$1" = "wlan-ap-version" ] && { ++ cd .. ++ git tag --points-at HEAD ++ exit 0 ++} + GET_REV=$1 diff --git a/profiles/ucentral-ap.yml b/profiles/ucentral-ap.yml index 21cd396a9..521c9cd20 100644 --- a/profiles/ucentral-ap.yml +++ b/profiles/ucentral-ap.yml @@ -6,6 +6,9 @@ feeds: - name: tip path: ../../feeds/tip +include: + - webui + packages: - kmod-batman-adv - batctl-default