2N/A# Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc. 2N/A# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. 2N/A# GRUB is free software: you can redistribute it and/or modify 2N/A# it under the terms of the GNU General Public License as published by 2N/A# the Free Software Foundation, either version 3 of the License, or 2N/A# (at your option) any later version. 2N/A# GRUB is distributed in the hope that it will be useful, 2N/A# but WITHOUT ANY WARRANTY; without even the implied warranty of 2N/A# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 2N/A# GNU General Public License for more details. 2N/A# You should have received a copy of the GNU General Public License 2N/AUsage: $self [OPTION] 2N/AGenerate a grub config file 2N/A -o, --output=FILE output generated config to FILE [default=stdout] 2N/A -p, --prefix=DIR set the GRUB prefix directory to DIR 2N/A [default=/boot/grub] 2N/A -h, --help print this message and exit 2N/A -v, --version print the version information and exit 2N/AReport bugs to <bug-grub@gnu.org>. 2N/A echo "$0: option requires an argument -- '$opt'" 1>&2 2N/A# Check the arguments. 2N/A echo "$self (${PACKAGE_NAME}) ${PACKAGE_VERSION}" 2N/A # Explicitly ignore non-option arguments, for compatibility. 2N/A # Cygwin: Assume root if member of admin group 2N/A echo "$self: You must run this as root" >&
2 2N/Aif test -f
"$1";
then 2N/A echo "$1: Not found." 1>&
2 2N/A# Device containing our userland. Typically used for root= parameter. 2N/A# Device containing our /boot partition. Usually the same as GRUB_DEVICE. 2N/A# Filesystem for the device containing our userland. Used for stuff like 2N/A# choosing Hurd filesystem module. 2N/A# XXX: should this be deprecated at some point? 2N/Aif [
"x${GRUB_TERMINAL}" !=
"x" ] ;
then 2N/Aif [
"x${GRUB_TERMINAL_OUTPUT}" =
"x" ];
then 2N/A if [
"x${x}" =
"xgfxterm" ];
then 2N/A echo "No such font or not readable by grub: ${GRUB_FONT}" >&
2 2N/A if [
"${basename}" =
"ascii" ] ;
then 2N/A # make sure all our children behave in conformance with ascii.. 2N/A if [ -z
"${GRUB_FONT_PATH}" -a -z
"${GRUB_FONT_PATH_DIRECT}" ] ;
then 2N/A echo "No font for gfxterm found." >&
2 ;
exit 1 2N/A # make sure all our children behave in conformance with ascii.. 2N/A *)
echo "Invalid output terminal \"${GRUB_TERMINAL_OUTPUT}\"" >&
2 ;
exit 1 ;;
2N/A# These are defined in this script, export them here so that user can 2N/A# These are optional, user-defined variables. 2N/Aif test "x${grub_cfg}" !=
"x";
then 2N/A # Allow this to fail, since /boot/grub/ might need to be fatfs to support some 2N/A # firmware implementations (e.g. OFW or EFI). 2N/A This means that if the generated config contains a password it is readable by everyone" 2N/A# DO NOT EDIT THIS FILE 2N/A# It is automatically generated by $self using templates 2N/A# from ${grub_mkconfig_dir} and settings from ${sysconfdir}/default/grub 2N/A # emacsen backup files. FIXME: support other editors 2N/A # emacsen autosave files. FIXME: support other editors 2N/A echo "### BEGIN $i ###" 2N/A echo "### END $i ###" 2N/Aif test "x${grub_cfg}" !=
"x" ;
then 2N/A echo "Syntax errors are detected in generated GRUB config file." >&
2 2N/A echo "and /etc/grub.d/* files or please file a bug report with" >&
2 2N/A echo "${grub_cfg}.new file attached." >&
2 2N/A # none of the children aborted with error, install the new grub.cfg