Skip to content

Instantly share code, notes, and snippets.

@evansan
Last active August 20, 2018 17:10
Show Gist options
  • Select an option

  • Save evansan/4465b16e1444f1f590882e52cb6c8d44 to your computer and use it in GitHub Desktop.

Select an option

Save evansan/4465b16e1444f1f590882e52cb6c8d44 to your computer and use it in GitHub Desktop.
automatically download and install latest clover from Dids' repo
#!/bin/bash
cd /tmp/
echo "Going to temp directory"
dnlink=`curl -s https://api.github.com/repos/dids/clover-builder/releases/latest | grep -Eo "https?://\S+?\.pkg" | head -n 1`
echo "Get the lastest download link"
efiguid=`bdmesg | grep " self device " | grep -o ........-....-....-....-............ | head -n 1`
echo "Get Booted EFI Partition's GUID"
aria2c -q -x 2 $dnlink
#requires to install aria2
dnclover=`ls | grep -e Clover`
echo "Download $dnclover"
pkgutil --expand *.pkg ./pkg
echo "Expand the pkg file"
cd /tmp/pkg/EFIFolder.pkg
echo "Change directory into EFIFolder.pkg"
tar xzf Payload
echo "unpacking the payload"
sudo diskutil mount $efiguid
efidir=`diskutil info $efiguid | grep /Volumes/EFI | tail -c 15 | sed 's/^ *//g'`
echo "Get EFI's mount point"
cp /tmp/pkg/EFIFolder.pkg/EFI/BOOT/BOOTX64.efi $efidir/EFI/BOOT/
echo "Copy BOOTX64.efi to /Volumes/EFI/EFI/BOOT/"
cp /tmp/pkg/EFIFolder.pkg/EFI/CLOVER/CLOVERX64.efi $efidir/EFI/CLOVER/
echo "Copy CLOVERX64.efi to /Volumes/EFI/EFI/CLOVER/"
sudo diskutil umount $efiguid
rm /tmp/Clover_*.pkg
echo "Remove the pkg file"
rm -R /tmp/pkg/
echo "Remove the pkg folder"
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment