Only show “sudo” message when it is actually needed.
This commit is contained in:
parent
f4965685ba
commit
89f4d153a2
@ -21,9 +21,10 @@ module Hbc
|
||||
return if Hbc.caskroom.exist?
|
||||
|
||||
ohai "Creating Caskroom at #{Hbc.caskroom}"
|
||||
ohai "We'll set permissions properly so we won't need sudo in the future"
|
||||
sudo = !Hbc.caskroom.parent.writable?
|
||||
|
||||
ohai "We'll set permissions properly so we won't need sudo in the future" if sudo
|
||||
|
||||
SystemCommand.run("/bin/mkdir", args: ["-p", Hbc.caskroom], sudo: sudo)
|
||||
SystemCommand.run("/bin/chmod", args: ["g+rwx", Hbc.caskroom], sudo: sudo)
|
||||
SystemCommand.run("/usr/sbin/chown", args: [Utils.current_user, Hbc.caskroom], sudo: sudo)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user