Skip to content

Instantly share code, notes, and snippets.

@brettp
Created May 23, 2018 01:08
Show Gist options
  • Save brettp/c41758c9617c1f113cff92462b0f3c08 to your computer and use it in GitHub Desktop.
Save brettp/c41758c9617c1f113cff92462b0f3c08 to your computer and use it in GitHub Desktop.
Grub config to allow load overrides from /grub_extra.cfg if present
#!/bin/sh
# Searches all drives for a file named grub_extra.cfg in the root dir
# and includes it after all other config files.
# Can be used to force override any variables
# Example /grub_extra.cfg:
# set default=1
cat <<EOF
search --file --set extra_cfg_dev /grub_extra.cfg
if [ "\${extra_cfg_dev}" ]; then
set extra_cfg_file="(\${extra_cfg_dev})/grub_extra.cfg"
echo "Including \${extra_cfg_file}"
source "\${extra_cfg_file}"
echo "Default is now \${default}"
fi
EOF
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment