summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/chef/knife/cookbook_site_install.rb11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/chef/knife/cookbook_site_install.rb b/lib/chef/knife/cookbook_site_install.rb
index 3041270048..b08fe90170 100644
--- a/lib/chef/knife/cookbook_site_install.rb
+++ b/lib/chef/knife/cookbook_site_install.rb
@@ -141,8 +141,17 @@ class Chef
def extract_cookbook(upstream_file, version)
ui.info("Uncompressing #{@cookbook_name} version #{version}.")
- # FIXME: Detect if we have the bad tar from git on Windows: https://github.com/opscode/chef/issues/1753
extract_command = "tar zxvf \"#{convert_path upstream_file}\""
+ if Chef::Platform.windows?
+ # FIXED: Detect if we have the bad tar from git on Windows: https://github.com/opscode/chef/issues/1753
+ tar_version = `tar --version`.tr("\n"," ")
+ if /GNU tar/.match(tar_version)
+ ui.info("GNU tar detected")
+ extract_command << " --force-local"
+ elsif /bsdtar/.match(tar_version)
+ ui.info("BSD tar detected")
+ end
+ end
shell_out!(extract_command, :cwd => @install_path)
end