Skip to content

Instantly share code, notes, and snippets.

@xenatt
Created July 28, 2013 05:06
Show Gist options
  • Save xenatt/6097479 to your computer and use it in GitHub Desktop.
Save xenatt/6097479 to your computer and use it in GitHub Desktop.
This Shell script Use GPL (GNU GENERAL PUBLIC LICENSE)
echo "Start Patch iCloud Service .............."
sudo cat > /Library/LaunchDaemons/com.nvram.root.plist << EOF
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.nvram.root</string>
<key>ProgramArguments</key>
<array>
<string>nvram</string>
<string>-f</string>
<string>/Extra/.nvram</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
EOF
if [ -f /Library/LaunchDaemons/com.nvram.root.plist ]
then
sudo chown root:wheel /Library/LaunchDaemons/com.nvram.root.plist
echo "INFO:\tCreated com.nvram.root.plist"
fi
echo "INFO:\tPatching NVRAM"
if [ -d /Extra ]
then
echo "INFO:\tFound\t/Extra"
else
sudo mkdir /Extra
echo "INFO:\tMake Directory\t/Extra"
fi
x=`ls /Extra | grep nvram.*.plist`
n=`nvram -p | grep fmm-mobileme-token-FMM`
if [[ -z "$n" ]]
then
echo "ERROR:\tNVRAM NOT LOAD"
if [ -f /Extra/modules/FileNVRAM.dylib ]
then
sudo nvram -p > /Extra/.nvram
sudo nvram -f /Extra/.nvram
echo "ERROR:\tPlease Enable Find My Mac or iMessage And Try Again"
sleep 5;
osascript -e "tell application \"Messages\" to set status message to \"On Mountain Lion\""
else
sudo nvram -c
echo "ERROR:\tPlease install FileNVRAM.dylib , Reboot And try again"
fi
else
sudo nvram -p > /Extra/.nvram
echo "INFO:\tCreated NVRAM log in /Extra"
fi
sudo chown root:wheel /Extra/.nvram
if [[ -f /Extra/$x && -f /Extra/.nvram && ! -z "$x" ]]
then
sudo rm -rf /Extra/$x
echo "INFO:\tRemove\t$x\t"
fi
if [[ -d /Extra/modules/ && -f /Extra/.nvram ]]
then
sudo rm -rf /Extra/modules/
echo "INFO:\tRemove\t/Extra/modules/"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment