aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMax Howell2010-04-06 13:58:56 +0100
committerMax Howell2012-03-09 12:08:51 +0000
commitca5bccd2d984589ad0f5abdebb215bc1f6059eae (patch)
tree971cc76b8b6dcaea7efc4c2fb84090dcd04c1120
parent16352d90b492a05a1feb09a0a1e475235eb37f60 (diff)
downloadbrew-ca5bccd2d984589ad0f5abdebb215bc1f6059eae.tar.bz2
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.
-rw-r--r--install_homebrew.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/install_homebrew.rb b/install_homebrew.rb
index 66c78d154..572b315c4 100644
--- a/install_homebrew.rb
+++ b/install_homebrew.rb
@@ -1,5 +1,10 @@
#!/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
# script will not "just work" if you change the destination directory. However
# please feel free to fork it and make that possible.
@@ -75,10 +80,14 @@ end
####################################################################### script
abort "/usr/local/.git already exists!" if File.directory? "/usr/local/.git"
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")
- ohai "The user #{`whoami`.strip} will be added to the staff group."
-end
+ dscl /Local/Default -append /Groups/staff GroupMembership $USER
+EOABORT
ohai "This script will install:"
puts "/usr/local/bin/brew"
@@ -103,10 +112,6 @@ puts
puts "Press enter to continue"
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"
sudo "/bin/chmod", "g+w", *chmods unless chmods.empty?
# all admin users are in staff