aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMarkus Reiter2016-09-21 19:05:35 +0200
committerMarkus Reiter2016-09-21 19:05:35 +0200
commit530cee44c37fa02c06b04b18349a89817df920f3 (patch)
tree638e9c043d5d5342cabd530b587b1ff397a0b992 /Library
parent458a80d25a9370ae757f89f04b64486c0d72caea (diff)
downloadbrew-530cee44c37fa02c06b04b18349a89817df920f3.tar.bz2
Use `sudo mv` to move Caskroom.
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cask/lib/hbc/caskroom.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/Library/Homebrew/cask/lib/hbc/caskroom.rb b/Library/Homebrew/cask/lib/hbc/caskroom.rb
index b5443a8b7..7dcb35d41 100644
--- a/Library/Homebrew/cask/lib/hbc/caskroom.rb
+++ b/Library/Homebrew/cask/lib/hbc/caskroom.rb
@@ -6,12 +6,12 @@ module Hbc::Caskroom
if !Hbc.caskroom.exist? && repo_caskroom.directory?
ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX"
- unless Hbc.caskroom.parent.writable?
- opoo "#{Hbc.caskroom.parent} is not writable, changing owner to current user."
- system "/usr/bin/sudo", "--", "/usr/sbin/chown", "--", "#{Hbc::Utils.current_user}:staff", Hbc.caskroom.parent.to_s
+ if Hbc.caskroom.parent.writable?
+ FileUtils.mv repo_caskroom, Hbc.caskroom
+ else
+ opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
+ system "/usr/bin/sudo", "--", "/bin/mv", "--", repo_caskroom.to_s, Hbc.caskroom.parent.to_s
end
-
- FileUtils.mv repo_caskroom, Hbc.caskroom
end
end