Make sure we are able to install command line tools if we have previously installed them but were wiped from a major OS upgrade

This commit is contained in:
Hurlink Vongsachang 2023-06-20 09:38:26 -07:00
Родитель fffac938a9
Коммит 8b8b94ffb5
3 изменённых файлов: 5 добавлений и 2 удалений

Просмотреть файл

@ -68,7 +68,6 @@ module MacOS
end
def softwareupdate_list
enable_install_on_demand
shell_out(['softwareupdate', '--list']).stdout.lines
end

Просмотреть файл

@ -4,7 +4,7 @@ maintainer_email 'chef@microsoft.com'
license 'MIT'
description 'Resources for configuring and provisioning macOS'
chef_version '>= 14.0'
version '5.0.4'
version '5.0.5'
source_url 'https://github.com/Microsoft/macos-cookbook'
issues_url 'https://github.com/Microsoft/macos-cookbook/issues'

Просмотреть файл

@ -9,6 +9,8 @@ property :compile_time, [true, false],
action :install do
command_line_tools = CommandLineTools.new
command_line_tools.enable_install_on_demand
execute "install #{command_line_tools.version}" do
command ['softwareupdate', '--install', command_line_tools.version]
not_if { ::File.exist?('/Library/Developer/CommandLineTools/usr/lib/libxcrun.dylib') }
@ -24,6 +26,8 @@ end
action :upgrade do
command_line_tools = CommandLineTools.new
command_line_tools.enable_install_on_demand
execute "upgrade #{command_line_tools.version}" do
command ['softwareupdate', '--install', command_line_tools.latest_from_catalog]
not_if { command_line_tools.version == command_line_tools.latest_from_catalog }