summarylogtreecommitdiffstats
path: root/grub
blob: 65af1b096411870a073bf665de46d83c179df6aa (plain)
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
#!/bin/bash
grub_generate() {
    # Install grub files into /boot
    /usr/bin/grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --modules="tpm" --disable-shim-lock
    # Create BOOTX64 file if not present. if already present check if it is grub. If it is grub then update. If not dont do any thing to it.
    if [[ -f /boot/EFI/BOOT/BOOTX64.EFI ]]; then
      if strings /boot/EFI/BOOT/BOOTX64.EFI | grep -qi grub; then
        /usr/bin/grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --modules="tpm" --disable-shim-lock --removable
      fi
    else
        /usr/bin/grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB --modules="tpm" --disable-shim-lock --removable
    fi
    # create config
    /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg
    # secureboot signing
    [[ -f /usr/bin/sbctl ]] && /usr/bin/sbctl sign-all -g
}

vmlinuz_generate() {
    # create config
    /usr/bin/grub-mkconfig -o /boot/grub/grub.cfg
}

case "$1" in
  grub_generate) grub_generate ;;
  vmlinuz_generate) vmlinuz_generate ;;
esac