diff options
author | Andrew Robbins <contact@andrewrobbins.info> | 2017-07-17 18:20:12 -0400 |
---|---|---|
committer | Andrew Robbins <contact@andrewrobbins.info> | 2017-07-18 21:43:22 -0400 |
commit | a7d5ea15f3f233263eebc9818004bec3a46c1087 (patch) | |
tree | 9c228b07e5f6a113e6c48a54548764724abf736f | |
parent | 86cee2e3bab8df116fe856af34a99f11896f000e (diff) | |
download | librebootfr-a7d5ea15f3f233263eebc9818004bec3a46c1087.tar.gz librebootfr-a7d5ea15f3f233263eebc9818004bec3a46c1087.zip |
Simplify libreboot_setup_variables() w/ new func.
Reproducibility-related variable assignments are moved to a separate
function in order to make libreboot_setup_variables() less busy.
-rwxr-xr-x | libreboot | 42 |
1 files changed, 23 insertions, 19 deletions
@@ -173,6 +173,28 @@ libreboot_setup_variables() { local epoch_path="${root}/${DOTEPOCH}" local rnd_seed_path="${root}/${DOTRNDSEED}" + if [[ -z "${VERSION}" ]]; then + if git_check "${root}"; then + VERSION="${BUILD_SYSTEM}-$(git_describe "${root}" 2> /dev/null || echo 'git')" + elif [[ -f "${version_path}" ]]; then + VERSION="$(cat "${version_path}")" + else + VERSION="${BUILD_SYSTEM}" + fi + fi + + if [[ -d "${vboot_tools_path}/devkeys/" ]]; then + VBOOT_KEYS_PATH="${VBOOT_KEYS_PATH:-${vboot_tools_path}/devkeys/}" + fi + + CONFIG_SHELL="${CONFIG_SHELL:-$(which bash)}" + EDITOR="${EDITOR:-$(which vi || true)}" + TASKS="${TASKS:-1}" + + libreboot_setup_reproducible_builds_variables +} + +libreboot_setup_reproducible_builds_variables() { # Used by GCC, e.g., -frandom-seed="${RANDOM_SEED}" if [[ -z "${RANDOM_SEED}" ]]; then if [[ -f "${rnd_seed_path}" ]]; then @@ -193,25 +215,7 @@ libreboot_setup_variables() { fi fi - if [[ -z "${VERSION}" ]]; then - if git_check "${root}"; then - VERSION="${BUILD_SYSTEM}-$(git_describe "${root}" 2> /dev/null || echo 'git')" - elif [[ -f "${version_path}" ]]; then - VERSION="$(cat "${version_path}")" - else - VERSION="${BUILD_SYSTEM}" - fi - fi - - if [[ -d "${vboot_tools_path}/devkeys/" ]]; then - VBOOT_KEYS_PATH="${VBOOT_KEYS_PATH:-${vboot_tools_path}/devkeys/}" - fi - - CONFIG_SHELL="${CONFIG_SHELL:-$(which bash)}" - EDITOR="${EDITOR:-$(which vi || true)}" - TASKS="${TASKS:-1}" - - # Environment variables useful for creating reproducible builds + # Relevant only when libfaketime is preloaded if [[ -n "${LIBFAKETIME_PATH}" ]]; then BUILD_DATE_FMT="%Y-%m-%d %H:%M:%S" BUILD_DATE="$(date -u -d "@${SOURCE_DATE_EPOCH}" "+${BUILD_DATE_FMT}" 2>/dev/null || date -u -r "${SOURCE_DATE_EPOCH}" "+${BUILD_DATE_FMT}" 2>/dev/null || date -u "+${BUILD_DATE_FMT}")" |