Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
OneFileLinux.efi installation script for macOS
#!/bin/sh
cd ~/Downloads/
### Checking if Homebrew is installed:
command -v brew >/dev/null 2>&1 || {
echo >&2 "Installing Homebrew:"
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
}
### Getting wget:
brew install wget
### Getting latest OneFileLinux.efi release via GitHub API:
curl -s https://api.github.com/repos/zhovner/OneFileLinux/releases/latest |
grep "browser_download_url.*efi" |
cut -d : -f 2,3 |
tr -d \" |
wget -i -
### Find first macOS disk (containing Recovery HD by default) and mounting its EFI partition:
diskutil mount $(diskutil info "Recovery HD" |
grep "Part of Whole" |
grep -Eo '.{5}$')s1
### Or just mount default EFI partition:
# diskutil mount disk0s1
### Check if SIP is enabled:
if csrutil status | grep "NVRAM Protections: disabled"; then
echo "NVRAM isn't protected, continuing:"
mkdir -p /Volumes/EFI/EFI/OneFileLinux
cp -v OneFileLinux.efi /Volumes/EFI/EFI/OneFileLinux/boot.efi
sudo bless --mount /Volumes/EFI/EFI/OneFileLinux --setBoot --nextonly --file /Volumes/EFI/EFI/OneFileLinux/boot.efi --verbose
else
echo "System Integrity Protection is enabled, disabling only available in Recovery OS." >&2
exit 1
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.