summaryrefslogtreecommitdiffstats
path: root/install.rb
diff options
context:
space:
mode:
authorJames Turnbull <james@lovedthanlost.net>2009-09-15 09:43:48 +1000
committerJames Turnbull <james@lovedthanlost.net>2009-09-15 09:43:48 +1000
commit19e98f994916482c930005efe938c5f0cac66dec (patch)
treeb91511ec9f41dc924fae45b63df3949a632a8e15 /install.rb
parentb77d6e8083606f64aad1a9683f1bd92d14be1179 (diff)
downloadpuppet-19e98f994916482c930005efe938c5f0cac66dec.tar.gz
puppet-19e98f994916482c930005efe938c5f0cac66dec.tar.xz
puppet-19e98f994916482c930005efe938c5f0cac66dec.zip
Fixed #2608 - install.rb will not run on ruby 1.9.1 due to ftools being deprecated
Diffstat (limited to 'install.rb')
-rwxr-xr-xinstall.rb32
1 files changed, 25 insertions, 7 deletions
diff --git a/install.rb b/install.rb
index 5a016481f..44cf88ad6 100755
--- a/install.rb
+++ b/install.rb
@@ -35,7 +35,13 @@
require 'rbconfig'
require 'find'
require 'fileutils'
-require 'ftools' # apparently on some system ftools doesn't get loaded
+begin
+ require 'ftools' # apparently on some system ftools doesn't get loaded
+ $haveftools = true
+rescue LoadError
+ puts "ftools not found. Using FileUtils instead.."
+ $haveftools = false
+end
require 'optparse'
require 'ostruct'
@@ -92,9 +98,15 @@ def do_libs(libs, strip = 'lib/')
libs.each do |lf|
olf = File.join(InstallOptions.site_dir, lf.gsub(/#{strip}/, ''))
op = File.dirname(olf)
- File.makedirs(op, true)
- File.chmod(0755, op)
- File.install(lf, olf, 0644, true)
+ if $haveftools
+ File.makedirs(op, true)
+ File.chmod(0755, op)
+ File.install(lf, olf, 0644, true)
+ else
+ FileUtils.makedirs(op, {:mode => 0755, :verbose => true})
+ FileUtils.chmod(0755, op)
+ FileUtils.install(lf, olf, {:mode => 0644, :verbose => true})
+ end
end
end
@@ -102,9 +114,15 @@ def do_man(man, strip = 'man/')
man.each do |mf|
omf = File.join(InstallOptions.man_dir, mf.gsub(/#{strip}/, ''))
om = File.dirname(omf)
- File.makedirs(om, true)
- File.chmod(0755, om)
- File.install(mf, omf, 0644, true)
+ if $haveftools
+ File.makedirs(om, true)
+ File.chmod(0644, om)
+ File.install(mf, omf, 0644, true)
+ else
+ FileUtils.makedirs(om, {:mode => 0755, :verbose => true})
+ FileUtils.chmod(0755, om)
+ FileUtils.install(mf, omf, {:mode => 0644, :verbose => true})
+ end
gzip = %x{which gzip}
gzip.chomp!
%x{#{gzip} -f #{omf}}