diff options
author | Roland Clobus <rclobus@rclobus.nl> | 2020-09-02 12:11:27 +0200 |
---|---|---|
committer | Luca Boccassi <bluca@debian.org> | 2021-01-15 09:22:29 +0000 |
commit | 95cd662f4e91438cc179a282c31a8b71ceb49715 (patch) | |
tree | b8a413aed09738faa45501d914409987a06f5f52 /functions | |
parent | 4d7c8c35e3df4a1d8b3000a18acf8019fcee266e (diff) | |
download | vyos-live-build-95cd662f4e91438cc179a282c31a8b71ceb49715.tar.gz vyos-live-build-95cd662f4e91438cc179a282c31a8b71ceb49715.zip |
Ensure that SOURCE_DATE_EPOCH is always set in all sub scripts.
When SOURCE_DATE_EPOCH was already set before 'lb config', also enable
UTC timestamps.
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/chroot.sh | 8 | ||||
-rwxr-xr-x | functions/configuration.sh | 13 |
2 files changed, 13 insertions, 8 deletions
diff --git a/functions/chroot.sh b/functions/chroot.sh index d62a4fad0..17a137ed7 100755 --- a/functions/chroot.sh +++ b/functions/chroot.sh @@ -29,13 +29,7 @@ Chroot () fi done - # Only pass SOURCE_DATE_EPOCH if its already set - if [ "${SOURCE_DATE_EPOCH:-}" != "" ] - then - ENV="${ENV} SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH}" - fi - - ${_LINUX32} chroot "${CHROOT}" /usr/bin/env -i HOME="/root" PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" TERM="${TERM}" DEBIAN_FRONTEND="${LB_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LB_DEBCONF_PRIORITY}" DEBCONF_NONINTERACTIVE_SEEN="true" DEBCONF_NOWARNINGS="true" ${ENV} ${COMMANDS} + ${_LINUX32} chroot "${CHROOT}" /usr/bin/env -i HOME="/root" PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin" TERM="${TERM}" DEBIAN_FRONTEND="${LB_DEBCONF_FRONTEND}" DEBIAN_PRIORITY="${LB_DEBCONF_PRIORITY}" DEBCONF_NONINTERACTIVE_SEEN="true" DEBCONF_NOWARNINGS="true" SOURCE_DATE_EPOCH=${SOURCE_DATE_EPOCH} ${ENV} ${COMMANDS} return ${?} } diff --git a/functions/configuration.sh b/functions/configuration.sh index f853dc263..fac1d0958 100755 --- a/functions/configuration.sh +++ b/functions/configuration.sh @@ -45,7 +45,18 @@ Prepare_config () LB_DISTRIBUTION_CHROOT="${LB_DISTRIBUTION_CHROOT:-${LB_DISTRIBUTION}}" LB_DISTRIBUTION_BINARY="${LB_DISTRIBUTION_BINARY:-${LB_DISTRIBUTION_CHROOT}}" - LB_UTC_TIME="${LB_UTC_TIME:-false}" + # Do a reproducible build, i.e. is SOURCE_DATE_EPOCH already set? + _REPRODUCIBLE="${SOURCE_DATE_EPOCH:-false}" + if [ "${_REPRODUCIBLE}" != "false" ]; then + _REPRODUCIBLE=true + fi + # For a reproducible build, use UTC per default, otherwise the local time + _UTC_TIME_DEFAULT=${_REPRODUCIBLE} + + # The current time: for a unified timestamp throughout the building process + export SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date '+%s')}" + + LB_UTC_TIME="${LB_UTC_TIME:-${_UTC_TIME_DEFAULT}}" # Set UTC option for use with `date` where applicable if [ "${LB_UTC_TIME}" = "true" ]; then DATE_UTC_OPTION="--utc" |