]> git.openstreetmap.org Git - chef.git/commitdiff
Convert some archive unpacking to use archive_file
authorTom Hughes <tom@compton.nu>
Sun, 24 Oct 2021 21:59:47 +0000 (22:59 +0100)
committerTom Hughes <tom@compton.nu>
Mon, 25 Oct 2021 17:24:16 +0000 (18:24 +0100)
cookbooks/civicrm/recipes/default.rb
cookbooks/forum/recipes/default.rb
cookbooks/imagery/recipes/default.rb
cookbooks/kibana/recipes/default.rb
cookbooks/osmosis/recipes/default.rb
cookbooks/piwik/recipes/default.rb

index ced22c5f43814c0b2be5b326e2aa5bc6ac68af12..6309efcf4f53b2ac6ece0dce1e93e5d545efc55c 100644 (file)
@@ -24,7 +24,6 @@ package %w[
   php-xml
   php-curl
   rsync
-  unzip
   wkhtmltopdf
   php-bcmath
 ]
@@ -102,22 +101,22 @@ remote_file "#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz" do
   backup false
 end
 
-execute "#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip" do
+archive_file "#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip" do
   action :nothing
-  command "unzip -o -qq #{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip"
-  cwd "/opt/civicrm-#{civicrm_version}"
-  user "wordpress"
+  destination "/opt/civicrm-#{civicrm_version}"
+  overwrite true
+  owner "wordpress"
   group "wordpress"
-  subscribes :run, "remote_file[#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip]", :immediately
+  subscribes :extract, "remote_file[#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip]", :immediately
 end
 
-execute "#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz" do
+archive_file "#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz" do
   action :nothing
-  command "tar -zxf #{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz"
-  cwd "/opt/civicrm-#{civicrm_version}/civicrm"
-  user "wordpress"
+  destination "/opt/civicrm-#{civicrm_version}/civicrm"
+  overwrite true
+  owner "wordpress"
   group "wordpress"
-  subscribes :run, "remote_file[#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz]", :immediately
+  subscribes :extract, "remote_file[#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz]", :immediately
 end
 
 execute "/opt/civicrm-#{civicrm_version}/civicrm" do
@@ -125,8 +124,8 @@ execute "/opt/civicrm-#{civicrm_version}/civicrm" do
   command "rsync --archive --delete /opt/civicrm-#{civicrm_version}/civicrm/ #{civicrm_directory}"
   user "wordpress"
   group "wordpress"
-  subscribes :run, "execute[#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip]", :immediately
-  subscribes :run, "execute[#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz]", :immediately
+  subscribes :run, "archive_file[#{cache_dir}/civicrm-#{civicrm_version}-wordpress.zip]", :immediately
+  subscribes :run, "archive_file[#{cache_dir}/civicrm-#{civicrm_version}-l10n.tar.gz]", :immediately
 end
 
 directory "/srv/join.osmfoundation.org/wp-content/uploads" do
index c081dd3d2f5b24c1120ed6d2364abb3a9f57b132..ae32e4d01f1f92e7c5e92d8ab7c0ef8e5055969d 100644 (file)
@@ -32,7 +32,6 @@ package %w[
   php-mysql
   php-xml
   php-apcu
-  unzip
 ]
 
 apache_module "env"
@@ -78,13 +77,14 @@ remote_file "#{cache_dir}/air3_v0.8.tar.gz" do
   backup false
 end
 
-execute "#{cache_dir}/air3_v0.8.tar.gz" do
+archive_file "#{cache_dir}/air3_v0.8.tar.gz" do
   action :nothing
-  command "tar --gunzip --extract --file=#{cache_dir}/air3_v0.8.tar.gz --strip-components=1 --wildcards air3-0.8/Air3.css 'air3-0.8/Air3/*'"
-  cwd "/srv/forum.openstreetmap.org/html/style"
-  user "forum"
+  destination "/srv/forum.openstreetmap.org/html/style"
+  strip_components 1
+  overwrite true
+  owner "forum"
   group "forum"
