Created
February 24, 2018 05:54
-
-
Save aquigni/5097f40413f53da5a75bc29309cc0059 to your computer and use it in GitHub Desktop.
OneFileLinux.efi installation script for macOS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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