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>
(cherry picked from commit 89920bac4c
)
Этот коммит содержится в:
родитель
234356a128
Коммит
e7f829bbb0
@ -7,4 +7,8 @@
|
|||||||
# Provide a way to override build date for reproducible build results
|
# Provide a way to override build date for reproducible build results
|
||||||
# See https://reproducible-builds.org/ for why this is good.
|
# See https://reproducible-builds.org/ for why this is good.
|
||||||
|
|
||||||
date --date="@${SOURCE_DATE_EPOCH:-$(date +%s)}" "$@"
|
# There are several different flavors of date(1) out there.
|
||||||
|
# Try a few different CLI options for date(1) to see which one works.
|
||||||
|
|
||||||
|
SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
|
||||||
|
date -u -d "@$SOURCE_DATE_EPOCH" "$@" 2>/dev/null || date -u -r "$SOURCE_DATE_EPOCH" "$@" 2>/dev/null || date -u "$@"
|
||||||
|
Загрузка…
Ссылка в новой задаче
Block a user