Skip to content

Instantly share code, notes, and snippets.

@aquigni
Created February 24, 2018 05:54
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aquigni/5097f40413f53da5a75bc29309cc0059 to your computer and use it in GitHub Desktop.
Save aquigni/5097f40413f53da5a75bc29309cc0059 to your computer and use it in GitHub Desktop.
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