passenger 4.0.10 → 4.0.13
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of passenger might be problematic. Click here for more details.
- data.tar.gz.asc +7 -7
- data/.gitignore +66 -0
- data/.travis.yml +2 -5
- data/CONTRIBUTORS +2 -1
- data/NEWS +24 -0
- data/README.md +5 -10
- data/bin/passenger +1 -0
- data/bin/passenger-config +29 -3
- data/bin/passenger-install-nginx-module +1 -1
- data/build/basics.rb +8 -2
- data/build/debian.rb +22 -0
- data/build/integration_tests.rb +16 -2
- data/build/misc.rb +3 -0
- data/build/packaging.rb +77 -29
- data/build/preprocessor.rb +13 -10
- data/build/test_basics.rb +6 -0
- data/debian.template/locations.ini.template +13 -0
- data/debian.template/ruby-passenger-dev.install.template +3 -0
- data/debian.template/ruby-passenger-doc.install.template +2 -0
- data/debian.template/ruby-passenger.install.template +12 -0
- data/debian.template/rules.template +1 -0
- data/dev/run_travis.sh +46 -14
- data/doc/Architectural overview.html +25 -34
- data/doc/Packaging.html +31 -23
- data/doc/Packaging.txt.md +32 -23
- data/doc/Security of user switching support.html +16 -18
- data/doc/Users guide Apache.html +231 -239
- data/doc/Users guide Nginx.html +219 -227
- data/doc/Users guide Standalone.html +12 -15
- data/doc/users_guide_snippets/installation.txt +3 -2
- data/ext/common/ApplicationPool2/Implementation.cpp +6 -16
- data/ext/common/Constants.h +1 -1
- data/ext/common/ResourceLocator.h +6 -6
- data/ext/common/UnionStation.h +11 -15
- data/ext/common/Utils/ProcessMetricsCollector.h +7 -4
- data/ext/common/agents/HelperAgent/AgentOptions.h +6 -0
- data/ext/common/agents/HelperAgent/Main.cpp +5 -0
- data/ext/common/agents/HelperAgent/RequestHandler.h +9 -1
- data/ext/common/agents/LoggingAgent/Main.cpp +4 -0
- data/ext/common/agents/Watchdog/Main.cpp +7 -0
- data/ext/nginx/config +1 -1
- data/ext/oxt/Readme.txt +15 -0
- data/helper-scripts/download_binaries/extconf.rb +83 -0
- data/lib/phusion_passenger.rb +78 -80
- data/lib/phusion_passenger/abstract_installer.rb +22 -8
- data/lib/phusion_passenger/console_text_template.rb +1 -1
- data/lib/phusion_passenger/loader_shared_helpers.rb +2 -1
- data/lib/phusion_passenger/native_support.rb +22 -9
- data/lib/phusion_passenger/packaging.rb +7 -2
- data/lib/phusion_passenger/platform_info.rb +28 -1
- data/lib/phusion_passenger/platform_info/apache.rb +246 -26
- data/lib/phusion_passenger/platform_info/apache_detector.rb +232 -0
- data/lib/phusion_passenger/platform_info/depcheck_specs/ruby.rb +4 -0
- data/lib/phusion_passenger/platform_info/linux.rb +7 -0
- data/lib/phusion_passenger/public_api.rb +11 -2
- data/lib/phusion_passenger/standalone/command.rb +11 -14
- data/lib/phusion_passenger/standalone/runtime_installer.rb +313 -275
- data/lib/phusion_passenger/standalone/runtime_locator.rb +163 -0
- data/lib/phusion_passenger/standalone/start_command.rb +38 -46
- data/lib/phusion_passenger/utils/json.rb +329 -0
- data/lib/phusion_passenger/utils/tmpio.rb +1 -0
- data/passenger.gemspec +4 -0
- data/resources/mime.types +1 -0
- data/resources/oss-binaries.phusionpassenger.com.crt +84 -0
- data/resources/release.txt +0 -0
- data/resources/templates/standalone/download_tool_missing.txt.erb +18 -0
- data/rpm/README.rdoc +117 -0
- data/rpm/config/apache-passenger.conf.in +19 -0
- data/rpm/config/nginx-passenger.conf.in +10 -0
- data/rpm/config/rubygem-passenger.te +10 -0
- data/rpm/doc/README.nginx-alternatives +5 -0
- data/rpm/doc/example_yum_repository_htaccess +5 -0
- data/rpm/doc/footer.shtml +12 -0
- data/rpm/doc/header.shtml +156 -0
- data/rpm/nginx-alternatives.spec +97 -0
- data/rpm/passenger-release.spec +91 -0
- data/rpm/passenger.spec +667 -0
- data/rpm/patches/passenger-force-native.patch +63 -0
- data/rpm/release/RPM-GPG-KEY-stealthymonkeys +33 -0
- data/rpm/release/build-release.sh +35 -0
- data/rpm/release/build.rb +301 -0
- data/rpm/release/create-mirrors.sh +16 -0
- data/rpm/release/mirrors +1 -0
- data/rpm/release/mock-repo/comps.xml +21 -0
- data/rpm/release/mock-repo/rubygem-daemon_controller-0.2.5-1.noarch.rpm +0 -0
- data/rpm/release/mock-repo/rubygem-file-tail-1.0.5-1.noarch.rpm +0 -0
- data/rpm/release/mock-repo/rubygem-spruz-0.2.2-1.noarch.rpm +0 -0
- data/rpm/release/mocksetup-first.sh +102 -0
- data/rpm/release/mocksetup.sh +67 -0
- data/test/integration_tests/apache2_tests.rb +1 -1
- data/test/integration_tests/downloaded_binaries_tests.rb +76 -0
- data/test/integration_tests/native_packaging_spec.rb +38 -6
- data/test/integration_tests/source_packaging_test.rb +198 -0
- data/test/integration_tests/standalone_tests.rb +275 -0
- data/test/ruby/admin_tools_spec.rb +1 -1
- data/test/ruby/rails4.0/loader_spec.rb +28 -0
- data/test/ruby/rails4.0/preloader_spec.rb +34 -0
- data/test/ruby/spec_helper.rb +5 -1
- data/test/ruby/standalone/runtime_installer_spec.rb +399 -0
- data/test/ruby/standalone/runtime_locator_spec.rb +214 -0
- data/test/stub/apache2/httpd.conf.erb +18 -1
- data/test/stub/rack/tmp/.gitignore +0 -0
- data/test/stub/rails2.3/log/.gitignore +1 -0
- data/test/stub/rails2.3/public/.gitignore +1 -0
- data/test/stub/rails2.3/tmp/cache/.gitignore +1 -0
- data/test/stub/rails2.3/tmp/pids/.gitignore +1 -0
- data/test/stub/rails2.3/tmp/sessions/.gitignore +1 -0
- data/test/stub/rails2.3/tmp/sockets/.gitignore +1 -0
- data/test/stub/rails3.0/.gitignore +4 -0
- data/test/stub/rails3.0/Gemfile +1 -1
- data/test/stub/rails3.0/Gemfile.lock +1 -1
- data/test/stub/rails3.0/lib/tasks/.gitkeep +0 -0
- data/test/stub/rails3.0/log/.gitignore +0 -0
- data/test/stub/rails3.0/public/stylesheets/.gitkeep +0 -0
- data/test/stub/rails3.0/vendor/plugins/.gitkeep +0 -0
- data/test/stub/rails3.1/.gitignore +15 -0
- data/test/stub/rails3.1/Gemfile +1 -1
- data/test/stub/rails3.1/Gemfile.lock +1 -1
- data/test/stub/rails3.1/app/mailers/.gitkeep +0 -0
- data/test/stub/rails3.1/app/models/.gitkeep +0 -0
- data/test/stub/rails3.1/lib/assets/.gitkeep +0 -0
- data/test/stub/rails3.1/lib/tasks/.gitkeep +0 -0
- data/test/stub/rails3.1/log/.gitkeep +0 -0
- data/test/stub/rails3.1/test/fixtures/.gitkeep +0 -0
- data/test/stub/rails3.1/test/functional/.gitkeep +0 -0
- data/test/stub/rails3.1/test/integration/.gitkeep +0 -0
- data/test/stub/rails3.1/test/unit/.gitkeep +0 -0
- data/test/stub/rails3.1/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/stub/rails3.1/vendor/plugins/.gitkeep +0 -0
- data/test/stub/rails3.2/.gitignore +15 -0
- data/test/stub/rails3.2/app/mailers/.gitkeep +0 -0
- data/test/stub/rails3.2/app/models/.gitkeep +0 -0
- data/test/stub/rails3.2/lib/assets/.gitkeep +0 -0
- data/test/stub/rails3.2/lib/tasks/.gitkeep +0 -0
- data/test/stub/rails3.2/log/.gitkeep +0 -0
- data/test/stub/rails3.2/test/fixtures/.gitkeep +0 -0
- data/test/stub/rails3.2/test/functional/.gitkeep +0 -0
- data/test/stub/rails3.2/test/integration/.gitkeep +0 -0
- data/test/stub/rails3.2/test/unit/.gitkeep +0 -0
- data/test/stub/rails3.2/vendor/assets/stylesheets/.gitkeep +0 -0
- data/test/stub/rails3.2/vendor/plugins/.gitkeep +0 -0
- data/test/stub/rails4.0/.gitignore +16 -0
- data/test/stub/rails4.0/Gemfile +45 -0
- data/test/stub/rails4.0/Gemfile.lock +126 -0
- data/test/stub/rails4.0/README.rdoc +28 -0
- data/test/stub/rails4.0/Rakefile +6 -0
- data/test/stub/rails4.0/app/assets/images/.keep +0 -0
- data/test/stub/rails4.0/app/assets/javascripts/application.js +16 -0
- data/test/stub/rails4.0/app/assets/stylesheets/application.css +13 -0
- data/test/stub/rails4.0/app/controllers/application_controller.rb +5 -0
- data/test/stub/rails4.0/app/controllers/concerns/.keep +0 -0
- data/test/stub/rails4.0/app/helpers/application_helper.rb +2 -0
- data/test/stub/rails4.0/app/mailers/.keep +0 -0
- data/test/stub/rails4.0/app/models/.keep +0 -0
- data/test/stub/rails4.0/app/models/concerns/.keep +0 -0
- data/test/stub/rails4.0/app/views/layouts/application.html.erb +14 -0
- data/test/stub/rails4.0/bin/bundle +3 -0
- data/test/stub/rails4.0/bin/rails +4 -0
- data/test/stub/rails4.0/bin/rake +4 -0
- data/test/stub/rails4.0/config.ru +4 -0
- data/test/stub/rails4.0/config/application.rb +23 -0
- data/test/stub/rails4.0/config/boot.rb +4 -0
- data/test/stub/rails4.0/config/database.yml +25 -0
- data/test/stub/rails4.0/config/environment.rb +5 -0
- data/test/stub/rails4.0/config/environments/development.rb +29 -0
- data/test/stub/rails4.0/config/environments/production.rb +80 -0
- data/test/stub/rails4.0/config/environments/test.rb +36 -0
- data/test/stub/rails4.0/config/initializers/backtrace_silencers.rb +7 -0
- data/test/stub/rails4.0/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/stub/rails4.0/config/initializers/inflections.rb +16 -0
- data/test/stub/rails4.0/config/initializers/mime_types.rb +5 -0
- data/test/stub/rails4.0/config/initializers/passenger.rb +1 -0
- data/test/stub/rails4.0/config/initializers/secret_token.rb +12 -0
- data/test/stub/rails4.0/config/initializers/session_store.rb +3 -0
- data/test/stub/rails4.0/config/initializers/wrap_parameters.rb +14 -0
- data/test/stub/rails4.0/config/locales/en.yml +23 -0
- data/test/stub/rails4.0/config/routes.rb +57 -0
- data/test/stub/rails4.0/db/seeds.rb +7 -0
- data/test/stub/rails4.0/lib/assets/.keep +0 -0
- data/test/stub/rails4.0/lib/tasks/.keep +0 -0
- data/test/stub/rails4.0/log/.keep +0 -0
- data/test/stub/rails4.0/public/404.html +58 -0
- data/test/stub/rails4.0/public/422.html +58 -0
- data/test/stub/rails4.0/public/500.html +57 -0
- data/test/stub/rails4.0/public/favicon.ico +0 -0
- data/test/stub/rails4.0/public/robots.txt +5 -0
- data/test/stub/rails4.0/test/controllers/.keep +0 -0
- data/test/stub/rails4.0/test/fixtures/.keep +0 -0
- data/test/stub/rails4.0/test/helpers/.keep +0 -0
- data/test/stub/rails4.0/test/integration/.keep +0 -0
- data/test/stub/rails4.0/test/mailers/.keep +0 -0
- data/test/stub/rails4.0/test/models/.keep +0 -0
- data/test/stub/rails4.0/test/test_helper.rb +15 -0
- data/test/stub/rails4.0/vendor/assets/javascripts/.keep +0 -0
- data/test/stub/rails4.0/vendor/assets/stylesheets/.keep +0 -0
- data/test/stub/rails_apps/1.2/empty/.gitignore +3 -0
- data/test/stub/rails_apps/1.2/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/1.2/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/1.2/empty/public/.htaccess +40 -0
- data/test/stub/rails_apps/1.2/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/.gitignore +3 -0
- data/test/stub/rails_apps/2.0/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.0/empty/public/.htaccess +40 -0
- data/test/stub/rails_apps/2.0/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/.gitignore +3 -0
- data/test/stub/rails_apps/2.2/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.2/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/.gitignore +3 -0
- data/test/stub/rails_apps/2.3/empty/app/models/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/db/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/empty/public/stylesheets/.gitignore +0 -0
- data/test/stub/rails_apps/2.3/mycook/public/.htaccess +42 -0
- data/test/stub/rails_apps/2.3/mycook/public/uploads/.gitignore +0 -0
- data/test/stub/wsgi/tmp/.gitignore +0 -0
- data/test/valgrind-osx.supp +7 -0
- metadata +162 -8
- metadata.gz.asc +7 -7
- data/debian.template/locations.ini +0 -12
- data/debian.template/ruby-passenger-dev.install +0 -3
- data/debian.template/ruby-passenger-doc.install +0 -2
- data/debian.template/ruby-passenger.install +0 -11
- data/resources/templates/installer_common/freebsd9_broken_cxx_runtime.txt.erb +0 -19
data/lib/phusion_passenger.rb
CHANGED
@@ -30,10 +30,10 @@ module PhusionPassenger
|
|
30
30
|
|
31
31
|
PACKAGE_NAME = 'passenger'
|
32
32
|
# Run 'rake ext/common/Constants.h' after changing this number.
|
33
|
-
VERSION_STRING = '4.0.
|
33
|
+
VERSION_STRING = '4.0.13'
|
34
34
|
|
35
|
-
PREFERRED_NGINX_VERSION = '1.4.
|
36
|
-
NGINX_SHA256_CHECKSUM = '
|
35
|
+
PREFERRED_NGINX_VERSION = '1.4.2'
|
36
|
+
NGINX_SHA256_CHECKSUM = '5361ffb7b0ebf8b1a04369bc3d1295eaed091680c1c58115f88d56c8e51f3611'
|
37
37
|
|
38
38
|
PREFERRED_PCRE_VERSION = '8.32'
|
39
39
|
PCRE_SHA256_CHECKSUM = 'd5d8634b36baf3d08be442a627001099583b397f456bc795304a013383b6423a'
|
@@ -44,7 +44,6 @@ module PhusionPassenger
|
|
44
44
|
###### Directories ######
|
45
45
|
|
46
46
|
GLOBAL_NAMESPACE_DIRNAME = "passenger"
|
47
|
-
GLOBAL_STANDALONE_NAMESPACE_DIRNAME = "passenger-standalone"
|
48
47
|
# Subdirectory under $HOME to use for storing stuff.
|
49
48
|
USER_NAMESPACE_DIRNAME = ".passenger"
|
50
49
|
|
@@ -55,11 +54,24 @@ module PhusionPassenger
|
|
55
54
|
"~/#{USER_NAMESPACE_DIRNAME}/plugins"
|
56
55
|
]
|
57
56
|
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
REQUIRED_LOCATIONS_INI_FIELDS = [
|
58
|
+
:bin_dir,
|
59
|
+
:agents_dir,
|
60
|
+
:lib_dir,
|
61
|
+
:helper_scripts_dir,
|
62
|
+
:resources_dir,
|
63
|
+
:include_dir,
|
64
|
+
:doc_dir,
|
65
|
+
:ruby_libdir,
|
66
|
+
:apache2_module_path,
|
67
|
+
:ruby_extension_source_dir,
|
68
|
+
:nginx_module_source_dir
|
69
|
+
].freeze
|
70
|
+
OPTIONAL_LOCATIONS_INI_FIELDS = [
|
71
|
+
# Directory in which downloaded Phusion Passenger binaries are stored.
|
72
|
+
# Only available when originally packaged.
|
73
|
+
:download_cache_dir
|
74
|
+
].freeze
|
63
75
|
|
64
76
|
# Follows the logic of ext/common/ResourceLocator.h, so don't forget to modify that too.
|
65
77
|
def self.locate_directories(source_root_or_location_configuration_file = nil)
|
@@ -68,32 +80,15 @@ module PhusionPassenger
|
|
68
80
|
|
69
81
|
if root_or_file && File.file?(root_or_file)
|
70
82
|
filename = root_or_file
|
71
|
-
options =
|
72
|
-
in_locations_section = false
|
73
|
-
File.open(filename, 'r') do |f|
|
74
|
-
while !f.eof?
|
75
|
-
line = f.readline
|
76
|
-
line.strip!
|
77
|
-
next if line.empty?
|
78
|
-
if line =~ /\A\[(.+)\]\Z/
|
79
|
-
in_locations_section = $1 == 'locations'
|
80
|
-
elsif in_locations_section && line =~ /=/
|
81
|
-
key, value = line.split(/ *= */, 2)
|
82
|
-
options[key.freeze] = value.freeze
|
83
|
-
end
|
84
|
-
end
|
85
|
-
end
|
83
|
+
options = parse_ini_file(filename)
|
86
84
|
|
87
85
|
@natively_packaged = get_bool_option(filename, options, 'natively_packaged')
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
@doc_dir = get_option(filename, options, 'doc').freeze
|
95
|
-
@apache2_module_path = get_option(filename, options, 'apache2_module').freeze
|
96
|
-
@ruby_extension_source_dir = get_option(filename, options, 'ruby_extension_source').freeze
|
86
|
+
REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
|
87
|
+
instance_variable_set("@#{field}", get_option(filename, options, field.to_s).freeze)
|
88
|
+
end
|
89
|
+
OPTIONAL_LOCATIONS_INI_FIELDS.each do |field|
|
90
|
+
instance_variable_set("@#{field}", get_option(filename, options, field.to_s, false).freeze)
|
91
|
+
end
|
97
92
|
else
|
98
93
|
@source_root = File.dirname(File.dirname(FILE_LOCATION))
|
99
94
|
@natively_packaged = false
|
@@ -104,8 +99,16 @@ module PhusionPassenger
|
|
104
99
|
@resources_dir = "#{@source_root}/resources".freeze
|
105
100
|
@include_dir = "#{@source_root}/ext".freeze
|
106
101
|
@doc_dir = "#{@source_root}/doc".freeze
|
102
|
+
@ruby_libdir = File.dirname(FILE_LOCATION)
|
107
103
|
@apache2_module_path = "#{@source_root}/buildout/apache2/mod_passenger.so".freeze
|
108
104
|
@ruby_extension_source_dir = "#{@source_root}/ext/ruby"
|
105
|
+
@nginx_module_source_dir = "#{@source_root}/ext/nginx"
|
106
|
+
@download_cache_dir = "#{@source_root}/download_cache"
|
107
|
+
REQUIRED_LOCATIONS_INI_FIELDS.each do |field|
|
108
|
+
if instance_variable_get("@#{field}").nil?
|
109
|
+
raise "BUG: @#{field} not set"
|
110
|
+
end
|
111
|
+
end
|
109
112
|
end
|
110
113
|
end
|
111
114
|
|
@@ -119,66 +122,42 @@ module PhusionPassenger
|
|
119
122
|
return @natively_packaged
|
120
123
|
end
|
121
124
|
|
125
|
+
# Whether the current Phusion Passenger installation is installed
|
126
|
+
# from a release package, e.g. an official gem or official tarball.
|
127
|
+
# Retruns false if e.g. the gem was built by the user, or if this
|
128
|
+
# install is from a git repository.
|
129
|
+
def self.installed_from_release_package?
|
130
|
+
File.exist?("#{resources_dir}/release.txt")
|
131
|
+
end
|
132
|
+
|
122
133
|
# When originally packaged, returns the source root.
|
123
134
|
# When natively packaged, returns the location of the location configuration file.
|
124
135
|
def self.source_root
|
125
136
|
return @source_root
|
126
137
|
end
|
127
|
-
|
128
|
-
def self.bin_dir
|
129
|
-
return @bin_dir
|
130
|
-
end
|
131
|
-
|
132
|
-
def self.agents_dir
|
133
|
-
return @agents_dir
|
134
|
-
end
|
135
|
-
|
136
|
-
def self.lib_dir
|
137
|
-
return @lib_dir
|
138
|
-
end
|
139
|
-
|
140
|
-
def self.helper_scripts_dir
|
141
|
-
return @helper_scripts_dir
|
142
|
-
end
|
143
|
-
|
144
|
-
def self.resources_dir
|
145
|
-
return @resources_dir
|
146
|
-
end
|
147
138
|
|
148
|
-
|
149
|
-
|
139
|
+
# Generate getters for the directory types in locations.ini.
|
140
|
+
getters_code = ""
|
141
|
+
@ruby_libdir = File.dirname(FILE_LOCATION)
|
142
|
+
(REQUIRED_LOCATIONS_INI_FIELDS + OPTIONAL_LOCATIONS_INI_FIELDS).each do |field|
|
143
|
+
getters_code << %Q{
|
144
|
+
def self.#{field}
|
145
|
+
return @#{field}
|
146
|
+
end
|
147
|
+
}
|
150
148
|
end
|
149
|
+
eval(getters_code, binding, __FILE__, __LINE__)
|
151
150
|
|
152
|
-
def self.doc_dir
|
153
|
-
return @doc_dir
|
154
|
-
end
|
155
151
|
|
156
|
-
|
157
|
-
@libdir ||= File.dirname(FILE_LOCATION)
|
158
|
-
end
|
152
|
+
###### Other resource locations ######
|
159
153
|
|
160
|
-
|
161
|
-
return @apache2_module_path
|
162
|
-
end
|
154
|
+
BINARIES_URL_ROOT = "https://oss-binaries.phusionpassenger.com/binaries/passenger/by_release"
|
163
155
|
|
164
|
-
def self.
|
165
|
-
return
|
166
|
-
end
|
167
|
-
|
168
|
-
def self.nginx_addon_dir
|
169
|
-
if PhusionPassenger.natively_packaged?
|
170
|
-
return "#{resources_dir}/ngx_http_passenger_module"
|
171
|
-
else
|
172
|
-
return "#{source_root}/ext/nginx"
|
173
|
-
end
|
156
|
+
def self.binaries_ca_cert_path
|
157
|
+
return "#{resources_dir}/oss-binaries.phusionpassenger.com.crt"
|
174
158
|
end
|
175
159
|
|
176
160
|
|
177
|
-
###### Other resource locations ######
|
178
|
-
|
179
|
-
STANDALONE_BINARIES_URL_ROOT = "http://standalone-binaries.modrails.com"
|
180
|
-
|
181
|
-
|
182
161
|
if !$LOAD_PATH.include?(ruby_libdir)
|
183
162
|
$LOAD_PATH.unshift(ruby_libdir)
|
184
163
|
$LOAD_PATH.uniq!
|
@@ -201,7 +180,7 @@ private
|
|
201
180
|
home_dir = ENV['HOME']
|
202
181
|
end
|
203
182
|
if home_dir && !home_dir.empty?
|
204
|
-
filename = "#{home_dir}
|
183
|
+
filename = "#{home_dir}/#{USER_NAMESPACE_DIRNAME}/locations.ini"
|
205
184
|
return filename if File.exist?(filename)
|
206
185
|
end
|
207
186
|
|
@@ -211,6 +190,25 @@ private
|
|
211
190
|
return nil
|
212
191
|
end
|
213
192
|
|
193
|
+
def self.parse_ini_file(filename)
|
194
|
+
options = {}
|
195
|
+
in_locations_section = false
|
196
|
+
File.open(filename, 'r') do |f|
|
197
|
+
while !f.eof?
|
198
|
+
line = f.readline
|
199
|
+
line.strip!
|
200
|
+
next if line.empty?
|
201
|
+
if line =~ /\A\[(.+)\]\Z/
|
202
|
+
in_locations_section = $1 == 'locations'
|
203
|
+
elsif in_locations_section && line =~ /=/
|
204
|
+
key, value = line.split(/ *= */, 2)
|
205
|
+
options[key.freeze] = value.freeze
|
206
|
+
end
|
207
|
+
end
|
208
|
+
end
|
209
|
+
return options
|
210
|
+
end
|
211
|
+
|
214
212
|
def self.get_option(filename, options, key, required = true)
|
215
213
|
value = options[key]
|
216
214
|
if value
|
@@ -27,6 +27,7 @@ require 'phusion_passenger/console_text_template'
|
|
27
27
|
require 'phusion_passenger/platform_info'
|
28
28
|
require 'phusion_passenger/platform_info/operating_system'
|
29
29
|
require 'phusion_passenger/utils/ansi_colors'
|
30
|
+
require 'fileutils'
|
30
31
|
|
31
32
|
# IMPORTANT: do not directly or indirectly require native_support; we can't compile
|
32
33
|
# it yet until we have a compiler, and installers usually check whether a compiler
|
@@ -159,11 +160,7 @@ protected
|
|
159
160
|
end
|
160
161
|
|
161
162
|
def check_whether_os_is_broken
|
162
|
-
|
163
|
-
new_screen
|
164
|
-
render_template 'installer_common/freebsd9_broken_cxx_runtime'
|
165
|
-
wait
|
166
|
-
end
|
163
|
+
# No known broken OSes at the moment.
|
167
164
|
end
|
168
165
|
|
169
166
|
def check_whether_system_has_enough_ram(required = 1024)
|
@@ -341,11 +338,28 @@ protected
|
|
341
338
|
sh!("#{PlatformInfo.rake_command} #{args.join(' ')}")
|
342
339
|
end
|
343
340
|
|
344
|
-
def download(url, output)
|
341
|
+
def download(url, output, options = {})
|
342
|
+
if options[:use_cache] && cache_dir = PhusionPassenger.download_cache_dir
|
343
|
+
basename = url.sub(/.*\//, '')
|
344
|
+
if File.exist?("#{cache_dir}/#{basename}")
|
345
|
+
puts "Copying #{basename} from #{cache_dir}..."
|
346
|
+
FileUtils.cp("#{cache_dir}/#{basename}", output)
|
347
|
+
return true
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
args = []
|
345
352
|
if PlatformInfo.find_command("wget")
|
346
|
-
|
353
|
+
if options[:cacert]
|
354
|
+
args << "--ca-certificate=#{options[:cacert]}"
|
355
|
+
end
|
356
|
+
return sh("wget", "--tries=3", "-O", output, url, *args)
|
347
357
|
else
|
348
|
-
|
358
|
+
if options[:cacert]
|
359
|
+
args << "--cacert"
|
360
|
+
args << options[:cacert]
|
361
|
+
end
|
362
|
+
return sh("curl", url, "-f", "-L", "-o", output, *args)
|
349
363
|
end
|
350
364
|
end
|
351
365
|
end
|
@@ -262,7 +262,8 @@ module LoaderSharedHelpers
|
|
262
262
|
|
263
263
|
def advertise_sockets(output, request_handler)
|
264
264
|
request_handler.server_sockets.each_pair do |name, options|
|
265
|
-
|
265
|
+
concurrency = PhusionPassenger.advertised_concurrency_level || options[:concurrency]
|
266
|
+
output.puts "!> socket: #{name};#{options[:address]};#{options[:protocol]};#{concurrency}"
|
266
267
|
end
|
267
268
|
end
|
268
269
|
|
@@ -24,17 +24,24 @@
|
|
24
24
|
module PhusionPassenger
|
25
25
|
|
26
26
|
class NativeSupportLoader
|
27
|
-
def supported?
|
27
|
+
def self.supported?
|
28
28
|
return !defined?(RUBY_ENGINE) || RUBY_ENGINE == "ruby" || RUBY_ENGINE == "rbx"
|
29
29
|
end
|
30
|
+
|
31
|
+
def try_load
|
32
|
+
if defined?(NativeSupport)
|
33
|
+
return true
|
34
|
+
else
|
35
|
+
require 'phusion_passenger'
|
36
|
+
load_from_native_support_output_dir ||
|
37
|
+
load_from_source_root ||
|
38
|
+
load_from_load_path ||
|
39
|
+
load_from_home_dir
|
40
|
+
end
|
41
|
+
end
|
30
42
|
|
31
43
|
def start
|
32
|
-
|
33
|
-
load_from_native_support_output_dir ||
|
34
|
-
load_from_source_root ||
|
35
|
-
load_from_load_path ||
|
36
|
-
load_from_home_dir ||
|
37
|
-
compile_and_load
|
44
|
+
try_load || download_binary_and_load || compile_and_load
|
38
45
|
end
|
39
46
|
|
40
47
|
private
|
@@ -120,6 +127,11 @@ private
|
|
120
127
|
return false
|
121
128
|
end
|
122
129
|
end
|
130
|
+
|
131
|
+
def download_binary_and_load
|
132
|
+
# TODO
|
133
|
+
return false
|
134
|
+
end
|
123
135
|
|
124
136
|
def compile_and_load
|
125
137
|
STDERR.puts "*** Phusion Passenger: no #{library_name} found for " +
|
@@ -224,5 +236,6 @@ end
|
|
224
236
|
|
225
237
|
end
|
226
238
|
|
227
|
-
|
228
|
-
|
239
|
+
if PhusionPassenger::NativeSupportLoader.supported?
|
240
|
+
PhusionPassenger::NativeSupportLoader.new.start
|
241
|
+
end
|
@@ -54,6 +54,7 @@ module Packaging
|
|
54
54
|
# A list of globs which match all files that should be packaged
|
55
55
|
# in the Phusion Passenger gem or tarball.
|
56
56
|
GLOB = [
|
57
|
+
'.gitignore',
|
57
58
|
'.travis.yml',
|
58
59
|
'configure',
|
59
60
|
'Rakefile',
|
@@ -72,7 +73,8 @@ module Packaging
|
|
72
73
|
'doc/**/*',
|
73
74
|
'man/*',
|
74
75
|
'debian.template/**/*',
|
75
|
-
'
|
76
|
+
'rpm/**/*',
|
77
|
+
'helper-scripts/**/*',
|
76
78
|
'ext/common/**/*.{cpp,c,h,hpp,md,erb}',
|
77
79
|
'ext/apache2/*.{cpp,h,hpp,c}',
|
78
80
|
'ext/nginx/*.{c,cpp,h}',
|
@@ -88,6 +90,7 @@ module Packaging
|
|
88
90
|
'ext/libeio/{*.h,*.c}',
|
89
91
|
'ext/oxt/*.hpp',
|
90
92
|
'ext/oxt/*.cpp',
|
93
|
+
'ext/oxt/*.txt',
|
91
94
|
'ext/oxt/detail/*.hpp',
|
92
95
|
'ext/ruby/*.{c,rb}',
|
93
96
|
'dev/*',
|
@@ -95,13 +98,15 @@ module Packaging
|
|
95
98
|
'test/.rspec',
|
96
99
|
'test/*.example',
|
97
100
|
'test/*.travis',
|
101
|
+
'test/*.supp',
|
98
102
|
'test/support/*.{c,cpp,h,rb}',
|
99
103
|
'test/tut/*',
|
100
104
|
'test/cxx/**/*.{cpp,h}',
|
101
105
|
'test/oxt/*.{cpp,hpp}',
|
102
106
|
'test/ruby/**/*',
|
103
107
|
'test/integration_tests/**/*',
|
104
|
-
'test/stub/**/*'
|
108
|
+
'test/stub/**/*',
|
109
|
+
'test/stub/**/.*'
|
105
110
|
]
|
106
111
|
|
107
112
|
EXCLUDE_GLOB = [
|
@@ -346,7 +346,8 @@ public
|
|
346
346
|
return nil
|
347
347
|
end
|
348
348
|
else
|
349
|
-
ENV['PATH'].to_s.split(File::PATH_SEPARATOR).
|
349
|
+
ENV['PATH'].to_s.split(File::PATH_SEPARATOR).each do |directory|
|
350
|
+
next if directory.empty?
|
350
351
|
path = File.join(directory, name)
|
351
352
|
if File.file?(path) && File.executable?(path)
|
352
353
|
return path
|
@@ -355,6 +356,32 @@ public
|
|
355
356
|
return nil
|
356
357
|
end
|
357
358
|
end
|
359
|
+
|
360
|
+
def self.find_all_commands(name)
|
361
|
+
search_dirs = ENV['PATH'].to_s.split(File::PATH_SEPARATOR)
|
362
|
+
search_dirs.concat(%w(/bin /sbin /usr/bin /usr/sbin /usr/local/bin /usr/local/sbin))
|
363
|
+
["/opt/*/bin", "/usr/local/*/bin"].each do |glob|
|
364
|
+
search_dirs.concat(Dir[glob])
|
365
|
+
end
|
366
|
+
search_dirs.delete("")
|
367
|
+
search_dirs.uniq!
|
368
|
+
|
369
|
+
result = []
|
370
|
+
search_dirs.each do |directory|
|
371
|
+
path = File.join(directory, name)
|
372
|
+
if !File.exist?(path)
|
373
|
+
log "Looking for #{path}: not found"
|
374
|
+
elsif !File.file?(path)
|
375
|
+
log "Looking for #{path}: found, but is not a file"
|
376
|
+
elsif !File.executable?(path)
|
377
|
+
log "Looking for #{path}: found, but is not executable"
|
378
|
+
else
|
379
|
+
log "Looking for #{path}: found"
|
380
|
+
result << path
|
381
|
+
end
|
382
|
+
end
|
383
|
+
return result
|
384
|
+
end
|
358
385
|
end
|
359
386
|
|
360
387
|
end # module PhusionPassenger
|
@@ -1,5 +1,5 @@
|
|
1
1
|
# Phusion Passenger - https://www.phusionpassenger.com/
|
2
|
-
# Copyright (c) 2010
|
2
|
+
# Copyright (c) 2010-2013 Phusion
|
3
3
|
#
|
4
4
|
# "Phusion Passenger" is a trademark of Hongli Lai & Ninh Bui.
|
5
5
|
#
|
@@ -57,14 +57,15 @@ module PlatformInfo
|
|
57
57
|
|
58
58
|
# The absolute path to the 'apachectl' or 'apache2ctl' binary, or nil if
|
59
59
|
# not found.
|
60
|
-
def self.apache2ctl
|
61
|
-
return find_apache2_executable('apache2ctl', 'apachectl2', 'apachectl')
|
60
|
+
def self.apache2ctl(options = {})
|
61
|
+
return find_apache2_executable('apache2ctl', 'apachectl2', 'apachectl', options)
|
62
62
|
end
|
63
63
|
memoize :apache2ctl
|
64
64
|
|
65
65
|
# The absolute path to the Apache binary (that is, 'httpd', 'httpd2', 'apache'
|
66
66
|
# or 'apache2'), or nil if not found.
|
67
|
-
def self.httpd
|
67
|
+
def self.httpd(options = {})
|
68
|
+
apxs2 = options[:apxs2] || self.apxs2
|
68
69
|
if env_defined?('HTTPD')
|
69
70
|
return ENV['HTTPD']
|
70
71
|
elsif apxs2.nil?
|
@@ -76,13 +77,18 @@ module PlatformInfo
|
|
76
77
|
end
|
77
78
|
return nil
|
78
79
|
else
|
79
|
-
return find_apache2_executable(`#{apxs2} -q TARGET`.strip)
|
80
|
+
return find_apache2_executable(`#{apxs2} -q TARGET`.strip, options)
|
80
81
|
end
|
81
82
|
end
|
82
83
|
memoize :httpd
|
83
84
|
|
84
85
|
# The Apache version, or nil if Apache is not found.
|
85
|
-
def self.httpd_version
|
86
|
+
def self.httpd_version(options = nil)
|
87
|
+
if options
|
88
|
+
httpd = options[:httpd] || self.httpd(options)
|
89
|
+
else
|
90
|
+
httpd = self.httpd
|
91
|
+
end
|
86
92
|
if httpd
|
87
93
|
`#{httpd} -v` =~ %r{Apache/([\d\.]+)}
|
88
94
|
return $1
|
@@ -91,6 +97,181 @@ module PlatformInfo
|
|
91
97
|
end
|
92
98
|
end
|
93
99
|
memoize :httpd_version
|
100
|
+
|
101
|
+
# The Apache root directory.
|
102
|
+
def self.httpd_root(options = nil)
|
103
|
+
if info = httpd_V(options)
|
104
|
+
info =~ / -D HTTPD_ROOT="(.+)"$/
|
105
|
+
return $1
|
106
|
+
else
|
107
|
+
return nil
|
108
|
+
end
|
109
|
+
end
|
110
|
+
memoize :httpd_root
|
111
|
+
|
112
|
+
# The default Apache configuration file, or nil if Apache is not found.
|
113
|
+
def self.httpd_default_config_file(options = nil)
|
114
|
+
if info = httpd_V(options)
|
115
|
+
info =~ /-D SERVER_CONFIG_FILE="(.+)"$/
|
116
|
+
filename = $1
|
117
|
+
if filename =~ /\A\//
|
118
|
+
return filename
|
119
|
+
else
|
120
|
+
# Not an absolute path. Infer from root.
|
121
|
+
if root = httpd_root(options)
|
122
|
+
return "#{root}/#{filename}"
|
123
|
+
else
|
124
|
+
return nil
|
125
|
+
end
|
126
|
+
end
|
127
|
+
else
|
128
|
+
return nil
|
129
|
+
end
|
130
|
+
end
|
131
|
+
memoize :httpd_default_config_file
|
132
|
+
|
133
|
+
# The default Apache error log's filename, as it is compiled into the Apache
|
134
|
+
# main executable. This may not be the actual error log that is used. The actual
|
135
|
+
# error log depends on the configuration file.
|
136
|
+
#
|
137
|
+
# Returns nil if Apache is not detected, or if the default error log filename
|
138
|
+
# cannot be detected.
|
139
|
+
def self.httpd_default_error_log(options = nil)
|
140
|
+
if info = httpd_V(options)
|
141
|
+
info =~ /-D DEFAULT_ERRORLOG="(.+)"$/
|
142
|
+
filename = $1
|
143
|
+
if filename =~ /\A\//
|
144
|
+
return filename
|
145
|
+
else
|
146
|
+
# Not an absolute path. Infer from root.
|
147
|
+
if root = httpd_root(options)
|
148
|
+
return "#{root}/#{filename}"
|
149
|
+
else
|
150
|
+
return nil
|
151
|
+
end
|
152
|
+
end
|
153
|
+
else
|
154
|
+
return nil
|
155
|
+
end
|
156
|
+
end
|
157
|
+
memoize :httpd_default_error_log
|
158
|
+
|
159
|
+
def self.httpd_actual_error_log(options = nil)
|
160
|
+
if config_file = httpd_default_config_file(options)
|
161
|
+
contents = File.read(config_file)
|
162
|
+
# We don't want to match comments
|
163
|
+
contents.gsub!(/^[ \t]*#.*/, '')
|
164
|
+
if contents =~ /^ErrorLog (.+)$/
|
165
|
+
filename = $1.strip.sub(/^"/, '').sub(/"$/, '')
|
166
|
+
if filename.include?("${")
|
167
|
+
log "Error log seems to be located in \"#{filename}\", " +
|
168
|
+
"but value contains environment variables. " +
|
169
|
+
"Attempting to substitute them..."
|
170
|
+
end
|
171
|
+
# The Apache config file supports environment variable
|
172
|
+
# substitution. Ubuntu uses this extensively.
|
173
|
+
filename.gsub!(/\$\{(.+?)\}/) do |varname|
|
174
|
+
if value = httpd_infer_envvar($1, options)
|
175
|
+
log "Substituted \"#{varname}\" -> \"#{value}\""
|
176
|
+
value
|
177
|
+
else
|
178
|
+
log "Cannot substituted \"#{varname}\""
|
179
|
+
varname
|
180
|
+
end
|
181
|
+
end
|
182
|
+
if filename.include?("${")
|
183
|
+
# We couldn't substitute everything.
|
184
|
+
return nil
|
185
|
+
else
|
186
|
+
return filename
|
187
|
+
end
|
188
|
+
elsif contents =~ /ErrorLog/
|
189
|
+
# The user apparently has ErrorLog set somewhere but
|
190
|
+
# we can't parse it. The default error log location,
|
191
|
+
# as reported by `httpd -V`, may be wrong (it is on OS X).
|
192
|
+
# So to be safe, let's assume that we don't know.
|
193
|
+
return nil
|
194
|
+
else
|
195
|
+
return httpd_default_error_log(options)
|
196
|
+
end
|
197
|
+
else
|
198
|
+
return nil
|
199
|
+
end
|
200
|
+
end
|
201
|
+
memoize :httpd_actual_error_log
|
202
|
+
|
203
|
+
# The location of the Apache envvars file, which exists on some systems such as Ubuntu.
|
204
|
+
# Returns nil if Apache is not found or if the envvars file is not found.
|
205
|
+
def self.httpd_envvars_file(options = nil)
|
206
|
+
if options
|
207
|
+
httpd = options[:httpd] || self.httpd(options)
|
208
|
+
else
|
209
|
+
httpd = self.httpd
|
210
|
+
end
|
211
|
+
|
212
|
+
httpd_dir = File.dirname(httpd)
|
213
|
+
if httpd_dir == "/usr/bin" || httpd_dir == "/usr/sbin"
|
214
|
+
if File.exist?("/etc/apache2/envvars")
|
215
|
+
return "/etc/apache2/envvars"
|
216
|
+
elsif File.exist?("/etc/httpd/envvars")
|
217
|
+
return "/etc/httpd/envvars"
|
218
|
+
end
|
219
|
+
end
|
220
|
+
|
221
|
+
conf_dir = File.expand_path(File.dirname(httpd) + "/../conf")
|
222
|
+
if File.exist?("#{conf_dir}/envvars")
|
223
|
+
return "#{conf_dir}/envvars"
|
224
|
+
end
|
225
|
+
|
226
|
+
return nil
|
227
|
+
end
|
228
|
+
|
229
|
+
def self.httpd_infer_envvar(varname, options = nil)
|
230
|
+
if envfile = httpd_envvars_file(options)
|
231
|
+
result = `. '#{envfile}' && echo $#{varname}`.strip
|
232
|
+
if $? && $?.exitstatus == 0
|
233
|
+
return result
|
234
|
+
else
|
235
|
+
return nil
|
236
|
+
end
|
237
|
+
else
|
238
|
+
return nil
|
239
|
+
end
|
240
|
+
end
|
241
|
+
|
242
|
+
# Whether Apache appears to support a2enmod and a2dismod.
|
243
|
+
def self.httpd_supports_a2enmod?(options = nil)
|
244
|
+
config_file = httpd_default_config_file(options)
|
245
|
+
if config_file
|
246
|
+
config_dir = File.dirname(config_file)
|
247
|
+
return File.exist?("#{config_dir}/mods-available") &&
|
248
|
+
File.exist?("#{config_dir}/mods-enabled")
|
249
|
+
else
|
250
|
+
return nil
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# The absolute path to the 'a2enmod' executable.
|
255
|
+
def self.a2enmod(options = {})
|
256
|
+
apxs2 = options[:apxs2] || self.apxs2
|
257
|
+
if env_defined?('A2ENMOD')
|
258
|
+
return ENV['A2ENMOD']
|
259
|
+
else
|
260
|
+
return find_apache2_executable("a2enmod", options)
|
261
|
+
end
|
262
|
+
end
|
263
|
+
memoize :a2enmod
|
264
|
+
|
265
|
+
# The absolute path to the 'a2enmod' executable.
|
266
|
+
def self.a2dismod(options = {})
|
267
|
+
apxs2 = options[:apxs2] || self.apxs2
|
268
|
+
if env_defined?('A2DISMOD')
|
269
|
+
return ENV['A2DISMOD']
|
270
|
+
else
|
271
|
+
return find_apache2_executable("a2dismod", options)
|
272
|
+
end
|
273
|
+
end
|
274
|
+
memoize :a2dismod
|
94
275
|
|
95
276
|
# The absolute path to the 'apr-config' or 'apr-1-config' executable,
|
96
277
|
# or nil if not found.
|
@@ -143,12 +324,48 @@ module PlatformInfo
|
|
143
324
|
end
|
144
325
|
end
|
145
326
|
memoize :apu_config
|
327
|
+
|
328
|
+
# Find an executable in the Apache 'bin' and 'sbin' directories.
|
329
|
+
# Returns nil if not found.
|
330
|
+
def self.find_apache2_executable(*possible_names)
|
331
|
+
if possible_names.last.is_a?(Hash)
|
332
|
+
options = possible_names.pop
|
333
|
+
options = nil if options.empty?
|
334
|
+
end
|
335
|
+
|
336
|
+
if options
|
337
|
+
dirs = options[:dirs] || [apache2_bindir(options), apache2_sbindir(options)]
|
338
|
+
else
|
339
|
+
dirs = [apache2_bindir, apache2_sbindir]
|
340
|
+
end
|
341
|
+
|
342
|
+
dirs.each do |bindir|
|
343
|
+
if bindir.nil?
|
344
|
+
next
|
345
|
+
end
|
346
|
+
possible_names.each do |name|
|
347
|
+
filename = "#{bindir}/#{name}"
|
348
|
+
if !File.exist?(filename)
|
349
|
+
log "Looking for #{filename}: not found"
|
350
|
+
elsif !File.file?(filename)
|
351
|
+
log "Looking for #{filename}: found, but is not a file"
|
352
|
+
elsif !File.executable?(filename)
|
353
|
+
log "Looking for #{filename}: found, but is not executable"
|
354
|
+
else
|
355
|
+
log "Looking for #{filename}: found"
|
356
|
+
return filename
|
357
|
+
end
|
358
|
+
end
|
359
|
+
end
|
360
|
+
return nil
|
361
|
+
end
|
146
362
|
|
147
363
|
|
148
364
|
################ Directories ################
|
149
365
|
|
150
366
|
# The absolute path to the Apache 2 'bin' directory, or nil if unknown.
|
151
|
-
def self.apache2_bindir
|
367
|
+
def self.apache2_bindir(options = {})
|
368
|
+
apxs2 = options[:apxs2] || self.apxs2
|
152
369
|
if apxs2.nil?
|
153
370
|
return nil
|
154
371
|
else
|
@@ -158,7 +375,8 @@ module PlatformInfo
|
|
158
375
|
memoize :apache2_bindir
|
159
376
|
|
160
377
|
# The absolute path to the Apache 2 'sbin' directory, or nil if unknown.
|
161
|
-
def self.apache2_sbindir
|
378
|
+
def self.apache2_sbindir(options = {})
|
379
|
+
apxs2 = options[:apxs2] || self.apxs2
|
162
380
|
if apxs2.nil?
|
163
381
|
return nil
|
164
382
|
else
|
@@ -285,24 +503,6 @@ module PlatformInfo
|
|
285
503
|
memoize :apr_config_needed_for_building_apache_modules?
|
286
504
|
|
287
505
|
private
|
288
|
-
# Find an executable in the Apache 'bin' and 'sbin' directories.
|
289
|
-
# Returns nil if not found.
|
290
|
-
def self.find_apache2_executable(*possible_names)
|
291
|
-
[apache2_bindir, apache2_sbindir].each do |bindir|
|
292
|
-
if bindir.nil?
|
293
|
-
next
|
294
|
-
end
|
295
|
-
possible_names.each do |name|
|
296
|
-
filename = "#{bindir}/#{name}"
|
297
|
-
if File.file?(filename) && File.executable?(filename)
|
298
|
-
return filename
|
299
|
-
end
|
300
|
-
end
|
301
|
-
end
|
302
|
-
return nil
|
303
|
-
end
|
304
|
-
private_class_method :find_apache2_executable
|
305
|
-
|
306
506
|
def self.determine_apr_info
|
307
507
|
if apr_config.nil?
|
308
508
|
return [nil, nil]
|
@@ -334,6 +534,26 @@ private
|
|
334
534
|
end
|
335
535
|
memoize :determine_apu_info
|
336
536
|
private_class_method :determine_apu_info
|
537
|
+
|
538
|
+
# Run `httpd -V` and return its output. On some systems, such as Ubuntu 13.10,
|
539
|
+
# `httpd -V` fails without the environment variables defined in various scripts.
|
540
|
+
# Here we take care of evaluating those scripts before running `httpd -V`.
|
541
|
+
def self.httpd_V(options = nil)
|
542
|
+
if options
|
543
|
+
httpd = options[:httpd] || self.httpd(options)
|
544
|
+
else
|
545
|
+
httpd = self.httpd
|
546
|
+
end
|
547
|
+
if httpd
|
548
|
+
command = "#{httpd} -V"
|
549
|
+
if envvars_file = httpd_envvars_file(options)
|
550
|
+
command = ". '#{envvars_file}' && #{command}"
|
551
|
+
end
|
552
|
+
return `#{command}`
|
553
|
+
else
|
554
|
+
return nil
|
555
|
+
end
|
556
|
+
end
|
337
557
|
end
|
338
558
|
|
339
559
|
end
|