-  subscribes :run, "remote_file[#{cache_dir}/air3_v0.8.tar.gz]", :immediately
+  subscribes :extract, "remote_file[#{cache_dir}/air3_v0.8.tar.gz]", :immediately
 end
 
 directory "/srv/forum.openstreetmap.org/html/cache/" do
index 63b33b70fb39c041ef8e3f75ca791dd8416e74b5..7a5b55057133e6ac3ed94e0dfbae56e093c50324 100644 (file)
@@ -71,10 +71,9 @@ remote_file "#{Chef::Config[:file_cache_path]}/ostn02-ntv2-data.zip" do
   not_if { ::File.exist?("/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb") }
 end
 
-execute "unzip-ostn02-ntv2-data" do
-  command "unzip -q #{Chef::Config[:file_cache_path]}/ostn02-ntv2-data.zip"
-  cwd "/srv/imagery/common/ostn02-ntv2-data"
-  user "root"
+archive_file "#{Chef::Config[:file_cache_path]}/ostn02-ntv2-data.zip" do
+  destination "/srv/imagery/common/ostn02-ntv2-data"
+  owner "root"
   group "root"
   not_if { ::File.exist?("/srv/imagery/common/ostn02-ntv2-data/OSTN02_NTv2.gsb") }
 end
index 1a8c7712a07eaab254c02343f891158661d3cb2b..2f2fc6f28a4f7495c4b47c551ae15aea66029d8b 100644 (file)
@@ -37,10 +37,11 @@ directory "/opt/kibana-#{version}" do
   mode "755"
 end
 
-execute "unzip-kibana-#{version}" do
-  command "tar --gunzip --extract --strip-components=1 --file=#{Chef::Config[:file_cache_path]}/kibana-#{version}.tar.gz"
-  cwd "/opt/kibana-#{version}"
-  user "root"
+archive_file "#{Chef::Config[:file_cache_path]}/kibana-#{version}.tar.gz" do
+  destination "/opt/kibana-#{version}"
+  overwrite true
+  strip_components 1
+  owner "root"
   group "root"
   not_if { ::File.exist?("/opt/kibana-#{version}/bin/kibana") }
 end
index ff38e90e0465da8d84b61c710593585bf667b6b7..b5b0b60b60a650c3ca8d5328ab16cc711daf3a86 100644 (file)
@@ -19,7 +19,6 @@
 
 include_recipe "chef"
 
-package "unzip"
 package "default-jre"
 
 cache_dir = Chef::Config[:file_cache_path]
@@ -52,13 +51,13 @@ remote_file "#{cache_dir}/#{osmosis_package}" do
   backup false
 end
 
-execute "#{cache_dir}/#{osmosis_package}" do
+archive_file "#{cache_dir}/#{osmosis_package}" do
   action :nothing
-  command "unzip -q #{cache_dir}/#{osmosis_package}"
-  cwd osmosis_directory
-  user "root"
+  destination osmosis_directory
+  overwrite true
+  owner "root"
   group "root"
-  subscribes :run, "remote_file[#{cache_dir}/#{osmosis_package}]"
+  subscribes :extract, "remote_file[#{cache_dir}/#{osmosis_package}]"
 end
 
 link "/usr/local/bin/osmosis" do
index 0bd3ede877e3fad2259b7e5d5370cbfb738acda4..997048308f49b45a2ae5cba47f65144925da005d 100644 (file)
@@ -32,7 +32,6 @@ package %w[
   php-gd
   php-xml
   php-apcu
-  unzip
 ]
 
 apache_module "expires"
@@ -51,10 +50,10 @@ remote_file "#{Chef::Config[:file_cache_path]}/piwik-#{version}.zip" do
   not_if { ::File.exist?("/opt/piwik-#{version}/piwik") }
 end
 
-execute "unzip-piwik-#{version}" do
-  command "unzip -q #{Chef::Config[:file_cache_path]}/piwik-#{version}.zip"
-  cwd "/opt/piwik-#{version}"
-  user "root"
+archive_file "#{Chef::Config[:file_cache_path]}/piwik-#{version}.zip" do
+  destination "/opt/piwik-#{version}"
+  overwrite true
+  owner "root"
   group "root"
   not_if { ::File.exist?("/opt/piwik-#{version}/piwik") }
 end