Created
December 3, 2018 05:52
-
-
Save LeifW/33a8778519982fc327240616f1aa0b50 to your computer and use it in GitHub Desktop.
YAML EFI boot entries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE DeriveGeneric, DeriveAnyClass #-} | |
import GHC.Generics (Generic()) | |
import Data.Yaml (decodeFileThrow, FromJSON, ToJSON) | |
import System.Process (callProcess) | |
import System.Environment (getArgs) | |
createEntry (BootEntry label kernel args) = | |
callProcess "sudo" ["efibootmgr", "--disk", "/dev/nvme0n1", "--part", "1", "--create", "--label", label, "--loader", kernel, "-u", unwords args] | |
data BootEntry = BootEntry { | |
label :: String, | |
kernel :: String, | |
args :: [String] | |
} deriving (Show, Eq, Generic, ToJSON, FromJSON) | |
main = do | |
[fileName] <- getArgs | |
bootEntry <- decodeFileThrow fileName | |
createEntry bootEntry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
label: Arch Linux | |
kernel: /vmlinuz-linux | |
args: | |
- root=/dev/nvme0n1p2 | |
- rw | |
- initrd=/intel-ucode.img | |
- initrd=/initramfs-linux.img | |
- net.ifnames=0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment