-
Notifications
You must be signed in to change notification settings - Fork 3
/
boot-update
51 lines (47 loc) · 1.49 KB
/
boot-update
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/sh
#
# Copyright (C) 2015 Yen-Chine, Lee <coldnew.tw@gmail.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
# Update grub for dual boot osx
# We mount this device at /boot/efi, the directory structure like following
#
# .
# ├── mach_kernel
# └── System
# └── Library
# └── CoreServices
# ├── boot.efi
# └── SystemVersion.plist
#
# 4 directories, 2 files
#
# Variables
BOOT=/boot/efi
BOOT_EFI=${BOOT}/System/Library/CoreServices/boot.efi
GRUB_CFG=/boot/grub/grub.cfg
# Before we start, check the /boot/efi structure is ok for macbook firmware to
# boot.
#
if [ ! -d ${BOOT}/System/Library/CoreServices ]; then
echo "ERROR: $BOOT structure is valid"
exit -1
fi
# TODO: Add more secure check
grub-mkconfig -o /boot/grub/grub.cfg
grub-mkstandalone \
-d /usr/lib/grub/x86_64-efi \
-O x86_64-efi \
-o ${BOOT_EFI} ${GRUB_CFG}