3 # grub-mkconfig helper script.
4 # Copyright (C) 2006,2007,2008,2009 Free Software Foundation, Inc.
6 # GRUB is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # GRUB is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with GRUB. If not, see <http://www.gnu.org/licenses/>.
20 exec_prefix
=@exec_prefix@
23 .
${libdir}/grub
/grub-mkconfig_lib
25 if [ -z "`which os-prober 2> /dev/null`" -o -z "`which linux-boot-prober 2> /dev/null`" ] ; then
26 # missing os-prober and/or linux-boot-prober
30 OSPROBED
="`os-prober 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
31 if [ -z "${OSPROBED}" ] ; then
32 # empty os-prober output, nothing doing
36 for OS
in ${OSPROBED} ; do
37 DEVICE
="`echo ${OS} | cut -d ':' -f 1`"
38 LONGNAME
="`echo ${OS} | cut -d ':' -f 2 | tr '^' ' '`"
39 LABEL
="`echo ${OS} | cut -d ':' -f 3 | tr '^' ' '`"
40 BOOT
="`echo ${OS} | cut -d ':' -f 4`"
42 if [ -z "${LONGNAME}" ] ; then
46 echo "Found ${LONGNAME} on ${DEVICE}" >&2
52 menuentry "${LONGNAME} (on ${DEVICE})" {
54 prepare_grub_to_access_device
${DEVICE} |
sed -e "s/^/\t/"
56 if [ "${LONGNAME}" != "Windows Vista (loader)" ] ; then
58 drivemap -s (hd0) \${root}
67 LINUXPROBED
="`linux-boot-prober ${DEVICE} 2> /dev/null | tr ' ' '^' | paste -s -d ' '`"
69 for LINUX
in ${LINUXPROBED} ; do
70 LROOT
="`echo ${LINUX} | cut -d ':' -f 1`"
71 LBOOT
="`echo ${LINUX} | cut -d ':' -f 2`"
72 LLABEL
="`echo ${LINUX} | cut -d ':' -f 3 | tr '^' ' '`"
73 LKERNEL
="`echo ${LINUX} | cut -d ':' -f 4`"
74 LINITRD
="`echo ${LINUX} | cut -d ':' -f 5`"
75 LPARAMS
="`echo ${LINUX} | cut -d ':' -f 6- | tr '^' ' '`"
77 if [ -z "${LLABEL}" ] ; then
82 menuentry "${LLABEL} (on ${DEVICE})" {
84 prepare_grub_to_access_device
${DEVICE} |
sed -e "s/^/\t/"
86 linux ${LKERNEL} ${LPARAMS}
88 if [ -n "${LINITRD}" ] ; then
99 OSXUUID
="`grub-probe --target=fs_uuid --device ${DEVICE} 2> /dev/null`"
101 menuentry "${LONGNAME} (on ${DEVICE})" {
103 prepare_grub_to_access_device
${DEVICE} |
sed -e "s/^/\t/"
107 if [ /var/vm/sleepimage -nt10 / ]; then
108 if xnu_resume /var/vm/sleepimage; then
112 if [ \$do_resume == 0 ]; then
113 xnu_uuid ${OSXUUID} uuid
114 if [ -f /Extra/DSDT.aml ]; then
115 acpi -e /Extra/DSDT.aml
117 xnu_kernel /mach_kernel boot-uuid=\${uuid} rd=*uuid
118 if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
119 xnu_mkext /System/Library/Extensions.mkext
121 xnu_kextdir /System/Library/Extensions
123 if [ -f /Extra/Extensions.mkext ]; then
124 xnu_mkext /Extra/Extensions.mkext
126 if [ -d /Extra/Extensions ]; then
127 xnu_kextdir /Extra/Extensions
129 if [ -f /Extra/devtree.txt ]; then
130 xnu_devtree /Extra/devtree.txt
132 if [ -f /Extra/splash.jpg ]; then
134 xnu_splash /Extra/splash.jpg
136 if [ -f /Extra/splash.png ]; then
138 xnu_splash /Extra/splash.png
140 if [ -f /Extra/splash.tga ]; then
142 xnu_splash /Extra/splash.tga
149 echo " ${LONGNAME} is not yet supported by grub-mkconfig." >&2