[PATCH] base-files: add SOURCE_DATE_EPOCH /usr/lib/os-release

Florian Eckert fe at dev.tdt.de
Tue Jun 18 06:23:43 PDT 2024


The variable 'SOURCE_DATE_EPOCH' is used in the build system to have a
defined build time for the entire software. This information is discovered
with the script '/scripts/get_source_date_epoch.sh'.

This information is used to generate reproducible binary builds and should
therefore be available in the file '/usr/lib/os-release' on the target.

Signed-off-by: Florian Eckert <fe at dev.tdt.de>
---
 include/version.mk                          | 3 ++-
 package/base-files/files/usr/lib/os-release | 1 +
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/version.mk b/include/version.mk
index cdee0976da..1ac29b629a 100644
--- a/include/version.mk
+++ b/include/version.mk
@@ -104,5 +104,6 @@ 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,%h,$(call sed_escape,$(VERSION_HWREV)),g'
+	-e 's,%h,$(call sed_escape,$(VERSION_HWREV)),g' \
+	-e 's,%B,$(call sed_escape,$(SOURCE_DATE_EPOCH)),g'
 
diff --git a/package/base-files/files/usr/lib/os-release b/package/base-files/files/usr/lib/os-release
index c39913d54f..12db2c0ac6 100644
--- a/package/base-files/files/usr/lib/os-release
+++ b/package/base-files/files/usr/lib/os-release
@@ -16,3 +16,4 @@ OPENWRT_DEVICE_MANUFACTURER_URL="%m"
 OPENWRT_DEVICE_PRODUCT="%P"
 OPENWRT_DEVICE_REVISION="%h"
 OPENWRT_RELEASE="%D %V %C"
+OPENWRT_BUILD_DATE="%B"
-- 
2.39.2




More information about the openwrt-devel mailing list