• hallettj@leminal.space
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    14 hours ago

    I have to dual boot for work, so every day I have to reboot into a different OS install. It’s on its own drive with its own bootloader, so I can’t use systemctl reboot --boot-loader-entry. But I was able get a smooth process using efibootmgr.

    This is my Nushell implementation:

    def boot-to [
      device: string@boot-devices # Identifier of device to boot to (e.g. 0003)
    ] {
      sudo efibootmgr --bootnext $device
      systemctl reboot
    }
    
    # This function exists to provide tab completion for boot-to
    def boot-devices [] {
      efibootmgr | parse --regex 'Boot(?<value>\S+)\* (?<description>(?:\w+ )*\w+)'
    }