From 767c3bd265ecd6aa7cc4cf9e58e3ee32a7835a4f Mon Sep 17 00:00:00 2001 From: John Crispin Date: Sat, 29 Aug 2020 08:25:41 +0200 Subject: [PATCH 12/68] 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 | 7 +++++ package/base-files/Makefile | 1 + 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/getver.sh | 12 ++++++++ 7 files changed, 52 insertions(+) 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 924bf83541..af7d9a1e32 100644 --- a/include/version.mk +++ b/include/version.mk @@ -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 +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/Makefile b/package/base-files/Makefile index 8732f82fb9..dc89de2035 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -239,6 +239,7 @@ endif $(if $(CONFIG_TARGET_PREINIT_DISABLE_FAILSAFE), \ rm -f $(1)/etc/banner.failsafe,) + $(CP) $(1)/etc/openwrt_release $(TOPDIR)/tmp/ endef ifneq ($(DUMP),1) diff --git a/package/base-files/files/etc/banner b/package/base-files/files/etc/banner 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-%x %D %V, %C --------------------------------------------------- diff --git a/package/base-files/files/etc/openwrt_release b/package/base-files/files/etc/openwrt_release index d03400ca05..3652b1a49a 100644 --- a/package/base-files/files/etc/openwrt_release +++ b/package/base-files/files/etc/openwrt_release @@ -5,3 +5,5 @@ DISTRIB_TARGET='%S' DISTRIB_ARCH='%A' DISTRIB_DESCRIPTION='%D %V %C' DISTRIB_TAINTS='%t' +DISTRIB_TIP='%D %V %C / TIP-%x-%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 +++ b/package/base-files/files/etc/openwrt_version @@ -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/getver.sh b/scripts/getver.sh index 49260a2260..8e8ee46f21 100755 --- a/scripts/getver.sh +++ b/scripts/getver.sh @@ -3,6 +3,18 @@ export LANG=C export LC_ALL=C [ -n "$TOPDIR" ] && cd $TOPDIR +[ "$1" = "wlan-ap" ] && { + cd .. + git log -n 1 --format="%h" + exit 0 +} + +[ "$1" = "wlan-ap-version" ] && { + cd .. + git tag --points-at HEAD + exit 0 +} + GET_REV=$1 try_version() { -- 2.34.1