macos-cookbook/libraries/software_updates.rb

22 строки
688 B
Ruby
Исходник Обычный вид История

module MacOS
module SoftwareUpdates
def updates_available?
no_new_software_pattern = Regexp.union('No new software available.')
2018-04-25 23:39:58 +03:00
available_updates_command = shell_out(software_update_command, '--list', '--all')
available_updates_command.stderr.chomp.match?(no_new_software_pattern)
end
def automatic_check_disabled?
schedule_check_command = shell_out(software_update_command, '--schedule')
schedule_check_command.stdout.chomp == 'Automatic check is off'
end
def software_update_command
'/usr/sbin/softwareupdate'
end
end
end
2021-02-11 00:04:08 +03:00
Chef::DSL::Recipe.include(MacOS::SoftwareUpdates)
Chef::Resource.include(MacOS::SoftwareUpdates)