parent
bae36f0830
commit
4c9ac19e87
@ -18,10 +18,6 @@ module Homebrew extend self
|
||||
end
|
||||
end unless ARGV.force?
|
||||
|
||||
if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
|
||||
raise "Cowardly refusing to `sudo brew install'\n#{SUDO_BAD_ERRMSG}"
|
||||
end
|
||||
|
||||
install_formulae ARGV.formulae
|
||||
end
|
||||
|
||||
|
||||
@ -5,10 +5,6 @@ module Homebrew extend self
|
||||
def link
|
||||
raise KegUnspecifiedError if ARGV.named.empty?
|
||||
|
||||
if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
|
||||
raise "Cowardly refusing to `sudo brew link'\n#{SUDO_BAD_ERRMSG}"
|
||||
end
|
||||
|
||||
mode = OpenStruct.new
|
||||
|
||||
mode.overwrite = true if ARGV.include? '--overwrite'
|
||||
|
||||
@ -2,9 +2,6 @@ require 'formula'
|
||||
|
||||
module Homebrew extend self
|
||||
def pin
|
||||
if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
|
||||
abort "Cowardly refusing to `sudo pin'"
|
||||
end
|
||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
||||
|
||||
ARGV.formulae.each do |f|
|
||||
|
||||
@ -2,9 +2,6 @@ require 'formula'
|
||||
|
||||
module Homebrew extend self
|
||||
def unpin
|
||||
if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
|
||||
abort "Cowardly refusing to `sudo unpin'"
|
||||
end
|
||||
raise FormulaUnspecifiedError if ARGV.named.empty?
|
||||
|
||||
ARGV.formulae.each do |f|
|
||||
|
||||
@ -8,12 +8,6 @@ end
|
||||
|
||||
module Homebrew extend self
|
||||
def upgrade
|
||||
if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
|
||||
# note we only abort if Homebrew is *not* installed as sudo and the user
|
||||
# calls brew as root. The fix is to chown brew to root.
|
||||
abort "Cowardly refusing to `sudo brew upgrade'"
|
||||
end
|
||||
|
||||
Homebrew.perform_preinstall_checks
|
||||
|
||||
if ARGV.named.empty?
|
||||
|
||||
@ -213,11 +213,3 @@ class ChecksumMismatchError < RuntimeError
|
||||
super + advice.to_s
|
||||
end
|
||||
end
|
||||
|
||||
module Homebrew extend self
|
||||
SUDO_BAD_ERRMSG = <<-EOS.undent
|
||||
You can use brew with sudo, but only if the brew executable is owned by root.
|
||||
However, this is both not recommended and completely unsupported so do so at
|
||||
your own risk.
|
||||
EOS
|
||||
end
|
||||
|
||||
@ -99,3 +99,9 @@ HOMEBREW_PULL_OR_COMMIT_URL_REGEX = 'https:\/\/github.com\/(\w+)\/homebrew(-\w+)
|
||||
require 'compat' unless ARGV.include? "--no-compat" or ENV['HOMEBREW_NO_COMPAT']
|
||||
|
||||
ORIGINAL_PATHS = ENV['PATH'].split(':').map{ |p| Pathname.new(p).expand_path rescue nil }.compact.freeze
|
||||
|
||||
SUDO_BAD_ERRMSG = <<-EOS.undent
|
||||
You can use brew with sudo, but only if the brew executable is owned by root.
|
||||
However, this is both not recommended and completely unsupported so do so at
|
||||
your own risk.
|
||||
EOS
|
||||
|
||||
@ -58,17 +58,17 @@ end
|
||||
begin
|
||||
trap("INT", std_trap) # restore default CTRL-C handler
|
||||
|
||||
aliases = {'ls' => :list,
|
||||
'homepage' => :home,
|
||||
'-S' => :search,
|
||||
'up' => :update,
|
||||
'ln' => :link,
|
||||
'instal' => :install, # gem does the same
|
||||
'rm' => :uninstall,
|
||||
'remove' => :uninstall,
|
||||
'configure' => :diy,
|
||||
'abv' => :info,
|
||||
'dr' => :doctor,
|
||||
aliases = {'ls' => 'list',
|
||||
'homepage' => 'home',
|
||||
'-S' => 'search',
|
||||
'up' => 'update',
|
||||
'ln' => 'link',
|
||||
'instal' => 'install', # gem does the same
|
||||
'rm' => 'uninstall',
|
||||
'remove' => 'uninstall',
|
||||
'configure' => 'diy',
|
||||
'abv' => 'info',
|
||||
'dr' => 'doctor',
|
||||
'--repo' => '--repository',
|
||||
'environment' => '--env' # same as gem
|
||||
}
|
||||
@ -76,11 +76,19 @@ begin
|
||||
cmd = ARGV.shift
|
||||
cmd = aliases[cmd] if aliases[cmd]
|
||||
|
||||
if cmd == '-c1'
|
||||
if cmd == '-c1' # Shortcut for one line of configuration
|
||||
cmd = '--config'
|
||||
ARGV.unshift('-1')
|
||||
end
|
||||
|
||||
sudo_check = Set.new %w[ install link pin unpin upgrade ]
|
||||
|
||||
if sudo_check.include? cmd
|
||||
if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
|
||||
raise "Cowardly refusing to `sudo brew #{cmd}`\n#{SUDO_BAD_ERRMSG}"
|
||||
end
|
||||
end
|
||||
|
||||
# Add example external commands to PATH before checking.
|
||||
ENV['PATH'] += ":#{HOMEBREW_REPOSITORY}/Library/Contributions/cmd"
|
||||
if require? HOMEBREW_REPOSITORY/"Library/Homebrew/cmd"/cmd
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user