Use admin group and not staff
Staff is overly permissive, require user to be an Administrator to use Homebrew.
This commit is contained in:
parent
cadc0506f9
commit
98ec342ecc
@ -74,13 +74,11 @@ Dir.chdir "/usr"
|
|||||||
abort "MacOS too old, see: https://gist.github.com/1144389" if macos_version < 10.5
|
abort "MacOS too old, see: https://gist.github.com/1144389" if macos_version < 10.5
|
||||||
abort "/usr/local/.git already exists!" unless Dir["/usr/local/.git/*"].empty?
|
abort "/usr/local/.git already exists!" unless Dir["/usr/local/.git/*"].empty?
|
||||||
abort "Don't run this as root!" if Process.uid == 0
|
abort "Don't run this as root!" if Process.uid == 0
|
||||||
abort <<-EOABORT unless `groups`.split.include? "staff"
|
abort <<-EOABORT unless `groups`.split.include? "admin"
|
||||||
This script requires the user #{ENV['USER']} to be in the staff group. If this
|
This script requires the user #{ENV['USER']} to be an Administrator. If this
|
||||||
sucks for you then you can install Homebrew in your home directory or however
|
sucks for you then you can install Homebrew in your home directory or however
|
||||||
you please; please refer to the website. If you still want to use this script
|
you please; please refer to the website. If you still want to use this script
|
||||||
the following command should work:
|
set your user to be an Administrator in System Preferences or `su'.
|
||||||
|
|
||||||
dscl /Local/Default -append /Groups/staff GroupMembership $USER
|
|
||||||
EOABORT
|
EOABORT
|
||||||
|
|
||||||
ohai "This script will install:"
|
ohai "This script will install:"
|
||||||
@ -101,7 +99,7 @@ unless chmods.empty?
|
|||||||
puts *chmods
|
puts *chmods
|
||||||
end
|
end
|
||||||
unless chgrps.empty?
|
unless chgrps.empty?
|
||||||
ohai "The following directories will have their group set to #{Tty.underline 39}staff#{Tty.reset}:"
|
ohai "The following directories will have their group set to #{Tty.underline 39}admin#{Tty.reset}:"
|
||||||
puts *chgrps
|
puts *chgrps
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -113,13 +111,12 @@ end
|
|||||||
|
|
||||||
if File.directory? "/usr/local"
|
if File.directory? "/usr/local"
|
||||||
sudo "/bin/chmod", "g+rwx", *chmods unless chmods.empty?
|
sudo "/bin/chmod", "g+rwx", *chmods unless chmods.empty?
|
||||||
# all admin users are in staff
|
sudo "/usr/bin/chgrp", "admin", *chgrps unless chgrps.empty?
|
||||||
sudo "/usr/bin/chgrp", "staff", *chgrps unless chgrps.empty?
|
|
||||||
else
|
else
|
||||||
sudo "/bin/mkdir /usr/local"
|
sudo "/bin/mkdir /usr/local"
|
||||||
sudo "/bin/chmod g+rwx /usr/local"
|
sudo "/bin/chmod g+rwx /usr/local"
|
||||||
# the group is set to wheel by default for some reason
|
# the group is set to wheel by default for some reason
|
||||||
sudo "/usr/bin/chgrp staff /usr/local"
|
sudo "/usr/bin/chgrp admin /usr/local"
|
||||||
end
|
end
|
||||||
|
|
||||||
Dir.chdir "/usr/local" do
|
Dir.chdir "/usr/local" do
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user