d0469a4
From 850bfabe67ab2ab62f0d3f16acc941a6043ca92d Mon Sep 17 00:00:00 2001
d0469a4
From: Todd Zullinger <tmz@pobox.com>
d0469a4
Date: Wed, 15 Feb 2012 10:07:11 -0500
d0469a4
Subject: [PATCH/facter] Preserve timestamps when installing files
d0469a4
d0469a4
Without the preserve option, ruby's FileUtils.install method uses the
d0469a4
current time for all installed files.  For backup systems, package
d0469a4
installs, and general pedantic sysadmins, preserving timestamps makes a
d0469a4
small improvement in the world.
d0469a4
d0469a4
---
d0469a4
 install.rb |   12 ++++++------
d0469a4
 1 files changed, 6 insertions(+), 6 deletions(-)
d0469a4
d0469a4
diff --git a/install.rb b/install.rb
d0469a4
index ab233c3..e1785a2 100755
d0469a4
--- a/install.rb
d0469a4
+++ b/install.rb
d0469a4
@@ -102,7 +102,7 @@ def do_libs(libs, strip = 'lib/')
d0469a4
     op = File.dirname(olf)
d0469a4
     FileUtils.makedirs(op, {:mode => 0755, :verbose => true})
d0469a4
     FileUtils.chmod(0755, op)
d0469a4
-    FileUtils.install(lf, olf, {:mode => 0644, :verbose => true})
d0469a4
+    FileUtils.install(lf, olf, {:mode => 0644, :preserve => true, :verbose => true})
d0469a4
   end
d0469a4
 end
d0469a4
 
d0469a4
@@ -113,7 +113,7 @@ def do_man(man, strip = 'man/')
d0469a4
     om = File.dirname(omf)
d0469a4
     FileUtils.makedirs(om, {:mode => 0755, :verbose => true})
d0469a4
     FileUtils.chmod(0755, om)
d0469a4
-    FileUtils.install(mf, omf, {:mode => 0644, :verbose => true})
d0469a4
+    FileUtils.install(mf, omf, {:mode => 0644, :preserve => true, :verbose => true})
d0469a4
     gzip = %x{which gzip}
d0469a4
     gzip.chomp!
d0469a4
     %x{#{gzip} -f #{omf}}
d0469a4
@@ -412,12 +412,12 @@ def install_binfile(from, op_file, target)
d0469a4
     installed_wrapper = false
d0469a4
 
d0469a4
     if File.exists?("#{from}.bat")
d0469a4
-      FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true)
d0469a4
+      FileUtils.install("#{from}.bat", File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true)
d0469a4
       installed_wrapper = true
d0469a4
     end
d0469a4
 
d0469a4
     if File.exists?("#{from}.cmd")
d0469a4
-      FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :verbose => true)
d0469a4
+      FileUtils.install("#{from}.cmd", File.join(target, "#{op_file}.cmd"), :mode => 0755, :preserve => true, :verbose => true)
d0469a4
       installed_wrapper = true
d0469a4
     end
d0469a4
 
d0469a4
@@ -431,13 +431,13 @@ set RUBY_BIN=%RUBY_BIN:\\=/%
d0469a4
 "%RUBY_BIN%ruby.exe" -x "%RUBY_BIN%facter" %*
d0469a4
 EOS
d0469a4
       File.open(tmp_file2, "w") { |cw| cw.puts cwv }
d0469a4
-      FileUtils.install(tmp_file2, File.join(target, "#{op_file}.bat"), :mode => 0755, :verbose => true)
d0469a4
+      FileUtils.install(tmp_file2, File.join(target, "#{op_file}.bat"), :mode => 0755, :preserve => true, :verbose => true)
d0469a4
 
d0469a4
       File.unlink(tmp_file2)
d0469a4
       installed_wrapper = true
d0469a4
     end
d0469a4
   end
d0469a4
-  FileUtils.install(tmp_file, File.join(target, op_file), :mode => 0755, :verbose => true)
d0469a4
+  FileUtils.install(tmp_file, File.join(target, op_file), :mode => 0755, :preserve => true, :verbose => true)
d0469a4
   File.unlink(tmp_file)
d0469a4
 end
d0469a4
 
d0469a4
-- 
d0469a4
1.7.6
d0469a4