Skip to content

Instantly share code, notes, and snippets.

@valorad
Created November 25, 2017 04:41
Show Gist options
  • Save valorad/49ea1fffdb889e54c76389165c3a6907 to your computer and use it in GitHub Desktop.
Save valorad/49ea1fffdb889e54c76389165c3a6907 to your computer and use it in GitHub Desktop.
Grub ultimate bootality
#!/bin/sh
# MIT License
# Copyright (c) 2017 Xiaomajia Alliance
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
# -> note: @workspace is a btrfs subvolume.
# -> note: You may check your partition UUID in fstab or by blkid. (sudo blkid /dev/sda1)
# -> note: Remember to replace every 'var' section in EVERY submenu.
# var starts (Every submenu needs one because params won't go past)
set uuid="YOUR UUID" # e.g. 7350922f-c69c-4f33-84e0-befd8b42d2f6
set uuidESP="YOUR EFI UUID" # e.g. 05D0-CH5T
search --set=root --no-floppy --fs-uuid ${uuid}
# var ends
menuentry ' --> Go to Clover to install Hacintosh' {
insmod part_msdos
insmod chain
search --set=root --fs-uuid --no-floppy ${uuidESP}
chainloader ($root)/EFI/CLOVER/CLOVERX64.efi
}
submenu 'Debian/Ubuntu' {
# var starts (Every submenu needs one because params won't go past)
set uuid="YOUR UUID" # e.g. 7350922f-c69c-4f33-84e0-befd8b42d2f6
set uuidESP="YOUR EFI UUID" # e.g. 05D0-CH5T
search --set=root --no-floppy --fs-uuid ${uuid}
# var ends
menuentry "Kubuntu-17.04 Live Desktop amd64 - Direct Boot"{
set isofile="/@workspace/iso/kubuntu-17.04-desktop-amd64.iso"
loopback loop ${isofile}
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=${isofile} quiet splash
initrd (loop)/casper/initrd.lz
}
menuentry "Ubuntu mini 17 - Direct Boot" --class ubuntu --class gnu-linux --id trusty {
set isofile="/@workspace/iso/uBuntu17.04-Mini.iso"
loopback loop ${isofile}
linux (loop)/linux
initrd (loop)/initrd.gz
}
submenu "Debian 9" --class debian --class gnu-linux {
# var starts (Every submenu needs one because params won't go past)
set uuid="YOUR UUID" # e.g. 7350922f-c69c-4f33-84e0-befd8b42d2f6
set uuidESP="YOUR EFI UUID" # e.g. 05D0-CH5T
search --set=root --no-floppy --fs-uuid ${uuid}
# var ends
set isofile="/@workspace/iso/debian-9.2.1-amd64-netinst.iso"
loopback loop ${isofile}
menuentry "Debian 9 - graphical install" {
set background_color=black
linux (loop)/install.amd/vmlinuz vga=788 --- quiet
initrd (loop)/install.amd/gtk/initrd.gz
}
menuentry "Debian 9 - command-line install" {
set background_color=black
linux (loop)/install.amd/vmlinuz vga=788 --- quiet
initrd (loop)/install.amd/initrd.gz
}
submenu "Debian 9 - Advanced install" {
# var starts (Every submenu needs one because params won't go past)
set uuid="YOUR UUID" # e.g. 7350922f-c69c-4f33-84e0-befd8b42d2f6
set uuidESP="YOUR EFI UUID" # e.g. 05D0-CH5T
search --set=root --no-floppy --fs-uuid ${uuid}
# var ends
menuentry "Debian 9 - graphical expert install" {
set background_color=black
linux (loop)/install.amd/vmlinuz priority=low vga=788 ---
initrd (loop)/install.amd/gtk/initrd.gz
}
menuentry "Debian 9 - command-line expert install" {
set background_color=black
linux (loop)/install.amd/vmlinuz priority=low vga=788 --- quiet
initrd (loop)/install.amd/initrd.gz
}
menuentry "Debian 9 - rescue mode" {
set background_color=black
linux (loop)/install.amd/vmlinuz vga=788 rescue/enable=true --- quiet
initrd (loop)/install.amd/initrd.gz
}
}
}
}
submenu 'Fedora' {
# var starts (Every submenu needs one because params won't go past)
set uuid="YOUR UUID" # e.g. 7350922f-c69c-4f33-84e0-befd8b42d2f6
set uuidESP="YOUR EFI UUID" # e.g. 05D0-CH5T
search --set=root --no-floppy --fs-uuid ${uuid}
# var ends
menuentry "Fedora 26 LXQt Live Desktop x86_64 - Direct Boot" --class fedora --class gnu-linux --class gnu --class os {
load_video
set gfxpayload=keep
insmod loopback
insmod gzio
insmod part_gpt
insmod ext2
insmod squash4
insmod iso9660
set isofile="/@workspace/iso/Fedora-LXQt-Live-x86_64-26-1.5.iso"
loopback loop ${isofile}
linux (loop)/images/pxeboot/vmlinuz root=live:CDLABEL=Fedora-LXQt-Live-26-1-5 rootfstype=auto rd.live.image quiet rhgb iso-scan/filename=${isofile}
initrd (loop)/images/pxeboot/initrd.img
}
menuentry "Fedora 26 Web Install - Direct Boot" --class fedora --class gnu-linux --class gnu --class os {
load_video
set gfxpayload=keep
insmod loopback
insmod gzio
insmod part_gpt
insmod ext2
insmod squash4
insmod iso9660
set isofile="/@workspace/iso/Fedora-Workstation-netinst-x86_64-26-1.5.iso"
loopback loop ${isofile}
linux (loop)/images/pxeboot/vmlinuz init.stage2=hd:UUID=${uuid} noeject iso-scan/filename=${isofile}
initrd (loop)/images/pxeboot/initrd.img
}
}
submenu 'Arch' {
# var starts (Every submenu needs one because params won't go past)
set uuid="YOUR UUID" # e.g. 7350922f-c69c-4f33-84e0-befd8b42d2f6
set uuidESP="YOUR EFI UUID" # e.g. 05D0-CH5T
search --set=root --no-floppy --fs-uuid ${uuid}
# var ends
menuentry 'Archlinux-2017.08.01 LiveCD - Direct Boot' {
set isofile='/@workspace/iso/archlinux-2017.08.01-x86_64.iso'
set imgdevpath="/dev/disk/by-uuid/${uuid}"
loopback loop ${isofile}
linux (loop)/arch/boot/x86_64/vmlinuz archisodevice=/dev/loop0 img_dev=$imgdevpath img_loop=${isofile} earlymodules=loop
initrd (loop)/arch/boot/x86_64/archiso.img
}
}
menuentry " --> Firmware Setup" {
fwsetup
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment