Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- #Boot to drive by label
- if [ "$#" -ne 1 ]; then
- echo "Usage: `basename $0` labelOfDriveToBoot"
- exit
- fi
- if [ "$(id -u)" != "0" ]; then
- exec sudo "$0" "$@"
- fi
- label="$1"
- partitionUUIDofLabel=$(lsblk -no label,partuuid | grep -B 99 $label | grep EFI | tail -n1 | awk '{print $2}')
- efiBootNumber=$(efibootmgr | grep $partitionUUIDofLabel | awk -F* '{print $1}' | awk -F"Boot" '{print $2}')
- efibootmgr -n $efiBootNumber
- reboot
Advertisement
Add Comment
Please, Sign In to add comment