mirror of
https://github.com/donl/homebrew-cask-versions.git
synced 2026-07-17 14:26:45 -06:00
chown can only be run as root
The logic here was flawed -- my caskroom.parent was writeable, but chown was called regardless, causing an error.
This commit is contained in:
parent
c17fd52cd3
commit
83d5e7dfe4
1 changed files with 7 additions and 3 deletions
10
lib/cask.rb
10
lib/cask.rb
|
|
@ -40,9 +40,13 @@ class Cask
|
|||
ohai "We need to make Caskroom for the first time at #{caskroom}"
|
||||
ohai "We'll set permissions properly so we won't need sudo in the future"
|
||||
current_user = ENV['USER']
|
||||
sudo = 'sudo' unless caskroom.parent.writable?
|
||||
system "#{sudo} mkdir -p #{caskroom}"
|
||||
system "#{sudo} chown -R #{current_user}:staff #{caskroom.parent}"
|
||||
if caskroom.parent.writable?
|
||||
system "mkdir #{caskroom}"
|
||||
else
|
||||
# sudo in system is rude.
|
||||
system "sudo mkdir -p #{caskroom}"
|
||||
system "sudo chown -R #{current_user}:staff #{caskroom.parent}"
|
||||
end
|
||||
end
|
||||
appdir.mkpath unless appdir.exist?
|
||||
qlplugindir.mkpath unless qlplugindir.exist?
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue