~ubuntu-branches/ubuntu/precise/puppet/precise-proposed

« back to all changes in this revision

Viewing changes to install.rb

  • Committer: Bazaar Package Importer
  • Author(s): Chuck Short
  • Date: 2011-02-08 00:28:43 UTC
  • mfrom: (1.1.22 upstream) (3.1.19 sid)
  • Revision ID: james.westby@ubuntu.com-20110208002843-1xrv7w3vqblrn15m
Tags: 2.6.4-2ubuntu1
* Merge from debian unstable.  Remaining changes:
  - debian/puppetmaster-passenger.postinst: Use cacrl instead of hostcrl to
    set the location of the CRL in apache2 configuration. Fix apache2 
    configuration on upgrade as well (LP: #641001)
  - move all puppet dependencies to puppet-common since all the code 
    actually located in puppet-common.
  - move libagueas from a recommend to a dependency.

Show diffs side-by-side

added added

removed removed

Lines of Context:
79
79
end
80
80
 
81
81
# Set these values to what you want installed.
 
82
configs = glob(%w{conf/auth.conf})
82
83
sbins = glob(%w{sbin/*})
83
84
bins  = glob(%w{bin/*})
84
85
rdoc  = glob(%w{bin/* sbin/* lib/**/*.rb README README-library CHANGELOG TODO Install}).reject { |e| e=~ /\.(bat|cmd)$/ }
87
88
libs  = glob(%w{lib/**/*.rb lib/**/*.py lib/puppet/util/command_line/*})
88
89
tests = glob(%w{test/**/*.rb})
89
90
 
 
91
def do_configs(configs, target, strip = 'conf/')
 
92
  Dir.mkdir(target) unless File.directory? target
 
93
  configs.each do |cf|
 
94
    ocf = File.join(InstallOptions.config_dir, cf.gsub(/#{strip}/, ''))
 
95
    File.install(cf, ocf, 0644, true)
 
96
  end
 
97
end
 
98
 
90
99
def do_bins(bins, target, strip = 's?bin/')
91
100
  Dir.mkdir(target) unless File.directory? target
92
101
  bins.each do |bf|
157
166
def prepare_installation
158
167
  $operatingsystem = Facter["operatingsystem"].value
159
168
 
 
169
  InstallOptions.configs = true
 
170
 
160
171
  # Only try to do docs if we're sure they have rdoc
161
172
  if $haverdoc
162
173
    InstallOptions.rdoc  = true
193
204
    opts.on('--[no-]tests', 'Prevents the execution of unit tests.', 'Default on.') do |ontest|
194
205
      InstallOptions.tests = ontest
195
206
    end
 
207
    opts.on('--[no-]configs', 'Prevents the installation of config files', 'Default off.') do |ontest|
 
208
      InstallOptions.configs = ontest
 
209
    end
196
210
    opts.on('--destdir[=OPTIONAL]', 'Installation prefix for all targets', 'Default essentially /') do |destdir|
197
211
      InstallOptions.destdir = destdir
198
212
    end
 
213
    opts.on('--configdir[=OPTIONAL]', 'Installation directory for config files', 'Default /etc/puppet') do |configdir|
 
214
      InstallOptions.configdir = configdir
 
215
    end
199
216
    opts.on('--bindir[=OPTIONAL]', 'Installation directory for binaries', 'overrides Config::CONFIG["bindir"]') do |bindir|
200
217
      InstallOptions.bindir = bindir
201
218
    end
209
226
      InstallOptions.mandir = mandir
210
227
    end
211
228
    opts.on('--quick', 'Performs a quick installation. Only the', 'installation is done.') do |quick|
212
 
      InstallOptions.rdoc   = false
213
 
      InstallOptions.ri     = false
214
 
      InstallOptions.tests  = false
 
229
      InstallOptions.rdoc    = false
 
230
      InstallOptions.ri      = false
 
231
      InstallOptions.tests   = false
 
232
      InstallOptions.configs = true
215
233
    end
216
234
    opts.on('--full', 'Performs a full installation. All', 'optional installation steps are run.') do |full|
217
 
      InstallOptions.rdoc   = true
218
 
      InstallOptions.man    = true
219
 
      InstallOptions.ri     = true
220
 
      InstallOptions.tests  = true
 
235
      InstallOptions.rdoc    = true
 
236
      InstallOptions.man     = true
 
237
      InstallOptions.ri      = true
 
238
      InstallOptions.tests   = true
 
239
      InstallOptions.configs = true
221
240
    end
222
241
    opts.separator("")
223
242
    opts.on_tail('--help', "Shows this help text.") do
243
262
    Config::CONFIG['sbindir'] = "/usr/sbin"
244
263
  end
245
264
 
 
265
  if not InstallOptions.configdir.nil?
 
266
    configdir = InstallOptions.configdir
 
267
  else
 
268
    configdir = "/etc/puppet"
 
269
  end
 
270
 
246
271
  if not InstallOptions.bindir.nil?
247
272
    bindir = InstallOptions.bindir
248
273
  else
277
302
 
278
303
  # To be deprecated once people move over to using --destdir option
279
304
  if (destdir = ENV['DESTDIR'])
 
305
    configdir = "#{destdir}#{configdir}"
280
306
    bindir = "#{destdir}#{bindir}"
281
307
    sbindir = "#{destdir}#{sbindir}"
282
308
    mandir = "#{destdir}#{mandir}"
283
309
    sitelibdir = "#{destdir}#{sitelibdir}"
284
310
 
 
311
    FileUtils.makedirs(configdir) if InstallOptions.configs
285
312
    FileUtils.makedirs(bindir)
286
313
    FileUtils.makedirs(sbindir)
287
314
    FileUtils.makedirs(mandir)
288
315
    FileUtils.makedirs(sitelibdir)
289
316
  # This is the new way forward
290
317
  elsif (destdir = InstallOptions.destdir)
 
318
    configdir = "#{destdir}#{configdir}"
291
319
    bindir = "#{destdir}#{bindir}"
292
320
    sbindir = "#{destdir}#{sbindir}"
293
321
    mandir = "#{destdir}#{mandir}"
294
322
    sitelibdir = "#{destdir}#{sitelibdir}"
295
323
 
 
324
    FileUtils.makedirs(configdir) if InstallOptions.configs
296
325
    FileUtils.makedirs(bindir)
297
326
    FileUtils.makedirs(sbindir)
298
327
    FileUtils.makedirs(mandir)
303
332
 
304
333
  InstallOptions.tmp_dirs = tmpdirs.compact
305
334
  InstallOptions.site_dir = sitelibdir
 
335
  InstallOptions.config_dir = configdir
306
336
  InstallOptions.bin_dir  = bindir
307
337
  InstallOptions.sbin_dir = sbindir
308
338
  InstallOptions.lib_dir  = libdir
458
488
#run_tests(tests) if InstallOptions.tests
459
489
#build_rdoc(rdoc) if InstallOptions.rdoc
460
490
#build_ri(ri) if InstallOptions.ri
461
 
build_man(bins, sbins) if InstallOptions.man
 
491
#build_man(bins, sbins) if InstallOptions.man
 
492
do_configs(configs, InstallOptions.config_dir) if InstallOptions.configs
462
493
do_bins(sbins, InstallOptions.sbin_dir)
463
494
do_bins(bins, InstallOptions.bin_dir)
464
495
do_libs(libs)