From 021359bd7448f6dea8f8c55a1e7dca84babdbd0c Mon Sep 17 00:00:00 2001 From: Nick Lewis Date: Fri, 24 Sep 2010 15:21:20 -0700 Subject: Fix for #4644: install.rb works properly on Windows We were failing to make the sbin directory, and so the install script was failing to install files to it. Also, we were trying to add man pages regardless of whether or not we actually wanted to. Changed operating system detection to use Facter["operatingsystem"], which is easier to check than RUBY_PLATFORM (there are multiple different values for Windows). --- install.rb | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) (limited to 'install.rb') diff --git a/install.rb b/install.rb index e4154c999..449223d26 100755 --- a/install.rb +++ b/install.rb @@ -88,6 +88,7 @@ libs = glob(%w{lib/**/*.rb lib/**/*.py lib/puppet/util/command_line/*}) tests = glob(%w{test/**/*.rb}) def do_bins(bins, target, strip = 's?bin/') + Dir.mkdir(target) unless File.directory? target bins.each do |bf| obf = bf.gsub(/#{strip}/, '') install_binfile(bf, obf, target) @@ -154,10 +155,12 @@ end # Prepare the file installation. # def prepare_installation + $operatingsystem = Facter["operatingsystem"].value + # Only try to do docs if we're sure they have rdoc if $haverdoc InstallOptions.rdoc = true - InstallOptions.ri = RUBY_PLATFORM != "i386-mswin32" + InstallOptions.ri = $operatingsystem != "windows" else InstallOptions.rdoc = false InstallOptions.ri = false @@ -166,7 +169,7 @@ def prepare_installation if $haveman InstallOptions.man = true - if RUBY_PLATFORM == "i386-mswin32" + if $operatingsystem == "windows" InstallOptions.man = false end else @@ -175,15 +178,6 @@ def prepare_installation InstallOptions.tests = true - if $haveman - InstallOptions.man = true - if RUBY_PLATFORM == "i386-mswin32" - InstallOptions.man = false - end - else - InstallOptions.man = false - end - ARGV.options do |opts| opts.banner = "Usage: #{File.basename($0)} [options]" opts.separator "" @@ -418,7 +412,7 @@ def install_binfile(from, op_file, target) end end - if Config::CONFIG["target_os"] =~ /win/io and Config::CONFIG["target_os"] !~ /darwin/io + if $operatingsystem == "windows" installed_wrapper = false if File.exists?("#{from}.bat") @@ -468,4 +462,4 @@ prepare_installation do_bins(sbins, InstallOptions.sbin_dir) do_bins(bins, InstallOptions.bin_dir) do_libs(libs) -do_man(man) +do_man(man) if InstallOptions.man -- cgit