Skip to content

Commit 89920ba

Browse files
committed
getdate.sh: make the date(1) usage more portable
There are several different flavors of date(1) out there. Try a few different CLI options for date(1) to see which one works. Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent ddf216b commit 89920ba

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

config/getdate.sh

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,8 @@
77
# Provide a way to override build date for reproducible build results
88
# See https://reproducible-builds.org/ for why this is good.
99

10-
date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" "$@"
10+
# There are several different flavors of date(1) out there.
11+
# Try a few different CLI options for date(1) to see which one works.
12+
13+
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
14+
date -u -d "@$SOURCE_DATE_EPOCH" "$@" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "$@" 2>/dev/null || date -u "$@"

0 commit comments

Comments
 (0)