summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bezrukov <phmagic@mail.ru>2020-10-25 09:14:22 +0100
committerFabian Groffen <grobian@gentoo.org>2020-10-25 09:14:22 +0100
commit6b522acbb352eaae250d54b48456350ded50d7ce (patch)
tree901f6c0a238ab096fc337ee58d69cbe1dc4b0838
parentsys-apps/portage-3.0.8: version bump (diff)
downloadprefix-6b522acbb352eaae250d54b48456350ded50d7ce.tar.gz
prefix-6b522acbb352eaae250d54b48456350ded50d7ce.tar.bz2
prefix-6b522acbb352eaae250d54b48456350ded50d7ce.zip
scripts/bootstrap-prefix: fix stat invocation for Darwin/*BSD
Closes: https://bugs.gentoo.org/751037 Signed-off-by: Fabian Groffen <grobian@gentoo.org>
-rwxr-xr-xscripts/bootstrap-prefix.sh11
1 files 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."