1
0
Fork 0

추가 설치파일 변경

This commit is contained in:
Sangbum Kim 2017-04-19 01:58:16 +09:00
parent 950d41abef
commit 6e2e8b4e2b
2 changed files with 260 additions and 143 deletions

Binary file not shown.

View File

@ -1,13 +1,13 @@
#!/bin/sh #!/bin/sh
# Maintained by: toleda for: github.com/toleda/audio_cloverALC # Maintained by: toleda for: github.com/toleda/audio_cloverALC
gFile="audio_cloverALC-120.command_v1.0d" gFile="audio_cloverALC-120.command_v1.0f"
# gFile="audio_pikeralphaALC-120.command_v1.0d" # gFile="audio_pikeralphaALC-120.command_v1.0f"
# Credit: bcc9, RevoGirl, PikeRAlpha, SJ_UnderWater, RehabMan, TimeWalker75a, lisai9093 # Credit: bcc9, RevoGirl, PikeRAlpha, SJ_UnderWater, RehabMan, TimeWalker75a, lisai9093
# #
# OS X Clover Realtek ALC Onboard Audio # OS X Clover Realtek ALC Onboard Audio
# #
# Enables OS X Realtek ALC onboard audio in 10.12, 10.11, 10.10, 10.9 and 10.8, all versions # Enables OS X Realtek ALC onboard audio in 10.12, 10.11, 10.10, 10.9 and 10.8, all versions
# 1. Supports Realtek ALC885, 887, 888, 889, 892, 898 and 1150 # 1. Supports Realtek ALC885, 887, 888, 889, 892, 898, 1150 and 1220
# 2. Clover patched native AppleHDA.kext installed in System/Library/Extensions # 2. Clover patched native AppleHDA.kext installed in System/Library/Extensions
# #
# Requirements # Requirements
@ -21,7 +21,7 @@ gFile="audio_cloverALC-120.command_v1.0d"
# 2. Enter password at prompt # 2. Enter password at prompt
# 3. For Clover/EFI, EFI partition must be mounted before running script # 3. For Clover/EFI, EFI partition must be mounted before running script
# 4. For Clover/Legacy, answer y to Confirm Clover Legacy Install (y/n) # 4. For Clover/Legacy, answer y to Confirm Clover Legacy Install (y/n)
# 5. Confirm Realtek ALCxxx (y/n): (885, 887, 888, 889, 892, 898, 1150) # 5. Confirm Realtek ALCxxx (y/n): (885, 887, 888, 889, 892, 898, 1150, 1220)
# 6. Clover Audio ID Injection (y/n): # 6. Clover Audio ID Injection (y/n):
# If y: # If y:
# 7. Use Audio ID: x (y/n): # 7. Use Audio ID: x (y/n):
@ -29,15 +29,17 @@ gFile="audio_cloverALC-120.command_v1.0d"
# Audio IDs: # Audio IDs:
# 1 - 3/5/6 port Realtek ALCxxx audio # 1 - 3/5/6 port Realtek ALCxxx audio
# 2 - 3 port (5.1) Realtek ALCxxx audio (n/a 885) # 2 - 3 port (5.1) Realtek ALCxxx audio (n/a 885)
# 3 - HD3000/HD4000 HDMI audio w/Realtek ALCxxx audio (n/a 885/1150 & 887/888 Legacy) # 3 - HD3000/HD4000 HDMI audio w/Realtek ALCxxx audio (n/a 885/1150/1220 & 887/888 Legacy)
# 8. Select Audio ID (1, 2 or 3) # 8. Select Audio ID (1, 2 or 3)
# 9. Restart # 9. Restart
# #
# Change log: # Change log:
# v1.0a - 7/15/16: Initial 10.12 support # v1.0f0 - 2/21/17: Add 1220 codecs, fix PlugIn, bugs
# v1.0b0 - 8/7/16: KextTo Patch fix # v1.0e0 - Not released
# v1.0c0 - 8/16/16: Clean up
# v1.0d0 - 8/24/16: Clean up, synch with realtekALC and pikeralphaALC # v1.0d0 - 8/24/16: Clean up, synch with realtekALC and pikeralphaALC
# v1.0c0 - 8/16/16: Clean up
# v1.0b0 - 8/7/16: KextTo Patch fix
# v1.0a - 7/15/16: Initial 10.12 support
echo " " echo " "
echo "Agreement" echo "Agreement"
@ -51,21 +53,27 @@ echo " "
# debug=1 - test drive: copy config.plist to Desktop, edited config.plist, realtekALC.kext, layout_.xml and Platforms files copied to Desktop/codec # debug=1 - test drive: copy config.plist to Desktop, edited config.plist, realtekALC.kext, layout_.xml and Platforms files copied to Desktop/codec
# set initial variables # set initial variables
gDebug=0 gDebug=0 ##
gBetaALC=0
gBetacodec=0
gSysVer=`sw_vers -productVersion` gSysVer=`sw_vers -productVersion`
gSysName="Mavericks" gSysName="Mavericks"
gStartupDisk=EFI gStartupDisk=EFI
gCloverDirectory=/Volumes/$gStartupDisk/EFI/CLOVER gCloverDirectory=/Volumes/$gStartupDisk/EFI/CLOVER
gDesktopDirectory=/Users/$(whoami)/Desktop/ # gUserDirectory=/Volumes/850E-Users ##
gDesktopDirectory=/Users/$(whoami)/Desktop
gDesktopDirectory=$gUserDirectory$gDesktopDirectory
gLibraryDirectory=/Library/Extensions gLibraryDirectory=/Library/Extensions
gExtensionsDirectory=/System/Library/Extensions gExtensionsDirectory=/System/Library/Extensions
gHDAContentsDirectory=$gExtensionsDirectory/AppleHDA.kext/Contents gHDAContentsDirectory=$gExtensionsDirectory/AppleHDA.kext/Contents
gHDAHardwarConfigDirectory=$gHDAContentsDirectory/Plugins/AppleHDAHardwareConfigDriver.kext/Contents gHDAHardwarConfigDirectory=$gHDAContentsDirectory/PlugIns/AppleHDAHardwareConfigDriver.kext/Contents
gHDAControllerbinaryDirectory=$gHDAContentsDirectory/Plugins/AppleHDAController.kext/Contents/MacOS gHDAControllerbinaryDirectory=$gHDAContentsDirectory/PlugIns/AppleHDAController.kext/Contents/MacOS
gAudioid=1 gAudioid=1
gLayoutid=1 gLayoutid=1
gPatch="-toledaALC" gPatch="-toledaALC"
gCodec=892 gCodec=892
#gCodec1220S=n
gCodec1220A=n
gLegacy=n gLegacy=n
gController=n gController=n
gMake=0 gMake=0
@ -80,7 +88,7 @@ gPikerAlphaALC=0
gRealtekALC=0 gRealtekALC=0
gAudioidvalid=n gAudioidvalid=n
gCodecvalid=n gCodecvalid=n
gtestALC=0 g200SeriesAudio=n
# debug # debug
if [ $gDebug = 2 ]; then if [ $gDebug = 2 ]; then
@ -89,7 +97,7 @@ if [ $gDebug = 2 ]; then
echo "gCloverALC = $gCloverALC" echo "gCloverALC = $gCloverALC"
echo "gPikerAlphaALC = $gPikerAlphaALC" echo "gPikerAlphaALC = $gPikerAlphaALC"
echo "gRealtekALC = $gRealtekALC" echo "gRealtekALC = $gRealtekALC"
echo "gtestALC = $gtestALC" echo "gBetaALC = $gBetaALC"
# while true # while true
# do # do
@ -205,7 +213,7 @@ if [ $gRealtekALC = 1 ]; then
fi fi
if [[ -d $gChameleonDirectory ]]; then if [[ -d $gChameleonDirectory ]]; then
if [ -f "$gChameleonDirectory/org.chameleon.Boot.plist" ]; then if [ ! -f "$gChameleonDirectory/org.chameleon.Boot.plist" ]; then
cp -p "$gChameleonDirectory/org.chameleon.Boot.plist" "/tmp/org.chameleon.Boot.txt" cp -p "$gChameleonDirectory/org.chameleon.Boot.plist" "/tmp/org.chameleon.Boot.txt"
# debug # debug
@ -515,24 +523,29 @@ else
;; ;;
1 ) 1 )
if [ -d "$gDesktopDirectory/config-basic.plist" ]; then if [ ! -f "$gCloverDirectory/config.plist" ]; then
echo "Desktop/config-basic.plist copied missing" echo "Error, $gCloverDirectory/config.plist missing"
exit 1 exit 1
fi fi
sudo cp -R "$gDesktopDirectory/config-basic.plist" /tmp/config.plist sudo cp -R "$gCloverDirectory/config.plist" /tmp/config.plist
echo "Desktop/config-basic.plist copied to /tmp/config.plist" echo "$gCloverDirectory/config.plist copied to /tmp/config.plist"
;; ;;
2 ) 2 )
echo "gHDAversioninstalled = $gHDAversioninstalled" echo "gHDAversioninstalled = $gHDAversioninstalled"
if [ -d "$gDesktopDirectory/config-basic.plist" ]; then echo "gDesktopDirectory = $gDesktopDirectory"
echo "Desktop/config-basic.plist copied missing" sudo cp -R "$gDesktopDirectory/config-basic.plist" /tmp/config.plist
if [ -f "$gDesktopDirectory/config-basic.plist" ]; then
sudo cp -R "$gDesktopDirectory/config-basic.plist" /tmp/config.plist
echo "Desktop/config-basic.plist copied to /tmp/config.plist"
else
echo "Error, Desktop/config-basic.plist missing"
exit 1 exit 1
fi fi
sudo cp -R "$gDesktopDirectory/config-basic.plist" /tmp/config.plist
echo "Desktop/config-basic.plist copied to /tmp/config.plist"
;; ;;
* ) * )
@ -543,6 +556,7 @@ esac
fi fi
# exit if error # exit if error
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
if [ $choice8 != "y" ]; then if [ $choice8 != "y" ]; then
@ -643,15 +657,21 @@ gCodecsInstalled=$(ioreg -rxn IOHDACodecDevice | grep VendorID | awk '{ print $4
gCodecsVersion=$(ioreg -rxn IOHDACodecDevice | grep RevisionID| awk '{ print $4 }') gCodecsVersion=$(ioreg -rxn IOHDACodecDevice | grep RevisionID| awk '{ print $4 }')
# debug # debug
if [ $gDebug = 2 ]; then #if [ $gDebug = 2 ]; then ##
# if [ $gDebug = 1 ] || [ $gDebug = 2 ]; then
# gCodecsInstalled=0x10ec0887 # gCodecsInstalled=0x10ec0887
# gCodecsVersion=0x100101 # gCodecsVersion=0x100101
# gCodecsVersion=0x100202 # gCodecsVersion=0x100202
# gCodecsVersion=0x100302 # gCodecsVersion=0x100302
# gCodecsInstalled=0x10ec0900 # gCodecsInstalled=0x10ec0900
# gCodecsInstalled=0x10ec1168
# gCodecsInstalled=0x10ec1220
# gCodecsVersion=0x100001 # gCodecsVersion=0x100001
# gCodecsInstalled=0x10134206 # gCodecsInstalled=0x10134206
# gCodecsVersion=0x100302 # gCodecsVersion=0x100302
#fi
if [ $gDebug = 2 ]; then
echo "gCodecsInstalled = $gCodecsInstalled" echo "gCodecsInstalled = $gCodecsInstalled"
echo "gCodecsVersion = $gCodecsVersion" echo "gCodecsVersion = $gCodecsVersion"
fi fi
@ -766,6 +786,22 @@ if [ $realtek = y ]; then
gCodecName=1150 gCodecName=1150
fi fi
# new codec
if [ $gCodecDevice = "0867" ]; then
gCodecName=891
fi
if [ $gCodecDevice = "1168" ]; then
gCodec1220A=y
gCodecName=1220
fi
if [ $gCodecDevice = "1220" ]; then
# gCodec1220S=y
gCodecName=1220
fi
# debug # debug
if [ $gDebug = 2 ]; then if [ $gDebug = 2 ]; then
echo "Codec identification: success" echo "Codec identification: success"
@ -779,9 +815,10 @@ if [ $gPikerAlphaALC = 1 ]; then
echo "" echo ""
fi fi
# new codec
# validate_realtek codec # validate_realtek codec
case "$gCodecName" in case "$gCodecName" in
269|283|885|887|888|889|892|898|1150 ) 269|283|885|887|888|889|892|898|1150|1220 )
# confirm codec, go button # confirm codec, go button
while true while true
@ -814,13 +851,14 @@ fi
if [ $gCodecvalid != y ]; then if [ $gCodecvalid != y ]; then
# new codec
# get supported codec # get supported codec
echo "Supported RealtekALC codecs: 885, 887, 888, 889, 892, 898 or 1150 (0 to exit)" echo "Supported RealtekALC codecs: 885, 887, 888, 889, 892, 898, 1150 and 1220 (0 to exit)"
while true while true
do do
read -p "Enter codec: " choice0 read -p "Enter codec: " choice0
case "$choice0" in case "$choice0" in
269|283|885|887|888|889|892|898|1150 ) gCodec=$choice0; break;; 269|283|885|887|888|889|892|898|1150|1220 ) gCodec=$choice0; break;;
0 ) echo "No system files were changed" 0 ) echo "No system files were changed"
echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..." echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..."
exit 1;; exit 1;;
@ -985,7 +1023,7 @@ if [ $gCloverALC = 1 ]; then
# echo "0 - dsdt/ssdt HDMI audio (AMD/Nvidia/Intel)" # echo "0 - dsdt/ssdt HDMI audio (AMD/Nvidia/Intel)"
echo "1 - 3/5/6 port Realtek ALCxxx audio" echo "1 - 3/5/6 port Realtek ALCxxx audio"
echo "2 - 3 port (5.1) Realtek ALCxxx audio (n/a 885)" echo "2 - 3 port (5.1) Realtek ALCxxx audio (n/a 885)"
echo "3 - HD3000/HD4000/HD5xx HDMI audio and Realtek ALCxxx audio (n/a 885 & 887/888 Legacy)" echo "3 - HD3000/HD4000 HDMI audio and Realtek ALCxxx audio (n/a 885 & 887/888 Legacy)"
while true while true
do do
# read -p "Select Audio ID? (0, 1, 2 or 3): " choice6 # read -p "Select Audio ID? (0, 1, 2 or 3): " choice6
@ -996,7 +1034,9 @@ if [ $gCloverALC = 1 ]; then
2* ) gAudioid=2; if [ $gCodec = 885 ]; then echo "ID: 2 n/a, try again..."; else break; fi;; 2* ) gAudioid=2; if [ $gCodec = 885 ]; then echo "ID: 2 n/a, try again..."; else break; fi;;
3* ) gAudioid=3; valid=y; 3* ) gAudioid=3; valid=y;
if [ $gCodec = 885 ]; then valid=n; fi; if [ $gCodec = 885 ]; then valid=n; fi;
# if [ $gCodec = 1150 ]; then valid=n; fi; if [ $gCodec = 1150 ]; then valid=n; fi;
# new codec
if [ $gCodec = 1220 ]; then valid=n; fi;
if [ $gLegacy = y ]; then valid=n; fi; if [ $gLegacy = y ]; then valid=n; fi;
if [ $valid = n ]; then echo "ID: 3 n/a, try again..."; else break; fi;; if [ $valid = n ]; then echo "ID: 3 n/a, try again..."; else break; fi;;
* ) echo "Try again...";; * ) echo "Try again...";;
@ -1006,43 +1046,82 @@ if [ $gCloverALC = 1 ]; then
fi fi
# debug # debug
if [ $gDebug = 2 ]; then if [ $gDebug = 2 ]; then
echo "gCodec = $gCodec" echo "gCodec = $gCodec"
echo "gBetaALC = $gBetaALC"
echo "gBetacodec = $gBetacodec"
echo "gAudioid = $gAudioid" echo "gAudioid = $gAudioid"
echo "gLegacy = $gLegacy" echo "gLegacy = $gLegacy"
echo "gController = $gController" echo "gController = $gController"
echo "Codec configuration: success" echo "Codec configuration: success"
fi fi
if [ $gPikerAlphaALC = 0 ]; then # g200SeriesAudio
echo "" # confirm 200 series audio
echo "Download ALC$gCodec files ..."
case "$gCodec" in
1220 )
# while true
# do
# read -p "Confirm 200 Series audio (y/n): " choice14
# case "$choice14" in
# [yY]* ) g200SeriesAudio=y; break;;
# [nN]* )
# echo "User termination"
# echo "No system files were changed"
# echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..."
# exit 1
# ;;
# * ) echo "Try again...";;
# esac
# done
if [ ${gSysVer:6:1} -lt 4 ]; then
echo "macOS supports 200 series audio with 10.12.4 and newer"
while true
do
read -p "No audio on restart, continue (y/n): " choice15
case "$choice15" in
[yY]* ) g200SeriesAudio=y; break;;
[nN]* )
echo "User termination"
echo "No system files were changed"
echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..."
exit 1
;;
* ) echo "Try again...";;
esac
done
fi
;;
esac
if [ $gPikerAlphaALC = 0 ]; then
if [ $gtestALC = 0 ]; then
gDownloadLink="https://raw.githubusercontent.com/toleda/audio_ALC$gCodec/master/$gCodec.zip" gDownloadLink="https://raw.githubusercontent.com/toleda/audio_ALC$gCodec/master/$gCodec.zip"
if [ $gLegacy = y ]; then if [ $gLegacy = y ]; then
Legacy=_v100202 Legacy=_v100202
gDownloadLinkLegacy="https://raw.githubusercontent.com/toleda/audio_ALC$gCodec/master/$gCodec$Legacy.zip" gDownloadLink="https://raw.githubusercontent.com/toleda/audio_ALC$gCodec/master/$gCodec$Legacy.zip"
sudo curl -o "/tmp/ALC$gCodec.zip" $gDownloadLinkLegacy
else
sudo curl -o "/tmp/ALC$gCodec.zip" $gDownloadLink
fi fi
unzip -qu "/tmp/ALC$gCodec.zip" -d "/tmp/" if [ $gBetacodec = $gCodecName ]; then
else
# confirm codec test # confirm codec test
while true while true
do do
read -p "Confirm Realtek ALC$gCodec test (y/n): " choice13 read -p "Confirm ALC$gCodec Beta files (y/n): " choice13
case "$choice13" in case "$choice13" in
[yY]* ) break;; [yY]* ) break;;
[nN]* ) [nN]* )
echo "Error: set gtestALC=0" echo "User termination"
echo "No system files were changed" echo "No system files were changed"
echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..." echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..."
exit 1 exit 1
@ -1052,11 +1131,35 @@ do
done done
gDownloadLink="https://raw.githubusercontent.com/toleda/audio_alc_test/master/$gCodec.zip" gDownloadLink="https://raw.githubusercontent.com/toleda/audio_alc_test/master/$gCodec.zip"
fi
# debug
if [ $gDebug = 2 ]; then
echo "gDownloadLink = $gDownloadLink"
echo "gCodec = $gCodec"
fi
#if [ $gCodec1220S = y ]; then
# gCodec+="S"
#fi
if [ $gCodec1220A = y ]; then
gCodec+="A"
fi
echo ""
echo "Download ALC$gCodec files ..."
sudo curl -o "/tmp/ALC$gCodec.zip" $gDownloadLink sudo curl -o "/tmp/ALC$gCodec.zip" $gDownloadLink
unzip -qu "/tmp/ALC$gCodec.zip" -d "/tmp/" unzip -qu "/tmp/ALC$gCodec.zip" -d "/tmp/"
gDownloadLink="https://raw.githubusercontent.com/toleda/audio_alc_test/master/realtekALC.kext.zip"
sudo curl -o "/tmp/realtekALC.kext.zip" $gDownloadLink # exit if error
unzip -qu "/tmp/realtekALC.kext.zip" -d "/tmp/" if [ "$?" != "0" ]; then
echo "Error: No Realtek ALC$gCodec Beta files"
echo "No system files were changed"
echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..."
exit 1
fi
fi fi
@ -1067,7 +1170,7 @@ if [ "$?" != "0" ]; then
echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..." echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..."
exit 1 exit 1
fi fi
fi
# debug # debug
if [ $gDebug = 2 ]; then if [ $gDebug = 2 ]; then
@ -1138,8 +1241,8 @@ if [ "$?" != "0" ]; then
sudo rm -R /tmp/ktp.plist sudo rm -R /tmp/ktp.plist
sudo rm -R /tmp/config.plist sudo rm -R /tmp/config.plist
sudo rm -R /tmp/config-audio_cloverALC.plist sudo rm -R /tmp/config-audio_cloverALC.plist
sudo rm -R /tmp/$gCodec.zip sudo rm -R /tmp/$gCodecName.zip
sudo rm -R /tmp/$gCodec sudo rm -R /tmp/$gCodecName
echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..." echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..."
exit 1 exit 1
fi fi
@ -1148,7 +1251,12 @@ fi
echo "Download kext patches" echo "Download kext patches"
if [ $gBetaALC = 0 ]; then
gDownloadLink="https://raw.githubusercontent.com/toleda/audio_cloverALC/master/config-audio_cloverALC.plist.zip" gDownloadLink="https://raw.githubusercontent.com/toleda/audio_cloverALC/master/config-audio_cloverALC.plist.zip"
else
gDownloadLink="https://raw.githubusercontent.com/toleda/audio_alc_test/master/config-audio_cloverALC.plist.zip"
fi
sudo curl -o "/tmp/config-audio_cloverALC.plist.zip" $gDownloadLink sudo curl -o "/tmp/config-audio_cloverALC.plist.zip" $gDownloadLink
unzip -qu "/tmp/config-audio_cloverALC.plist.zip" -d "/tmp/" unzip -qu "/tmp/config-audio_cloverALC.plist.zip" -d "/tmp/"
@ -1170,23 +1278,6 @@ if [ $ktpexisting = 0 ]; then
fi fi
fi fi
# remove t1 patches (cloverALC)
# index=0
# while [ $ktpexisting -ge 1 ]; do
# if [ $(sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:$index dict'" /tmp/config.plist | grep -c "t1-") = 1 ]; then
# sudo /usr/libexec/PlistBuddy -c "Delete ':KernelAndKextPatches:KextsToPatch:$index dict'" /tmp/config.plist
# ktpexisting=$(sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:'" /tmp/config.plist | grep -c "t1-")
# index=$((index - 1))
# fi
# index=$((index + 1))
# debug
# if [ $gDebug = 2 ]; then
# echo "t1 patches"
# echo "index = $index"
# echo "ktpexisting = $ktpexisting"
# fi
# done
# remove AppleHDAController patches (mb) # remove AppleHDAController patches (mb)
ktpexisting=$(sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:'" /tmp/config.plist | grep -c "AppleHDAController") ktpexisting=$(sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:'" /tmp/config.plist | grep -c "AppleHDAController")
@ -1230,29 +1321,6 @@ if [ $gDebug = 2 ]; then
fi fi
done done
# remove AppleHDA patches (any remaining)
# ktpexisting=$(sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:'" /tmp/config.plist | grep -c "AppleHDA")
# index=0
# while [ $ktpexisting -ge 1 ]; do
# if [ $(sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:$index dict'" /tmp/config.plist | grep -c "AppleHDA") = 1 ]; then
# if [ $(sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:$index dict'" /tmp/config.plist | grep -c "x99") = 0 ]; then
# sudo /usr/libexec/PlistBuddy -c "Delete ':KernelAndKextPatches:KextsToPatch:$index dict'" /tmp/config.plist
# fi
# ktpexisting=$(sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:'" /tmp/config.plist | grep -c "AppleHDA")
# index=$((index - 1))
# fi
# gMB=1
# index=$((index + 1))
# debug
# if [ $gDebug = 2 ]; then
# echo "AppleHDA patches (any remaining)"
# echo "index = $index"
# echo "ktpexisting = $ktpexisting"
# fi
# done
# set patch for codec # set patch for codec
case $gCodec in case $gCodec in
@ -1266,12 +1334,24 @@ case $gCodec in
1150 ) patch1=7;; 1150 ) patch1=7;;
269 ) patch1=8;; 269 ) patch1=8;;
283) patch1=9;; 283) patch1=9;;
# sierra only, patch1=13
# el capitan only, patch1=10 # el capitan only, patch1=10
# hd4600 hdmi audio only, patch1=11 # hd4600 hdmi audio only, patch1=11
# hd4600 hdmi audio only, patch1=12 # hd4600 hdmi audio only, patch1=12
# sierra only, patch1=13
# new codecs
891 ) patch1=14;;
#1220 ) patch1=15;; # 0x1168
#1220S ) patch1=16;; # 0x1220
1220A ) patch1=15;; # 0x1168
1220 ) patch1=16;; # 0x1220
# 200 series audio only, patch1=17
esac esac
# if [ $gCodec1220S = y ]; then
# patch1=16
# fi
patch=( 0 $patch1 ) patch=( 0 $patch1 )
index=0 index=0
@ -1294,9 +1374,10 @@ case $gSysName in
"Sierra"|"El Capitan" ) "Sierra"|"El Capitan" )
case $gCodec in case $gCodecName in
887|888|889|892|898|1150 ) #887|888|889|892|898|1150|1220|1220S|891 )
887|888|889|892|898|1150|1220A|1220|891 )
case $gSysName in case $gSysName in
@ -1323,22 +1404,35 @@ sudo /usr/libexec/PlistBuddy -c "Merge /tmp/ktp.plist ':KernelAndKextPatches:Kex
esac esac
# codec patch hd4600 hdmi audio/credit TimeWalker75a # codec patch hd4600 hdmi audio/credit TimeWalker75a
if [ $choice2 = y ]; then if [ $gController = y ]; then
index=11 index=11
while [ $index -lt 13 ]; do while [ $index -lt 13 ]; do
sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:$index}'" /tmp/config-audio_cloverALC.plist -x > "/tmp/ktp.plist" sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:$index}'" /tmp/config-audio_cloverALC.plist -x > "/tmp/ktp.plist"
ktpcomment=$(sudo /usr/libexec/PlistBuddy -c "Print 'Comment'" "/tmp/ktp.plist") ktpcomment=$(sudo /usr/libexec/PlistBuddy -c "Print 'Comment'" "/tmp/ktp.plist")
sudo /usr/libexec/PlistBuddy -c "Set :Comment 't1-$ktpcomment'" "/tmp/ktp.plist" sudo /usr/libexec/PlistBuddy -c "Set :Comment 't1-$ktpcomment'" "/tmp/ktp.plist"
sudo /usr/libexec/PlistBuddy -c "Add :KernelAndKextPatches:KextsToPatch:0 dict" /tmp/config.plist sudo /usr/libexec/PlistBuddy -c "Add :KernelAndKextPatches:KextsToPatch:0 dict" /tmp/config.plist
sudo /usr/libexec/PlistBuddy -c "Merge /tmp/ktp.plist ':KernelAndKextPatches:KextsToPatch:0'" /tmp/config.plist sudo /usr/libexec/PlistBuddy -c "Merge /tmp/ktp.plist ':KernelAndKextPatches:KextsToPatch:0'" /tmp/config.plist
index=$((index + 1)) index=$((index + 1))
done done
fi fi
# 200 series audio patch (temporary)
# if [ $g200SeriesAudio = y ]; then
# sudo /usr/libexec/PlistBuddy -c "Print ':KernelAndKextPatches:KextsToPatch:17}'" /tmp/config-audio_cloverALC.plist -x > "/tmp/ktp.plist"
# ktpcomment=$(sudo /usr/libexec/PlistBuddy -c "Print 'Comment'" "/tmp/ktp.plist")
# sudo /usr/libexec/PlistBuddy -c "Set :Comment 't1-$ktpcomment'" "/tmp/ktp.plist"
# sudo /usr/libexec/PlistBuddy -c "Add :KernelAndKextPatches:KextsToPatch:0 dict" /tmp/config.plist
# sudo /usr/libexec/PlistBuddy -c "Merge /tmp/ktp.plist ':KernelAndKextPatches:KextsToPatch:0'" /tmp/config.plist
# fi
# exit if error # exit if error
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then
echo Error: config.plst edit failed echo Error: config.plst edit failed
@ -1347,8 +1441,8 @@ if [ "$?" != "0" ]; then
sudo rm -R /tmp/ktp.plist sudo rm -R /tmp/ktp.plist
sudo rm -R /tmp/config.plist sudo rm -R /tmp/config.plist
sudo rm -R /tmp/config-audio_cloverALC.plist sudo rm -R /tmp/config-audio_cloverALC.plist
sudo rm -R /tmp/$gCodec.zip sudo rm -R /tmp/$gCodecName.zip
sudo rm -R /tmp/$gCodec sudo rm -R /tmp/$gCodecName
echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..." echo "To save a Copy of this Terminal session: Terminal/Shell/Export Text As ..."
exit 1 exit 1
fi fi
@ -1361,8 +1455,8 @@ case $gDebug in
;; ;;
1|2 ) 1|2 )
sudo cp -R /tmp/config.plist /tmp/$gCodec sudo cp -R /tmp/config.plist /tmp/$gCodecName
echo "/tmp/config.plist copied to /tmp/$gCodec" echo "/tmp/config.plist copied to /tmp/$gCodecName"
;; ;;
esac esac
@ -1427,57 +1521,66 @@ if [ -d "$gCloverDirectory/$gSysFolder" ]; then
gSysFolder=kexts/Other gSysFolder=kexts/Other
fi fi
if [ $gtestALC = 0 ]; then if [ $gBetaALC = 0 ]; then
echo "Download config kext and install ..." echo "Download config kext and install ..."
gDownloadLink="https://raw.githubusercontent.com/toleda/audio_cloverALC/master/realtekALC.kext.zip" gDownloadLink="https://raw.githubusercontent.com/toleda/audio_cloverALC/master/realtekALC.kext.zip"
sudo curl -o "/tmp/realtekALC.kext.zip" $gDownloadLink else
unzip -qu "/tmp/realtekALC.kext.zip" -d "/tmp/" gDownloadLink="https://raw.githubusercontent.com/toleda/audio_alc_test/master/realtekALC.kext.zip"
fi fi
sudo curl -o "/tmp/realtekALC.kext.zip" $gDownloadLink
unzip -qu "/tmp/realtekALC.kext.zip" -d "/tmp/"
# install realtekALC.kext # install realtekALC.kext
if [ $gBetaALC <> 0 ]; then
gMB=0
fi
case $gDebug in case $gDebug in
0 ) 0 )
if [ -d "$gCloverDirectory/$gSysFolder/realtekALC.kext" ]; then
sudo rm -R "$gCloverDirectory/$gSysFolder/realtekALC.kext"
# echo "$gCloverDirectory/$gSysFolder/realtekALC.kext deleted"
fi
if [ -d "$gCloverDirectory/Other/realtekALC.kext" ]; then
sudo rm -R "$gCloverDirectory/Other/realtekALC.kext"
# echo "$gCloverDirectory/Other/realtekALC.kext deleted"
fi
if [ -d "$gLibraryDirectory/realtekALC.kext" ]; then
sudo rm -R "$gLibraryDirectory/realtekALC.kext"
# echo "$gLibraryDirectory/realtekALC.kext deleted"
fi
case $gMB in case $gMB in
0 ) 0 )
# to EFI/CLOVER/kexts/ (cloverALC) # to EFI/CLOVER/kexts/ (cloverALC)
if [ -d "$gCloverDirectory/$gSysFolder/realtekALC.kext" ]; then
sudo rm -R "$gCloverDirectory/$gSysFolder/realtekALC.kext"
# echo "$gCloverDirectory/$gSysFolder/realtekALC.kext deleted"
fi
sudo cp -R "/tmp/realtekALC.kext" "$gCloverDirectory/$gSysFolder/" sudo cp -R "/tmp/realtekALC.kext" "$gCloverDirectory/$gSysFolder/"
echo "Install $gCloverDirectory/$gSysFolder/realtekALC.kext" echo "Install $gCloverDirectory/$gSysFolder/realtekALC.kext"
if [ -d "$gLibraryDirectory/realtekALC.kext" ]; then
sudo rm -R "$gLibraryDirectory/realtekALC.kext"
fi
;; ;;
1 ) 1 )
# to Library/Extensions/ (mb) # to Library/Extensions/ (mb)
if [ -d "$gLibraryDirectory/realtekALC.kext" ]; then
sudo rm -R "$gLibraryDirectory/realtekALC.kext"
else
gMB=0
# echo "$gLibraryDirectory/realtekALC.kext deleted"
fi
sudo cp -R "/tmp/realtekALC.kext" "/tmp/$gCodec" sudo cp -R "/tmp/realtekALC.kext" "/tmp/$gCodecName"
echo "Install $gLibraryDirectory/realtekALC.kext" echo "Install $gLibraryDirectory/realtekALC.kext"
;; ;;
esac esac
;; ;;
1|2 ) 1|2 )
sudo cp -R /tmp/realtekALC.kext /tmp/$gCodec sudo cp -R /tmp/realtekALC.kext /tmp/$gCodecName
echo "/tmp/realtekALC.kext copied to /tmp/$gCodec" echo "/tmp/realtekALC.kext copied to /tmp/$gCodecName"
;; ;;
esac esac
@ -1506,36 +1609,50 @@ case $gDebug in
fi fi
echo "Install System/Library/Extensions/AppleHDA.kext/ALC$gCodec zml files" echo "Install System/Library/Extensions/AppleHDA.kext/ALC$gCodec zml files"
sudo install -m 644 -o root -g wheel /tmp/$gCodec/Platforms.xml.zlib $gHDAContentsDirectory/Resources/Platforms.zml.zlib sudo install -m 644 -o root -g wheel /tmp/$gCodecName/Platforms.xml.zlib $gHDAContentsDirectory/Resources/Platforms.zml.zlib
sudo install -m 644 -o root -g wheel /tmp/$gCodec/layout1.xml.zlib $gHDAContentsDirectory/Resources/layout1.zml.zlib sudo install -m 644 -o root -g wheel /tmp/$gCodecName/layout1.xml.zlib $gHDAContentsDirectory/Resources/layout1.zml.zlib
case $gCodec in case $gCodec in
887|888|889|892|898|1150 ) 887|888|889|892|898 )
sudo install -m 644 -o root -g wheel /tmp/$gCodec/layout2.xml.zlib $gHDAContentsDirectory/Resources/layout2.zml.zlib sudo install -m 644 -o root -g wheel /tmp/$gCodecName/layout2.xml.zlib $gHDAContentsDirectory/Resources/layout2.zml.zlib
sudo install -m 644 -o root -g wheel /tmp/$gCodec/layout3.xml.zlib $gHDAContentsDirectory/Resources/layout3.zml.zlib sudo install -m 644 -o root -g wheel /tmp/$gCodecName/layout3.xml.zlib $gHDAContentsDirectory/Resources/layout3.zml.zlib
;;
# 1150 )
# sudo install -m 644 -o root -g wheel /tmp/$gCodec/layout2.xml.zlib $gHDAContentsDirectory/Resources/layout2.zml.zlib
# ;;
esac
;; ;;
# 1150|1220|1220S|891 )
1150|1220A|1220|891 )
sudo install -m 644 -o root -g wheel /tmp/$gCodecName/layout2.xml.zlib $gHDAContentsDirectory/Resources/layout2.zml.zlib
;;
esac
;;
1|2 ) 1|2 )
if [ -d $gDesktopDirectory$gCodec-${gDebugMode[$gDebug]} ]; then if [ -d $gDesktopDirectory/$gCodec-${gDebugMode[$gDebug]} ]; then
sudo rm -R $gDesktopDirectory$gCodec-${gDebugMode[$gDebug]} sudo rm -R $gDesktopDirectory/$gCodec-${gDebugMode[$gDebug]}
fi fi
sudo cp -R /tmp/$gCodec $gDesktopDirectory$gCodec-${gDebugMode[$gDebug]}
sudo rm -R "$gDesktopDirectory$gCodec-${gDebugMode[$gDebug]}"/Info-*.plist if [ -f /tmp/$gCodecName/hdacd.plist ]; then
sudo rm -f /tmp/$gCodecName/hdacd.plist
fi
for file in /tmp/$gCodecName/Info-*.plist; do
sudo rm -f /tmp/$gCodecName/Info-*.plist
done
for file in /tmp/$gCodecName/*.xml.zlib; do
sudo mv $file ${file%.xml.zlib}.zml.zlib
done
sudo cp -R /tmp/$gCodecName $gDesktopDirectory/$gCodec-${gDebugMode[$gDebug]}
echo "$gCodec-${gDebugMode[$gDebug]} copied to Desktop" echo "$gCodec-${gDebugMode[$gDebug]} copied to Desktop"
echo "No system files were changed" echo "No system files were changed"
;; ;;
esac esac
# remove temp files # remove temp files
sudo rm -R /tmp/ALC$gCodec.zip sudo rm -R /tmp/ALC$gCodec.zip
sudo rm -R /tmp/$gCodec sudo rm -R /tmp/$gCodecName
# exit if error # exit if error
if [ "$?" != "0" ]; then if [ "$?" != "0" ]; then