-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost.sh
59 lines (54 loc) · 1.16 KB
/
post.sh
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
52
53
54
55
56
57
58
#!/bin/bash
disk=sda
# we assume that EFI Partition is the 1st one
efi=${disk}1
# the linux partition follows osx
linux=${disk}3
# ----
function _mount () {
echo ... mounting volumes
sudo mount /dev/$linux /mnt
sudo mount /dev/$efi /mnt/boot/efi
for i in /dev /dev/pts /proc /sys /run; do sudo mount -B $i /mnt$i; done
}
function _umount () {
echo ... unmounting volumes
for i in /dev /dev/pts /proc /sys /run; do sudo umount /mnt$i; done
sudo umount /mnt/boot/efi
sudo umount /mnt
}
function _grub () {
echo ... update grub installer on /dev/$linux
grub-install /dev/$linux
update-grub
}
function _efipackages () {
echo ... need network connection to update efi packages
apt update
# install 32/64bit efi and let the installer decide
apt install grub-efi-ia32-bin grub-efi-amd64-bin
}
case $1 in
install)
_mount
sudo cp $0 /mnt
sudo chmod a+x /mnt/post.sh
echo ... chroot to installation to install missing packs and grub
sudo chroot /mnt /post.sh grub
sudo rm /mnt/post.sh
_umount
;;
mount)
_mount
;;
grub)
_efipackages
_grub
;;
umount)
_umount
;;
*)
cat "$0"
;;
esac