Only abort if user is not in staff group
Rationale: We aren't sure if the suggested command works on 10.5 and this is an edge case.
This commit is contained in:
parent
16352d90b4
commit
ca5bccd2d9
@ -1,5 +1,10 @@
|
|||||||
#!/usr/bin/ruby
|
#!/usr/bin/ruby
|
||||||
#
|
#
|
||||||
|
# Download and execute this script in one-line with no temporary files:
|
||||||
|
#
|
||||||
|
# ruby -e "$(curl http://gist.github.com/raw/323731/install_homebrew.rb)"
|
||||||
|
#
|
||||||
|
#
|
||||||
# I deliberately didn't DRY /usr/local references into a variable as this
|
# I deliberately didn't DRY /usr/local references into a variable as this
|
||||||
# script will not "just work" if you change the destination directory. However
|
# script will not "just work" if you change the destination directory. However
|
||||||
# please feel free to fork it and make that possible.
|
# please feel free to fork it and make that possible.
|
||||||
@ -75,10 +80,14 @@ end
|
|||||||
####################################################################### script
|
####################################################################### script
|
||||||
abort "/usr/local/.git already exists!" if File.directory? "/usr/local/.git"
|
abort "/usr/local/.git already exists!" if File.directory? "/usr/local/.git"
|
||||||
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"
|
||||||
|
This script requires the user #{ENV['USER']} to be in the staff group. If this
|
||||||
|
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
|
||||||
|
the following command should work:
|
||||||
|
|
||||||
unless `groups`.split.include?("staff")
|
dscl /Local/Default -append /Groups/staff GroupMembership $USER
|
||||||
ohai "The user #{`whoami`.strip} will be added to the staff group."
|
EOABORT
|
||||||
end
|
|
||||||
|
|
||||||
ohai "This script will install:"
|
ohai "This script will install:"
|
||||||
puts "/usr/local/bin/brew"
|
puts "/usr/local/bin/brew"
|
||||||
@ -103,10 +112,6 @@ puts
|
|||||||
puts "Press enter to continue"
|
puts "Press enter to continue"
|
||||||
abort unless getc == 13
|
abort unless getc == 13
|
||||||
|
|
||||||
unless `groups`.split.include?("staff")
|
|
||||||
sudo "dscl /Local/Default -append /Groups/staff GroupMembership #{`whoami`.strip}"
|
|
||||||
end
|
|
||||||
|
|
||||||
if File.directory? "/usr/local"
|
if File.directory? "/usr/local"
|
||||||
sudo "/bin/chmod", "g+w", *chmods unless chmods.empty?
|
sudo "/bin/chmod", "g+w", *chmods unless chmods.empty?
|
||||||
# all admin users are in staff
|
# all admin users are in staff
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user