Last active
January 29, 2017 15:06
-
-
Save maz-1/e16c6c1d974a144ce2c004a41188d658 to your computer and use it in GitHub Desktop.
update prelinkedkernel in mac os recovery hd, for hackintosh
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 | |
set -e | |
if [[ $EUID -ne 0 ]]; then | |
exec sudo "$0" | |
exit 1 | |
fi | |
#ROOTDISK=$(mount|grep ' on / '|egrep -o 'disk\d*') | |
REC_DEV=$(diskutil info `df /|awk '/disk/ {print $1}'`|awk '/Recovery Disk:/ {print $3}') | |
#mkdir -p /Volumes/Recovery\ HD/ | |
#mount -t hfs ${REC_DEV} /Volumes/Recovery\ HD/ | |
diskutil mount ${REC_DEV} | |
cd /Volumes/Recovery\ HD/com.apple.recovery.boot/ | |
#SYS_BUD=$(sw_vers -buildVersion) | |
#RH_BUD=$( awk '/<key>ProductBuildVersion<\/key>.*/,/<\/string>/' SystemVersion.plist | egrep -o '(<string>.*</string>)' | sed -e 's/<\/*string>//g') | |
#if [[ $SYS_BUD != $RH_BUD ]];then | |
# echo "System Build Version does NOT match Recovery Build Version!!!" | |
# echo "Aborting script." | |
# exit 1 | |
#fi | |
CURRENT_DARWIN_VER=$(uname -a|awk '{print $7}'|sed 's/://g') | |
ORIG_DARWIN_VER=$(strings prelinkedkernel|egrep -o "Kernel Version \S+"|egrep -o "\d[0-9.]+\d") | |
if [[ $CURRENT_DARWIN_VER != $ORIG_DARWIN_VER ]] | |
then | |
echo "System Darwin Version does NOT match Recovery Darwin Version!!!" | |
echo "Aborting script." | |
exit 1 | |
fi | |
rm -rf prelinkedkernel | |
cp /System/Library/PrelinkedKernels/prelinkedkernel /Volumes/Recovery\ HD/com.apple.recovery.boot/ | |
touch prelinkedkernel | |
diskutil unmount force ${REC_DEV} >/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment