commit:     cfa5808aa9015e7c95effa493c22d20b524c9901
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Jun 30 12:51:32 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Jun 30 12:51:32 2022 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=cfa5808a

bootstrap-prefix.sh: fix fallback logic for bootstrap_coreutils

Signed-off-by: Sam James <sam <AT> gentoo.org>

 scripts/bootstrap-prefix.sh | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh
index 96d52d8390..039e6a5c61 100755
--- a/scripts/bootstrap-prefix.sh
+++ b/scripts/bootstrap-prefix.sh
@@ -1542,13 +1542,20 @@ bootstrap_stage1() {
                || [[ $(bison --version 2>&1) == *GNU" "Bison") "[3-9]* ]] \
                || (bootstrap_bison) || return 1
        if [[ -x ${ROOT}/tmp/usr/bin/uniq ]]; then
+               # If the system has a uniq, let's use it to test whether
+               # coreutils is new enough (and GNU).
                if [[ $(uniq --version 2>&1) == *"(GNU coreutils) "[6789]* ]]; 
then
                        CP="cp"
-               else
-                       CP="${ROOT}/tmp/bin/cp"
-                       (bootstrap_coreutils) || return 1
                fi
        fi
+
+       # But for e.g. OpenBSD, it isn't going to be, so if our test failed,
+       # bootstrap coreutils.
+       if [[ -z ${CP} ]] ; then
+               CP="${ROOT}/tmp/bin/cp"
+               (bootstrap_coreutils) || return 1
+       fi
+
        [[ -x ${ROOT}/tmp/usr/bin/find ]] \
                || [[ $(find --version 2>&1) == *GNU* ]] \
                || (bootstrap_findutils) || return 1

Reply via email to