blob: b5c947f4b1c4a184cd369413fc82c792633f520b (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
module Hbc
module Caskroom
module_function
def ensure_caskroom_exists
return if Hbc.caskroom.exist?
ohai "Creating Caskroom at #{Hbc.caskroom}" if $stdout.tty?
sudo = !Hbc.caskroom.parent.writable?
ohai "We'll set permissions properly so we won't need sudo in the future" if $stdout.tty? && 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)
SystemCommand.run("/usr/bin/chgrp", args: ["admin", Hbc.caskroom], sudo: sudo)
end
end
end
|