| 
									
										
										
										
											2015-04-13 18:16:27 +08:00
										 |  |  | require "sandbox" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2013-09-01 13:56:35 +01:00
										 |  |  |   def postinstall | 
					
						
							| 
									
										
										
										
											2015-08-17 17:08:23 +02:00
										 |  |  |     ARGV.resolved_formulae.each { |f| run_post_install(f) if f.post_install_defined? } | 
					
						
							| 
									
										
										
										
											2015-04-13 18:16:27 +08:00
										 |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def run_post_install(formula) | 
					
						
							|  |  |  |     args = %W[
 | 
					
						
							|  |  |  |       nice #{RUBY_PATH} | 
					
						
							|  |  |  |       -W0 | 
					
						
							| 
									
										
										
										
											2015-04-28 22:37:27 -04:00
										 |  |  |       -I #{HOMEBREW_LOAD_PATH} | 
					
						
							| 
									
										
										
										
											2015-04-13 18:16:27 +08:00
										 |  |  |       -- | 
					
						
							|  |  |  |       #{HOMEBREW_LIBRARY_PATH}/postinstall.rb | 
					
						
							|  |  |  |       #{formula.path} | 
					
						
							|  |  |  |     ].concat(ARGV.options_only) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-10-10 11:19:22 +08:00
										 |  |  |     if formula.head? | 
					
						
							|  |  |  |       args << "--HEAD" | 
					
						
							|  |  |  |     elsif formula.devel? | 
					
						
							|  |  |  |       args << "--devel" | 
					
						
							|  |  |  |     end | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-08-14 17:35:14 +01:00
										 |  |  |     Sandbox.print_sandbox_message if Sandbox.formula?(formula) | 
					
						
							| 
									
										
										
										
											2015-07-21 14:47:37 +08:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-13 18:16:27 +08:00
										 |  |  |     Utils.safe_fork do | 
					
						
							| 
									
										
										
										
											2016-08-14 17:35:14 +01:00
										 |  |  |       if Sandbox.formula?(formula) | 
					
						
							| 
									
										
										
										
											2015-04-13 18:16:27 +08:00
										 |  |  |         sandbox = Sandbox.new | 
					
						
							| 
									
										
										
										
											2015-04-25 22:07:06 -04:00
										 |  |  |         formula.logs.mkpath | 
					
						
							| 
									
										
										
										
											2016-05-27 01:53:08 -04:00
										 |  |  |         sandbox.record_log(formula.logs/"postinstall.sandbox.log") | 
					
						
							| 
									
										
										
										
											2015-04-13 18:16:27 +08:00
										 |  |  |         sandbox.allow_write_temp_and_cache | 
					
						
							|  |  |  |         sandbox.allow_write_log(formula) | 
					
						
							|  |  |  |         sandbox.allow_write_cellar(formula) | 
					
						
							| 
									
										
										
										
											2015-08-25 17:34:52 +01:00
										 |  |  |         sandbox.allow_write_xcode | 
					
						
							| 
									
										
										
										
											2015-04-13 18:16:27 +08:00
										 |  |  |         sandbox.allow_write_path HOMEBREW_PREFIX | 
					
						
							| 
									
										
										
										
											2015-04-23 12:33:54 +08:00
										 |  |  |         sandbox.deny_write_homebrew_library | 
					
						
							| 
									
										
										
										
											2015-04-13 18:16:27 +08:00
										 |  |  |         sandbox.exec(*args) | 
					
						
							|  |  |  |       else | 
					
						
							|  |  |  |         exec(*args) | 
					
						
							|  |  |  |       end | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											2013-09-01 13:56:35 +01:00
										 |  |  |   end | 
					
						
							|  |  |  | end |