Skip to content

Commit

Permalink
Moved the root check up higher.
Browse files Browse the repository at this point in the history
  • Loading branch information
wayneeseguin committed Mar 4, 2010
1 parent 81e7a2f commit 0287c62
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions scripts/utility
Original file line number Diff line number Diff line change
Expand Up @@ -668,23 +668,25 @@ __rvm_gemset_select() {

# TODO: Remove next section after a several releases.
# Migrate original rvm global gem cache directory to $HOME/.gem/cache
if [[ -d "$rvm_path/gems/cache" ]] && [[ ! -L "$rvm_path/gems/cache" ]] ; then
if [[ ! -z "$(ls -A "$rvm_path"/gems/cache/)" ]] ; then
mv $rvm_path/gems/cache/* $HOME/.gem/cache/
if [[ "$(whoami)" != "root" ]] ; then
if [[ -d "$rvm_path/gems/cache" ]] && [[ ! -L "$rvm_path/gems/cache" ]] ; then
if [[ ! -z "$(ls -A "$rvm_path"/gems/cache/)" ]] ; then
mv $rvm_path/gems/cache/* $HOME/.gem/cache/
fi
rmdir $rvm_path/gems/cache
fi
rmdir $rvm_path/gems/cache
fi

if [[ "$(whoami)" != "root" ]] ; then
# Some sanity checking.
if [[ ! -d "$rvm_gems_cache_path" ]] ; then mkdir -p $rvm_gems_cache_path ; fi
# Some sanity checking.
if [[ ! -d "$rvm_gems_cache_path" ]] ; then
mkdir -p $rvm_gems_cache_path
fi
if [[ "$rvm_gems_cache_path" != "$rvm_gems_path/cache" ]] ; then
rm -f "$rvm_gems_path/cache"
ln -nfs "$rvm_gems_cache_path" "$rvm_gems_path/cache"
fi
chmod u+w "$rvm_gems_cache_path"
# /TODO
fi
chmod u+w "$rvm_gems_cache_path"
# /TODO

# Careful not to nuke system gems cache.
if [[ ! -z "$rvm_ruby_gem_home" ]] && [[ ! -z "$(echo $rvm_ruby_gem_home | awk '/rvm/')" ]] ; then
Expand Down

0 comments on commit 0287c62

Please sign in to comment.