aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-03-22 11:42:37 -0400
committerMike Frysinger <vapier@gentoo.org>2012-03-22 11:42:37 -0400
commitebb7e22c1b55509f709a85189d04f23e1fcd24ce (patch)
tree47b163c4dccc91c2e47c8ae07aaac9e4b1a9d56a /gcc-config
parentgcc-config: fix -c behavior with cross-targets (diff)
downloadgcc-config-ebb7e22c1b55509f709a85189d04f23e1fcd24ce.tar.gz
gcc-config-ebb7e22c1b55509f709a85189d04f23e1fcd24ce.tar.bz2
gcc-config-ebb7e22c1b55509f709a85189d04f23e1fcd24ce.zip
gcc-config: check for write access to $ROOT rather than UID==0
Since we could be operating on a non-root user install (such as prefix), only check for write access to the $ROOT dir rather than `id` == 0. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'gcc-config')
-rwxr-xr-xgcc-config4
1 files changed, 3 insertions, 1 deletions
diff --git a/gcc-config b/gcc-config
index 275a747..5df8e14 100755
--- a/gcc-config
+++ b/gcc-config
@@ -308,7 +308,9 @@ switch_profile() {
local OLD_CC_COMP=
local GCC_PATH=
- [[ $(id -u) != "0" ]] && die "Must be root"
+ # Make sure we have write access to the dirs. Do not require `root`
+ # so that we work with prefix/cross/etc... setups that run as user.
+ [[ ! -w ${ROOT} ]] && die "need write access to ${ROOT}"
if is_cross_compiler ; then
ebegin "Switching cross-compiler to ${CC_COMP}"