usbinstall.sh: support grub-install run from loop device (makedist) and more grub.cfg customization

This commit is contained in:
Silvan Calarco 2016-07-08 16:28:18 +02:00
parent ae46a54186
commit 3bd2e78eaf

View File

@ -341,7 +341,27 @@ else
cp $ISOMOUNTDIR/boot/{initrd*,vmlinuz*} boot/
# basic extlinux.conf -> grub.cfg conversion
echo "search --no-floppy --label --set=root openmamba_live" > $MOUNTDIR_EFI/EFI/BOOT/grub.cfg
echo "\
#
# GRUB configuration generated by openmamba usbinstall tool
#
font=unicode
set gfxmode=auto
insmod all_video
insmod gfxterm
insmod gettext
terminal_output=gfxterm
timeout=30
# theme
insmod=png
set menu_color_normal=white/black
set menu_color_highlight=white/green
search --no-floppy --label --set=root openmamba_live
#
# Boot entries taken from ISO bootloader
#
" > $MOUNTDIR_EFI/EFI/BOOT/grub.cfg
while read line; do
case $line in
"MENU LABEL "*) [ "$CURR_BRACKET_OPEN" = "1" ] && echo "}" >> $MOUNTDIR_EFI/EFI/BOOT/grub.cfg
@ -354,6 +374,7 @@ else
"append "*) set -- ${line/append initrd=}
CURR_INITRD="$1"
CURR_CMDLINE="${line/append initrd=$CURR_INITRD}"
CURR_CMDLINE="${CURR_CMDLINE/vga=792}"
echo "linux ${CURR_KERNEL} ${CURR_CMDLINE}" >> $MOUNTDIR_EFI/EFI/BOOT/grub.cfg
echo "echo \"Loading ${CURR_INITRD}\"" >> $MOUNTDIR_EFI/EFI/BOOT/grub.cfg
echo "initrd ${CURR_INITRD}" >> $MOUNTDIR_EFI/EFI/BOOT/grub.cfg
@ -384,7 +405,7 @@ fi
set_status $"Writing bootloader..."
echo $"Writing bootloader..."
sudo grub-install --removable --boot-directory boot/ $SELECT_USB &>>$LOGFILE || {
sudo grub-install --modules="part_msdos part_gpt ext2" --removable --boot-directory=boot/ $SELECT_USB &>>$LOGFILE || {
errorAndExit $"Error: failed to install bootloader into device (${SELECT_USB})"
}
set_pbar 90