Skip to content

Instantly share code, notes, and snippets.

@kaedea
Last active November 24, 2020 17:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kaedea/c8dca0d8c153d7795d977cf97604c09f to your computer and use it in GitHub Desktop.
Save kaedea/c8dca0d8c153d7795d977cf97604c09f to your computer and use it in GitHub Desktop.
Mount EFI
#!/bin/bash
# sh xxx.sh <password>
input=$1
if [ ! "$input" ];then
input="default password"
fi
set -e
diskName=$(echo $input | sudo -S diskutil list | grep -e "EFI" | awk '{ print $3 }' | sed -n '1p')
diskNum=$(echo $input | sudo -S diskutil list | grep -e "EFI" | awk '{ print $6 }' | sed -n '1p')
diskSerialNum=$(echo $input | sudo -S diskutil info $diskNum | grep -e "Volume UUID:" | awk '{ print $3 }')
diskPath=$(echo $input | sudo -S diskutil info $diskSerialNum | grep -e "Device Node" | awk '{ print $3 }')
echo $input | sudo -S diskutil mount $diskPath
open "/Volumes/$diskName"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment