diff options
author | James Le Cuirot <chewi@gentoo.org> | 2023-01-02 17:21:05 +0000 |
---|---|---|
committer | Sam James <sam@gentoo.org> | 2023-01-03 01:01:35 +0000 |
commit | 80d2c435a58d88cfe71f37378bffae35e072408f (patch) | |
tree | 20e8d95899e7b3d01b0d94714708f2fa7b418023 | |
parent | binutils-config: use portable Bash shebang (diff) | |
download | binutils-config-80d2c435a58d88cfe71f37378bffae35e072408f.tar.gz binutils-config-80d2c435a58d88cfe71f37378bffae35e072408f.tar.bz2 binutils-config-80d2c435a58d88cfe71f37378bffae35e072408f.zip |
Allow EPREFIX to be overridden for manipulating prefixed ROOT
This use case was totally broken. We need to hardcode BROOT instead, as
we don't want to source /lib/gentoo/functions.sh from ROOT
We did the same with gcc-config. This aligns the start of these scripts.
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Sam James <sam@gentoo.org>
-rwxr-xr-x | src/binutils-config | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/src/binutils-config b/src/binutils-config index 4219f93..37ea77c 100755 --- a/src/binutils-config +++ b/src/binutils-config @@ -1,28 +1,25 @@ #!/usr/bin/env bash -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # Format of /etc/env.d/binutils/: # config-TARGET: CURRENT=version for TARGET # TARGET-VER: has a TARGET and VER variable -EPREFIX="@GENTOO_EPREFIX@" -if [[ ${EPREFIX} == "@"GENTOO_EPREFIX"@" ]] ; then - EPREFIX="" -fi - : ${ROOT:=/} [[ ${ROOT} != */ ]] && ROOT="${ROOT}/" [[ ${ROOT} != /* ]] && ROOT="${PWD%/}/${ROOT}" - +BROOT="@GENTOO_EPREFIX@" +[[ ${BROOT} == @*@ ]] && BROOT="" +: ${EPREFIX="${BROOT}"} EROOT="${ROOT%/}${EPREFIX}/" -cd "${EPREFIX}/" +cd "${BROOT}/" trap ":" INT QUIT TSTP argv0=${0##*/} -FUNCTIONS_SH="${EPREFIX}/lib/gentoo/functions.sh" +FUNCTIONS_SH="${BROOT}/lib/gentoo/functions.sh" source ${FUNCTIONS_SH} || { echo "${argv0}: Could not source ${FUNCTIONS_SH}!" 1>&2 exit 1 |