Use ruby-build for Mastodon, update cookbooks

This uses the ruby_build provider for Mastodon, installing Ruby 2.4.1
currently. It also updates some other cookbooks and the runlists.
This commit is contained in:
2017-04-17 11:40:31 +02:00
parent 4530190df6
commit 54332db8de
96 changed files with 2830 additions and 903 deletions

View File

@@ -1,5 +1,5 @@
#
# Author:: Shawn Neal (<sneal@daptiv.com>)
# Author:: Shawn Neal (<sneal@sneal.net>)
# Cookbook Name:: seven_zip
# Provider:: archive
#
@@ -28,21 +28,41 @@ def whyrun_supported?
true
end
use_inline_resources
action :extract do
converge_by("Extract #{@new_resource.source} => #{@new_resource.path} (overwrite=#{@new_resource.overwrite})") do
FileUtils.mkdir_p(@new_resource.path) unless Dir.exists?(@new_resource.path)
FileUtils.mkdir_p(@new_resource.path) unless Dir.exist?(@new_resource.path)
local_source = cached_file(@new_resource.source, @new_resource.checksum)
cmd = "#{seven_zip_exe} x"
cmd << " -y" if @new_resource.overwrite
cmd << " -o#{win_friendly_path(@new_resource.path)}"
cmd << " #{local_source}"
cmd = "\"#{seven_zip_exe}\" x"
cmd << ' -y' if @new_resource.overwrite
cmd << " -o\"#{win_friendly_path(@new_resource.path)}\""
cmd << " \"#{local_source}\""
Chef::Log.debug(cmd)
shell_out!(cmd)
shell_out!(cmd, timeout: extract_timeout)
end
end
def seven_zip_exe()
Chef::Log.debug("seven zip home: #{node['seven_zip']['home']}")
win_friendly_path(::File.join(node['seven_zip']['home'], '7z.exe'))
def seven_zip_exe
path = if node['seven_zip']['home']
node['seven_zip']['home']
else
seven_zip_exe_from_registry
end
Chef::Log.debug("Using 7-zip home: #{path}")
win_friendly_path(::File.join(path, '7z.exe'))
end
def seven_zip_exe_from_registry
require 'win32/registry'
# Read path from recommended Windows App Paths registry location
# docs: https://msdn.microsoft.com/en-us/library/windows/desktop/ee872121
::Win32::Registry::HKEY_LOCAL_MACHINE.open(
'SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\7zFM.exe',
::Win32::Registry::KEY_READ
).read_s('Path')
end
def extract_timeout
@new_resource.timeout || node['seven_zip']['default_extract_timeout']
end