diff options
author | Colin Percival <cperciva@FreeBSD.org> | 2025-02-03 03:37:56 +0000 |
---|---|---|
committer | Colin Percival <cperciva@FreeBSD.org> | 2025-02-03 23:58:32 +0000 |
commit | 44a768e1a80d9e4f06d07fbd9025e63622a80de0 (patch) | |
tree | 421cd4c93084ffc6aafd24202a952301466cefea /stand/common | |
parent | 70ccb89db2a28998a85b60023e7b3211db540cab (diff) |
stand: Use SOURCE_DATE_EPOCH in newvers.sh
The newvers.sh script is used to generate vers.c for 10 programs (at
latest count on amd64): 4 EFI loaders, 3 x86 loaders, two userboots,
and one kboot. When building without MK_REPRODUCIBLE_BUILD this
resulted in 10 different timestamps being compiled into various files.
If SOURCE_DATE_EPOCH is set, use that value rather than the current
date and time.
Reviewed by: emaste, imp
Sponsored by: Amazon
Differential Revision: https://reviews.freebsd.org/D48803
Diffstat (limited to 'stand/common')
-rwxr-xr-x | stand/common/newvers.sh | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/stand/common/newvers.sh b/stand/common/newvers.sh index 369a1c7c76df..c244e718c041 100755 --- a/stand/common/newvers.sh +++ b/stand/common/newvers.sh @@ -43,7 +43,15 @@ done shift $((OPTIND - 1)) LC_ALL=C; export LC_ALL -u=${USER-root} h=${HOSTNAME-`hostname`} t=`date` +u=${USER-root} h=${HOSTNAME-`hostname`} +if [ -n "$SOURCE_DATE_EPOCH" ]; then + if ! t=$(date -ur $SOURCE_DATE_EPOCH 2>/dev/null); then + echo "Invalid SOURCE_DATE_EPOCH" >&2 + exit 1 + fi +else + t=`date` +fi r=`awk -F: ' /^[0-9]\.[0-9]+:/ { print $1; exit }' $1` bootprog_info="FreeBSD/${3} ${2}, Revision ${r}\\n" |