summaryrefslogtreecommitdiff
path: root/scripts/install/install-postinst-new
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/install/install-postinst-new')
-rwxr-xr-xscripts/install/install-postinst-new63
1 files changed, 49 insertions, 14 deletions
diff --git a/scripts/install/install-postinst-new b/scripts/install/install-postinst-new
index 2457cdd3..0ed6441d 100755
--- a/scripts/install/install-postinst-new
+++ b/scripts/install/install-postinst-new
@@ -20,6 +20,8 @@ INSTALL_DRIVE=$1
ROOT_PARTITION=$2
# install type: "union" or "old"
INSTALL_TYPE=$3
+# For passing into vyatta-grub-setup
+EFI_PARTITION=0
# Default user
DEFAULT_USER=vyos
@@ -122,24 +124,57 @@ install_grub () {
# members.
progress_indicator start
-
- if [[ $grub_inst_drv == "md raid" ]]; then
- for slave in $raid_slaves; do
- grub_inst_drv=${slave:0:3}
- output=$(grub-install --no-floppy --recheck --root-directory=$grub_root \
- /dev/$grub_inst_drv 2>&1)
- lecho "$output"
- done
- else
- output=$(grub-install --no-floppy --recheck --root-directory=$grub_root \
- /dev/$grub_inst_drv 2>&1)
- lecho "$output"
+
+ if [ -f "/tmp/efiparts.tmp" ]; then
+ # Remove grub-pc packages
+ dpkg -r grub-pc grub2 >&/dev/null
+ # Install grub-efi packages
+ dpkg -i /usr/share/vyos/packages/grub-efi*.deb >&/dev/null
+ EFI_PARTITION=1
+ mkdir -p $grub_root/boot/efi
+ readarray parts < /tmp/efiparts.tmp
+ part_length=${#parts[@]}
+ bootloader_name="VyOS"
+ I=0
+ for part in "${parts[@]}"
+ do
+ #Name the bootloaders something different if we have a RAID
+ if [ "$part_length" -gt "1" ]; then
+ bootloader_name="VyOS (RAID disk $I)"
+ ((I++))
+ fi
+ mkdosfs -F 32 -n EFI /dev/$part >&/dev/null
+ mount /dev/$part $grub_root/boot/efi
+ output=$(grub-install --no-floppy --recheck --target=x86_64-efi --root-directory=$grub_root --efi-directory=$grub_root/boot/efi --bootloader-id="$bootloader_name" 2>&1)
+ umount $grub_root/boot/efi
+ ##TODO DO we need these to be in fstab??
+ #
+ #This is what I've used in the past
+ #if [ $I -gt 0 ]; then
+ # RAIDPART="#"
+ #fi
+ #echo "${RAIDPART}PARTUUID=$(blkid -s PARTUUID -o value $part) /boot/efi vfat defaults 0 1" >> /etc/fstab
+ done
+ rm /tmp/efiparts.tmp
+ else
+ if [[ $grub_inst_drv == "md raid" ]]; then
+ for slave in $raid_slaves; do
+ grub_inst_drv=${slave:0:3}
+ output=$(grub-install --no-floppy --recheck --root-directory=$grub_root \
+ /dev/$grub_inst_drv 2>&1)
+ lecho "$output"
+ done
+ else
+ output=$(grub-install --no-floppy --recheck --root-directory=$grub_root \
+ /dev/$grub_inst_drv 2>&1)
+ lecho "$output"
+ fi
fi
-
+
progress_indicator stop
output=$(/opt/vyatta/sbin/vyatta-grub-setup $grub_setup_args \
- "$ROOT_PARTITION" '' $grub_root 2>&1)
+ "$ROOT_PARTITION" '' $grub_root "$EFI_PARTITION" 2>&1)
ret=$?
lecho "$output"
if [ $ret == 0 ]; then