2 # Cookbook Name:: platform_utils
3 # Recipe:: grub_default
5 # Copyright 2018, whitestar
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
20 unless File.exist?('/boot/grub/grub.cfg')
21 Chef::Log.warn('recipe[platform_utils::grub_default] GRUB 2 is not installed yet.')
25 execute 'update-grub2' do
27 command 'update-grub2'
29 only_if 'update-grub2 --version'
32 dir = '/etc/default/grub.d'
33 resources(directory: dir) rescue directory dir do
39 template '/etc/default/grub.d/override.cfg' do
40 source 'etc/default/grub.d/override.cfg'
44 notifies :run, 'execute[update-grub2]'