mkarchiso: read SOURCE_DATE_EPOCH from file early

When restarting an interrupted build, SOURCE_DATE_EPOCH needs to be
available before `profiledef.sh` is read, since it may reference it.

Fixes 7c6f266ec9
This commit is contained in:
nl6720 2023-03-16 09:45:00 +02:00
parent ce8fdedbf7
commit 8cc0e9e5b0
No known key found for this signature in database
GPG Key ID: 5CE88535E188D369
2 changed files with 12 additions and 6 deletions

View File

@ -23,10 +23,13 @@ Deprecated
Fixed Fixed
----- -----
<<<<<<< HEAD
- Wait for ``network-online.target`` to become active before trying to download the script passed via the ``script=`` - Wait for ``network-online.target`` to become active before trying to download the script passed via the ``script=``
boot parameter. boot parameter.
- Subdirectories from ``grub/`` are copied to the ISO. - Subdirectories from ``grub/`` are copied to the ISO.
- Modify the commandline options to a ``cp`` command in ``mkarchiso`` so that the entire script does not exit with failure when a custom ``.bashrc`` file is supplied with the archiso configuration. This fix was needed after **GNU Coreutils** recently changed the behaviour of the ``-n`` (or ``--no-clobber``) commandline option to the ``cp`` command. - Modify the commandline options to a ``cp`` command in ``mkarchiso`` so that the entire script does not exit with failure when a custom ``.bashrc`` file is supplied with the archiso configuration. This fix was needed after **GNU Coreutils** recently changed the behaviour of the ``-n`` (or ``--no-clobber``) commandline option to the ``cp`` command.
- Ensure ``SOURCE_DATE_EPOCH`` is read from the ``build_date`` file before ``profiledef.sh`` is sourced to ensure the
variable has a correct value when used inside ``profiledef.sh``.
Removed Removed
------- -------

View File

@ -1742,12 +1742,8 @@ _build_iso_base() {
# Create working directory # Create working directory
[[ -d "${work_dir}" ]] || install -d -- "${work_dir}" [[ -d "${work_dir}" ]] || install -d -- "${work_dir}"
# Write build date to file or if the file exists, read it from there # Write build date to file if it does not exist already
if [[ -e "${work_dir}/build_date" ]]; then [[ -e "${work_dir}/build_date" ]] || printf '%s\n' "$SOURCE_DATE_EPOCH" > "${work_dir}/build_date"
SOURCE_DATE_EPOCH="$(<"${work_dir}/build_date")"
else
printf '%s\n' "$SOURCE_DATE_EPOCH" > "${work_dir}/build_date"
fi
[[ "${quiet}" == "y" ]] || _show_config [[ "${quiet}" == "y" ]] || _show_config
_run_once _make_pacman_conf _run_once _make_pacman_conf
@ -1863,6 +1859,13 @@ fi
# get the absolute path representation of the first non-option argument # get the absolute path representation of the first non-option argument
profile="$(realpath -- "${1}")" profile="$(realpath -- "${1}")"
# Read SOURCE_DATE_EPOCH from file early
build_date_file="$(realpath -q -- "${override_work_dir:-./work}/build_date")" || :
if [[ -f "$build_date_file" ]]; then
SOURCE_DATE_EPOCH="$(<"$build_date_file")"
fi
unset build_date_file
_read_profile _read_profile
_set_overrides _set_overrides
_validate_options _validate_options