~ubuntu-branches/ubuntu/trusty/grub2/trusty-updates

« back to all changes in this revision

Viewing changes to util/grub.d/10_xnu.in

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2012-09-13 18:02:04 UTC
  • mfrom: (1.17.15 upstream)
  • mto: (17.6.27 experimental)
  • mto: This revision was merged to the branch mainline in revision 145.
  • Revision ID: package-import@ubuntu.com-20120913180204-mojnmocbimlom4im
Tags: upstream-2.00
ImportĀ upstreamĀ versionĀ 2.00

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
set -e
 
3
 
 
4
# grub-mkconfig helper script.
 
5
# Copyright (C) 2006,2007,2008,2009,2012  Free Software Foundation, Inc.
 
6
#
 
7
# GRUB is free software: you can redistribute it and/or modify
 
8
# it under the terms of the GNU General Public License as published by
 
9
# the Free Software Foundation, either version 3 of the License, or
 
10
# (at your option) any later version.
 
11
#
 
12
# GRUB is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
#
 
17
# You should have received a copy of the GNU General Public License
 
18
# along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
19
 
 
20
prefix="@prefix@"
 
21
exec_prefix="@exec_prefix@"
 
22
datarootdir="@datarootdir@"
 
23
 
 
24
export TEXTDOMAIN=@PACKAGE@
 
25
export TEXTDOMAINDIR="@localedir@"
 
26
 
 
27
. "@datadir@/@PACKAGE@/grub-mkconfig_lib"
 
28
 
 
29
osx_entry() {
 
30
    if [ x$2 = x32 ]; then
 
31
        # TRANSLATORS: it refers to kernel architecture (32-bit)
 
32
        bitstr="$(gettext "(32-bit)")"
 
33
    else
 
34
        # TRANSLATORS: it refers to kernel architecture (64-bit)
 
35
        bitstr="$(gettext "(64-bit)")"
 
36
    fi
 
37
    # TRANSLATORS: it refers on the OS residing on device %s
 
38
    onstr="$(gettext_printf "(on %s)" "${GRUB_DEVICE}")"
 
39
        cat << EOF
 
40
menuentry '$(echo "Darwin/Mac OS X $bitstr $onstr" | grub_quote)' --class osx --class darwin --class os \$menuentry_id_option 'osprober-xnu-$2-$(grub_get_device_id "${GRUB_DEVICE}")'  {
 
41
EOF
 
42
        save_default_entry | sed -e "s/^/       /"
 
43
        prepare_grub_to_access_device ${GRUB_DEVICE} | sed -e "s/^/     /"
 
44
        cat << EOF
 
45
        load_video
 
46
        set do_resume=0
 
47
        if [ /var/vm/sleepimage -nt10 / ]; then
 
48
           if xnu_resume /var/vm/sleepimage; then
 
49
             set do_resume=1
 
50
           fi
 
51
        fi
 
52
        if [ \$do_resume = 0 ]; then
 
53
           xnu_uuid ${OSXUUID} uuid
 
54
           if [ -f /Extra/DSDT.aml ]; then
 
55
              acpi -e /Extra/DSDT.aml
 
56
           fi
 
57
           if [ /kernelcache -nt /System/Library/Extensions ]; then
 
58
              $1 /kernelcache boot-uuid=\${uuid} rd=*uuid
 
59
           else
 
60
              $1 /mach_kernel boot-uuid=\${uuid} rd=*uuid
 
61
              if [ /System/Library/Extensions.mkext -nt /System/Library/Extensions ]; then
 
62
                xnu_mkext /System/Library/Extensions.mkext
 
63
              else
 
64
                xnu_kextdir /System/Library/Extensions
 
65
              fi
 
66
           fi
 
67
           if [ -f /Extra/Extensions.mkext ]; then
 
68
              xnu_mkext /Extra/Extensions.mkext
 
69
           fi
 
70
           if [ -d /Extra/Extensions ]; then
 
71
              xnu_kextdir /Extra/Extensions
 
72
           fi
 
73
           if [ -f /Extra/devprop.bin ]; then
 
74
              xnu_devprop_load /Extra/devprop.bin
 
75
           fi
 
76
           if [ -f /Extra/splash.jpg ]; then
 
77
              insmod jpeg
 
78
              xnu_splash /Extra/splash.jpg
 
79
           fi
 
80
           if [ -f /Extra/splash.png ]; then
 
81
              insmod png
 
82
              xnu_splash /Extra/splash.png
 
83
           fi
 
84
           if [ -f /Extra/splash.tga ]; then
 
85
              insmod tga
 
86
              xnu_splash /Extra/splash.tga
 
87
           fi
 
88
        fi
 
89
}
 
90
EOF
 
91
}
 
92
 
 
93
OSXUUID="`${grub_probe} --target=fs_uuid --device ${GRUB_DEVICE} 2> /dev/null`"
 
94
osx_entry xnu_kernel 32
 
95
osx_entry xnu_kernel64 64