| 
									
										
										
										
											2016-09-08 09:05:00 +01:00
										 |  |  | #:  * `postinstall` <formula>: | 
					
						
							|  |  |  | #:    Rerun the post-install steps for <formula>. | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-04-13 18:16:27 +08:00
										 |  |  | require "sandbox" | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2014-06-18 22:41:47 -05:00
										 |  |  | module Homebrew | 
					
						
							| 
									
										
										
										
											2016-09-26 01:44:51 +02:00
										 |  |  |   module_function | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-09-01 13:56:35 +01:00
										 |  |  |   def postinstall | 
					
						
							| 
									
										
										
										
											2017-05-03 09:00:17 +01:00
										 |  |  |     ARGV.resolved_formulae.each do |f| | 
					
						
							|  |  |  |       ohai "Postinstalling #{f}" | 
					
						
							|  |  |  |       run_post_install(f) | 
					
						
							|  |  |  |     end | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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) | 
					
						
							| 
									
										
										
										
											2015-08-25 17:34:52 +01:00
										 |  |  |         sandbox.allow_write_xcode | 
					
						
							| 
									
										
										
										
											2016-09-23 08:26:49 +01:00
										 |  |  |         sandbox.deny_write_homebrew_repository | 
					
						
							| 
									
										
										
										
											2016-10-11 09:36:20 +01:00
										 |  |  |         sandbox.allow_write_cellar(formula) | 
					
						
							| 
									
										
										
										
											2016-12-13 00:13:20 +00:00
										 |  |  |         Keg::TOP_LEVEL_DIRECTORIES.each do |dir| | 
					
						
							|  |  |  |           sandbox.allow_write_path "#{HOMEBREW_PREFIX}/#{dir}" | 
					
						
							|  |  |  |         end | 
					
						
							| 
									
										
										
										
											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 |