Skip to content

Commit

Permalink
Updated grub.cfg with explanation
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored and mmoll committed Apr 25, 2018
1 parent 7ee913c commit 2108fd6
Showing 1 changed file with 31 additions and 4 deletions.
35 changes: 31 additions & 4 deletions files/grub.cfg
Original file line number Diff line number Diff line change
@@ -1,8 +1,35 @@
# This file was deployed by Puppet and is under Smart Proxy control. Click on
# "Build PXE Default" button to overwrite it. Puppet is prevented managing this
# file by default, this can be enforced via --foreman-proxy-tftp-replace-grub2-cfg
# foreman-installer option or Puppet parameter.

insmod regexp

set net_pxe_mac=$net_default_mac
# On Debian/Ubuntu grub2 does not have patch for loading MAC-based configs. Also due to bug
# in RHEL 7.4 files are loaded with an extra ":" character at the end. This workarounds both
# cases, make sure "regexp.mod" file is present on the TFTP. For more info see:
# https://bugzilla.redhat.com/show_bug.cgi?id=1370642#c70
regexp --set=1:m1 --set=2:m2 --set=3:m3 --set=4:m4 --set=5:m5 --set=6:m6 '^([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})\:([0-9a-f]{1,2})' "$net_default_mac"
mac_dashed=${m1}-${m2}-${m3}-${m4}-${m5}-${m6}
mac=${m1}-${m2}-${m3}-${m4}-${m5}-${m6}
configfile=/grub2/grub.cfg-01-$mac
source "$configfile"

# If MAC-specific config is not found, attempt to boot from local drive.

default=local_chain_hd0
timeout=20

menuentry 'Chainload into BIOS bootloader on first disk' --id local_chain_hd0 {
set root=(hd0,0)
chainloader +1
}

menuentry 'Chainload into BIOS bootloader on second disk' --id local_chain_hd1 {
set root=(hd1,0)
chainloader +1
}

mac_configfile=$prefix/grub.cfg-01-$mac_dashed
source "$mac_configfile"
menuentry 'Third disk - for EFI or Discovery click on Build PXE Default'' --id local_chain_hd2 {
set root=(hd2,0)
chainloader +1
}

0 comments on commit 2108fd6

Please sign in to comment.