aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAdam Vandenberg2009-08-25 11:25:47 -0700
committerMax Howell2009-08-29 13:30:34 +0100
commitbf8071f0aa9779e23d0bb342376c0be7e1ab0ec6 (patch)
treefd009647e146981168cad68a8056e6c2f7728897 /bin
parent5b6deb884548269dab4cce2b3f0b9fcb8f560e73 (diff)
downloadbrew-bf8071f0aa9779e23d0bb342376c0be7e1ab0ec6.tar.bz2
Use alternate Cache for root user.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/brew10
1 files changed, 8 insertions, 2 deletions
diff --git a/bin/brew b/bin/brew
index 813cb41a7..1c5b1573b 100755
--- a/bin/brew
+++ b/bin/brew
@@ -6,8 +6,14 @@ require 'ARGV+yeast'
require 'utils'
require 'brew.h'
-# TODO if whoami == root then use /Library/Caches/Homebrew instead
-HOMEBREW_CACHE=Pathname.new("~/Library/Caches/Homebrew").expand_path
+if Process.uid == 0
+ # technically this is not the correct place, this cache is for *all users*
+ # so in that case, maybe we should always use it, root or not?
+ HOMEBREW_CACHE=Pathname.new("/Library/Caches/Homebrew")
+else
+ HOMEBREW_CACHE=Pathname.new("~/Library/Caches/Homebrew").expand_path
+end
+
HOMEBREW_PREFIX=Pathname.new(__FILE__).dirname.parent.cleanpath
HOMEBREW_CELLAR=HOMEBREW_PREFIX+'Cellar'
HOMEBREW_VERSION='0.4'