From 6b522acbb352eaae250d54b48456350ded50d7ce Mon Sep 17 00:00:00 2001 From: Alexander Bezrukov Date: Sun, 25 Oct 2020 09:14:22 +0100 Subject: scripts/bootstrap-prefix: fix stat invocation for Darwin/*BSD Closes: https://bugs.gentoo.org/751037 Signed-off-by: Fabian Groffen --- scripts/bootstrap-prefix.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/bootstrap-prefix.sh b/scripts/bootstrap-prefix.sh index 3a9dd3cb87..313139c0e8 100755 --- a/scripts/bootstrap-prefix.sh +++ b/scripts/bootstrap-prefix.sh @@ -2687,8 +2687,15 @@ EOF EPREFIX= continue fi - if [[ $(stat -c '%U/%G' "${EPREFIX}"/.canihaswrite) != \ - $(stat -c '%U/%G' "${EPREFIX}") ]] ; + # GNU and BSD variants of stat take different arguments (and + # format specifiers are not equivalent) + case "${CHOST}" in + *-darwin* | *-freebsd*) STAT='stat -f %u/%g' ;; + *) STAT='stat -c %U/%G' ;; + esac + + if [[ $(${STAT} "${EPREFIX}"/.canihaswrite) != \ + $(${STAT} "${EPREFIX}") ]] ; then echo echo "The $EPREFIX directory has different ownership than expected." -- cgit v1.2.3-65-gdbad