blob: f5d091227edf0165da863dd040af6f7ff77f5709 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
#: * `postinstall` <formula>:
#: Rerun the post-install steps for <formula>.
require "sandbox"
module Homebrew
module_function
def postinstall
ARGV.resolved_formulae.each do |f|
ohai "Postinstalling #{f}"
run_post_install(f)
end
end
def run_post_install(formula)
args = %W[
nice #{RUBY_PATH}
-W0
-I #{HOMEBREW_LOAD_PATH}
--
#{HOMEBREW_LIBRARY_PATH}/postinstall.rb
#{formula.path}
].concat(ARGV.options_only)
if formula.head?
args << "--HEAD"
elsif formula.devel?
args << "--devel"
end
Sandbox.print_sandbox_message if Sandbox.formula?(formula)
Utils.safe_fork do
if Sandbox.formula?(formula)
sandbox = Sandbox.new
formula.logs.mkpath
sandbox.record_log(formula.logs/"postinstall.sandbox.log")
sandbox.allow_write_temp_and_cache
sandbox.allow_write_log(formula)
sandbox.allow_write_xcode
sandbox.deny_write_homebrew_repository
sandbox.allow_write_cellar(formula)
Keg::TOP_LEVEL_DIRECTORIES.each do |dir|
sandbox.allow_write_path "#{HOMEBREW_PREFIX}/#{dir}"
end
sandbox.exec(*args)
else
exec(*args)
end
end
end
end
|