Okay I'm guessing people have been just running my script and not even checking if it's editing their boot.efi
So now the script lets you know if it worked or not.
Here's an updated version of the script that should be more robust, now it process the boot.efi file as one long string whereas before it was in chunks and in theory if every ID was split between chunks it wouldn't find any to replace.
Link:
GDrive
Mirror:
MediaFire
Changes:
*should work on any machine (maybe?)
*gives output post-run to let user know if it worked or not
*auto-restart changed to y/n prompt in terminal
*option to null your ID out
Code:
#! /bin/bash
#####
#
# Yosemite dark boot for unsupported machines
#
# Created By : w0lf
# Last Edited : 7/30/2014
# About : Adds your board ID to boot.efi to get new dark boot screen.
# Changes : Scans file as one string, should work on all machines now.
# Warns users if ID is not found after script completion.
#
#####
do_work()
{
echo -e "Now you'll need to enter your password for some sudo commands"
echo -e "You won't see your password as you type it, just enter it and press return\n"
sudo -v
echo -e ""
echo -e "Unlocking boot.efi"
sudo chflags nouchg /System/Library/CoreServices/boot.efi
cur_time=$(date +%y%m%d%H%M%S)
echo -e "Backing up boot.efi to ~/Desktop/boot${cur_time}.efi"
sudo cp /System/Library/CoreServices/boot.efi ~/Desktop/boot${cur_time}.efi
echo -e "Getting boot.efi hex\n"
xxd -p /System/Library/CoreServices/boot.efi | tr -d '\n' > /tmp/___boot.efi
echo -e "Finding ID to replace\n"
ohex_ID=$(sed -e 's|^.*4d61632d|4d61632d|' /tmp/___boot.efi)
ohex_ID=${ohex_ID:0:40}
old_ID=$(echo -n $ohex_ID | xxd -r -ps)
echo -e "Your ID : $new_ID"
echo -e "Old ID : $old_ID\n"
echo -e "Converting ID to hex\n"
nhex_ID=$(echo -n $new_ID | xxd -ps | sed 's|[[:xdigit:]]\{2\}|\\x&|g')
nhex_ID=$(echo "$nhex_ID" | sed 's|\\x||g')
while [[ ${#nhex_ID} -lt 40 ]]; do nhex_ID=${nhex_ID}0; done
echo -e "Your ID : $nhex_ID"
echo -e "Old ID : $ohex_ID\n"
echo -e "Editing boot.efi hex\n"
if ! $(grep -q "$nhex_ID" /tmp/___boot.efi); then
echo -e "Your board ID couldn't be found in boot.efi"
echo -e "Your board ID will now be added\n"
sed -i -e "s|$ohex_ID|$nhex_ID|g" /tmp/___boot.efi
else
a_test=true
echo -e "Your board ID already exists in boot.efi"
echo -n "Would you like to REMOVE your ID? (y/n): "
read rm_ID
if [[ $rm_ID = "y" ]]; then
echo -e "Your board ID will now be nulled\n"
sed -i -e "s|$nhex_ID|4d61632d00000000000000000000000000000000|g" /tmp/___boot.efi
else
echo -e "Canceling..."
rm /tmp/___boot.efi
sudo chmod 644 /System/Library/CoreServices/boot.efi
sudo chown root:wheel /System/Library/CoreServices/boot.efi
sudo chflags uchg /System/Library/CoreServices/boot.efi
sleep 1
exit
fi
fi
perl -pe 'chomp if eof' /tmp/___boot.efi > /tmp/__boot.efi
xxd -r -p /tmp/__boot.efi /tmp/_boot.efi
echo -e "Replacing boot.efi and cleaning up /tmp"
sudo mv /tmp/_boot.efi /System/Library/CoreServices/boot.efi
rm /tmp/___boot.efi-e
rm /tmp/___boot.efi
rm /tmp/__boot.efi
#rm /tmp/_boot.efi
echo -e "Adjusting permissions and locking boot.efi\n"
sudo chmod 644 /System/Library/CoreServices/boot.efi
sudo chown root:wheel /System/Library/CoreServices/boot.efi
sudo chflags uchg /System/Library/CoreServices/boot.efi
export LANG=C
if $(cat /System/Library/CoreServices/boot.efi | tr -d '\n' | grep -q $new_ID); then
echo -e "Success!"
echo -e "Now all you need to do is reboot twice.\n"
echo -n "Would you like to reboot now? (y/n): "
read rb_now
if [[ $rb_now = "y" ]]; then sudo reboot; fi
else
if ($a_test); then
echo -e "Your ID has been removed."
else
echo -e "Hmmm... something went wrong your ID is not in boot.efi\n"
echo -e "Try adding it manually, you can find out how here:\n\n"
echo -e "https://forums.macrumors.com/threads/1751446/\n"
fi
fi
}
clear
echo -e "Welcome\n"
a_test=false
new_ID=$(ioreg -p IODeviceTree -r -n / -d 1 | grep board-id)
new_ID=${new_ID##*<\"}
new_ID=${new_ID%%\">}
osx_ver=$(sw_vers -productVersion)
if [[ $osx_ver = "10.10" ]]; then
if [[ ${#new_ID} -lt 21 ]]; then
do_work
fi
else
echo -e "Sorry this only works on OSX 10.10 Yosemite\n"
fi
Please post if this works for you. So I know this actually works for other people. Thanks.