Skip to content

Commit

Permalink
gf-set-platform: handle new path for console settings
Browse files Browse the repository at this point in the history
When we use bootupd to distribute the grub configs using the
-with-static-configs option the console file we want to target
will be /boot/grub2/30_console.cfg. Let's update gf-set-platform
to handle this case.
  • Loading branch information
dustymabe committed Feb 5, 2024
1 parent 3ea3e92 commit 9688318
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/gf-set-platform
Original file line number Diff line number Diff line change
Expand Up @@ -70,12 +70,17 @@ fi
coreos_gf upload "${tmpd}"/bls.conf "${blscfg_path}"

if [ -n "$rewrite_grub_cmds" ]; then
# Remove qemu-specific grub.cfg commands and inject any new ones
coreos_gf download /boot/grub2/grub.cfg "${tmpd}"/grub-orig.cfg
awk '/^# CONSOLE-SETTINGS-START$/ {suspend=1; print} {if (!suspend) print} /^# CONSOLE-SETTINGS-END$/ {suspend=0; print}' "${tmpd}"/grub-orig.cfg | \
# Use the new console config written out by bootupd if it exists
if [ "$(coreos_gf exists /boot/grub2/30_console.cfg)" = "true" ]; then
grub_console_config_path='/boot/grub2/30_console.cfg'
else
grub_console_config_path='/boot/grub2/grub.cfg'
fi
coreos_gf download "${grub_console_config_path}" "${tmpd}"/grub-console-orig.cfg
awk '/^# CONSOLE-SETTINGS-START$/ {suspend=1; print} {if (!suspend) print} /^# CONSOLE-SETTINGS-END$/ {suspend=0; print}' "${tmpd}"/grub-console-orig.cfg | \
sed -E 's@(^# CONSOLE-SETTINGS-START$)@\1'"${extra_grub_cmds:+\\n${extra_grub_cmds}}"'@' \
> "${tmpd}"/grub.cfg
coreos_gf upload "${tmpd}"/grub.cfg /boot/grub2/grub.cfg
> "${tmpd}"/grub-console.cfg
coreos_gf upload "${tmpd}"/grub-console.cfg "${grub_console_config_path}"
fi

if [ "$basearch" = "s390x" ] ; then
Expand Down

0 comments on commit 9688318

Please sign in to comment.