-
Notifications
You must be signed in to change notification settings - Fork 471
/
makefile.sh
executable file
·1344 lines (1237 loc) · 47.8 KB
/
makefile.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
#set -x # for DEBUGGING
# Created by stevezhengshiqi on 17 April, 2020
#
# Build XiaoMi-Pro EFI release
#
# Reference:
# https://github.com/williambj1/Hackintosh-EFI-Asus-Zephyrus-S-GX531/blob/master/Makefile.sh (Archived) by @williambj1
# Vars
ACDT="Acidanthera"
FRWF="0xFireWolf"
OIW="OpenIntelWireless"
REPO_NAME="XiaoMi-Pro-Hackintosh"
REPO_BRANCH="main"
REPO_NAME_BRANCH="${REPO_NAME}-${REPO_BRANCH}"
RETRY_MAX=5
# Release Message
RLMSG="**EFI upgrade instructions are given [here](https://github.com/daliansky/XiaoMi-Pro-Hackintosh#upgrade).<br />If System Settings does not show OEM updates, go to App Store and search Sequoia (or newer macOS).<br />If OEM update fails, make sure SecureBootModel is Disabled and/or reset NVRAM and perform the update.**"
bl_input=""
bl_list=( )
build_mode="Release"
clean_up=true
download_mode="RELEASE"
err_no_exit=false
fail_flag=false
gh_api=false
language="en_US"
model_input=""
model_list=( )
no_xcode=false
pre_release=""
publish_efi=false
remote=true
version="local"
# Env
if [ "$(which xcodebuild)" = "" ] || [ "$(which git)" = "" ]; then
no_xcode=true
elif [[ "${DEVELOPER_DIR}" = "" ]]; then
DEVELOPER_DIR="/Applications/Xcode.app/Contents/Developer"
xcodebuild -version && echo
else
xcodebuild -version && echo
fi
# Language detect
language=$(locale | grep LANG | sed s/'LANG='// | tr -d '"' | cut -d "." -f 1)
if [[ ${language} != "zh_CN" ]]; then
language="en_US"
fi
# Detect GitHub Action Tag
if [[ "${GITHUB_REF}" = refs/tags/* ]]; then
publish_efi=true
fi
# Args
while [[ $# -gt 0 ]]; do
key="$1"
case "${key}" in
--DEBUG_KEXTOC)
build_mode="Debug"
download_mode="DEBUG"
shift # past argument
;;
--IGNORE_ERR)
err_no_exit=true
shift # past argument
;;
--LANG=zh_CN)
language="zh_CN"
shift # past argument
;;
--NO_CLEAN_UP)
clean_up=false
shift # past argument
;;
--GH_API)
gh_api=true
shift # past argument
;;
*)
if [[ "${key}" =~ "--VERSION=" ]]; then
version="${key##*=}"
shift
elif [[ "${key}" =~ "--PRE_RELEASE=" ]]; then
pre_release+="${key##*=}"
shift
elif [[ "${key}" =~ "--MODEL=" ]]; then
model_input+="${key##*=}"
shift
elif [[ "${key}" =~ "--BL=" ]]; then
bl_input+="${key##*=}"
shift
else
shift
fi
;;
esac
done
if [[ "${model_input}" =~ "CML" ]]; then
model_list+=( "CML" )
fi
if [[ "${model_input}" =~ "KBL" ]]; then
model_list+=( "KBL" )
fi
if [[ "${bl_input}" =~ "CLOVER" ]]; then
bl_list+=( "CLOVER" )
fi
if [[ "${bl_input}" =~ "OC" ]]; then
bl_list+=( "OC" )
fi
# Assign KBL when no MODEL is entered
if [[ ${#model_list[@]} -eq 0 ]]; then
model_input="KBL"
model_list=( "KBL" )
fi
# Assign OC when no bootloader is entered
if [[ ${#bl_list[@]} -eq 0 ]]; then
bl_input="OC"
bl_list=( "OC" )
fi
# Colors
if [[ -z ${GITHUB_ACTIONS+x} ]]; then
black=$(tput setaf 0)
red=$(tput setaf 1)
green=$(tput setaf 2)
yellow=$(tput setaf 3)
blue=$(tput setaf 4)
magenta=$(tput setaf 5)
cyan=$(tput setaf 6)
white=$(tput setaf 7)
reset=$(tput sgr0)
bold=$(tput bold)
fi
# WorkSpaceDir
WSDir="$( cd "$(dirname "$0")" || exit 1; pwd -P )/build"
OUTDir_KBL_CLOVER="XiaoMi_Pro-KBL-Clover-${version}"
OUTDir_KBL_OC="XiaoMi_Pro-KBL-OC-${version}"
OUTDir_CML_CLOVER="XiaoMi_Pro-CML-Clover-${version}"
OUTDir_CML_OC="XiaoMi_Pro-CML-OC-${version}"
# Kexts
# Lilu is not in the list because of bKext()
acdtKexts=(
VirtualSMC
WhateverGreen
AppleALC
HibernationFixup
RestrictEvents
VoodooPS2
BrcmPatchRAM
)
frwfKexts=(
RealtekCardReader
RealtekCardReaderFriend
)
oiwKexts=(
IntelBluetoothFirmware
itlwm
)
# Clean Up
function cleanUp() {
if [[ ${clean_up} == true ]]; then
rm -rf "${WSDir}"
fi
}
# Exit on Network Issue
function networkErr() {
echo "${yellow}[${reset}${red}${bold} ERROR ${reset}${yellow}]${reset}: Failed to download resources from $1, please check your connection!"
if [[ "$2" == "skip" ]]; then
echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: Skip $1!"
fail_flag=true
elif [[ ${err_no_exit} == false ]]; then
cleanUp
exit 1
fi
echo
}
# Exit on Copy Issue
function copyErr() {
echo "${yellow}[${reset}${red}${bold} ERROR ${reset}${yellow}]${reset}: Failed to copy resources!"
if [[ ${err_no_exit} == false ]]; then
cleanUp
exit 1
fi
echo
}
# Exit on Build Issue
function buildErr() {
echo "${yellow}[${reset}${red}${bold} ERROR ${reset}${yellow}]${reset}: Failed to build $1!"
if [[ ${err_no_exit} == false ]]; then
cleanUp
exit 1
fi
echo
}
function init() {
local dirs=(
"Big Sur"
"Catalina"
"Monterey"
"Sonoma"
"Sonoma14.0"
"Sonoma14.4"
"Ventura"
)
if [[ ${OSTYPE} != darwin* ]]; then
echo "ERROR: This script can only run in macOS, aborting"
exit 1
fi
if [[ -d "${WSDir}" ]]; then
rm -rf "${WSDir}"
fi
mkdir "${WSDir}" || exit 1
cd "${WSDir}" || exit 1
if [[ "${bl_input}" =~ "CLOVER" ]]; then
dirs+=( "Clover" )
fi
if [[ "${bl_input}" =~ "OC" ]]; then
dirs+=( "OpenCore" )
fi
for model in "${model_list[@]}"; do
for bl in "${bl_list[@]}"; do
OUTDir_MODEL_BL="OUTDir_${model}_${bl}"
dirs+=( "${!OUTDir_MODEL_BL}" )
done
dirs+=( "${model}" )
done
for dir in "${dirs[@]}"; do
mkdir -p "${dir}" || exit 1
done
if [[ "$(dirname "$PWD")" =~ ${REPO_NAME} ]]; then
remote=false
else
mkdir -p "${REPO_NAME_BRANCH}" || exit 1
fi
}
# Workaround for Release Binaries that don't include "RELEASE" in their file names (head or grep)
function h_or_g() {
if [[ "$1" == "VoodooI2C" ]]; then
hgs=( "head -n 1" )
elif [[ "$1" == "CloverBootloader" ]]; then
hgs=( "grep -m 1 CloverV2" )
elif [[ "$1" == "build-repo" ]]; then
hgs=( "grep -A 2 OpenCorePkg | grep -m 1 ${download_mode}" )
elif [[ "$1" == "EAPD-Codec-Commander" ]]; then
hgs=( "grep -m 2 CodecCommander | grep -m 1 ${download_mode}" )
elif [[ "$1" == "IntelBluetoothFirmware" ]]; then
hgs=( "grep -m 1 IntelBluetooth" )
elif [[ "$1" == "itlwm" ]]; then
hgs=( "grep -m 1 BigSur"
"grep -m 1 Catalina"
"grep -m 1 Monterey"
"grep -m 1 Sonoma14.0"
"grep -m 1 Sonoma14.4"
"grep -m 1 Ventura"
)
elif [[ "$1" == "NoTouchID" ]]; then
hgs=( "grep -m 1 RELEASE" )
else
hgs=( "grep -m 1 ${download_mode}" )
fi
}
# Download GitHub Release
function dGR() {
local rawURL
local urls=( )
h_or_g "$2"
if [[ -n ${3+x} ]]; then
if [[ "$3" == "PreRelease" ]]; then
# FIXME: New GitHub lazy load makes it hard to extract pre-release, and I have not figured it out
tag=""
elif [[ "$3" == "NULL" ]]; then
tag="/latest"
else
tag="/$3"
fi
else
tag="/latest"
fi
if [[ -n ${GITHUB_ACTIONS+x} || ${gh_api} == false ]]; then
if [[ "$2" == "build-repo" ]]; then
rawURL="https://github.com/$1/$2/tags"
rawURL="https://github.com$(curl -L --silent "${rawURL}" | grep -m 1 'OpenCorePkg' | sed -e 's/.*<a\ href="//' | cut -d "\"" -f1)"
else
rawURL="https://github.com/$1/$2/releases$tag"
fi
for hg in "${hgs[@]}"; do
rawURL=$(curl -Ls -o /dev/null -w "%{url_effective}" "${rawURL}" | sed 's/releases\/tag/releases\/expanded_assets/')
urls+=( "https://github.com$(curl -L --silent "${rawURL}" | grep '/download/' | eval "${hg}" | sed 's/^[^"]*"\([^"]*\)".*/\1/')" )
done
else
if [[ "$2" == "build-repo" ]]; then
rawURL="https://api.github.com/repos/$1/$2/releases"
else
rawURL="https://api.github.com/repos/$1/$2/releases$tag"
fi
for hg in "${hgs[@]}"; do
if [[ "$2" == "build-repo" ]]; then
urls+=( "$(curl --silent "${rawURL}" | grep -A 100 'OpenCorePkg' | grep 'browser_download_url' | eval "${hg}" | tr -d '"' | tr -d ' ' | sed -e 's/browser_download_url://')" )
else
urls+=( "$(curl --silent "${rawURL}" | grep 'browser_download_url' | eval "${hg}" | tr -d '"' | tr -d ' ' | sed -e 's/browser_download_url://')" )
fi
done
fi
for url in "${urls[@]}"; do
if [[ -z ${url} || ${url} == "https://github.com" ]]; then
networkErr "$2" "$5"
fi
echo "${green}[${reset}${blue}${bold} Downloading ${url##*\/} ${reset}${green}]${reset}"
echo "${cyan}"
cd ./"$4" || exit 1
curl -# -L -O "${url}" || networkErr "$2" "$5"
cd - > /dev/null 2>&1 || exit 1
echo "${reset}"
if [[ ${fail_flag} == true ]]; then
fail_flag=false
return 1
fi
done
}
# Download GitHub Source Code
function dGS() {
local url="https://github.com/$1/$2/archive/$3.zip"
echo "${green}[${reset}${blue}${bold} Downloading $2.zip ${reset}${green}]${reset}"
echo "${cyan}"
cd ./"$4" || exit 1
curl -# -L -o "$2.zip" "${url}"|| networkErr "$2"
cd - > /dev/null 2>&1 || exit 1
echo "${reset}"
}
# Download Bitbucket Release
function dBR() {
local count=0
local rawURL="https://api.bitbucket.org/2.0/repositories/$1/$2/downloads/"
local url
while [ ${count} -lt ${RETRY_MAX} ];
do
url="$(curl --silent "${rawURL}" | json_pp | grep 'href' | head -n 1 | tr -d '"' | tr -d ' ' | sed -e 's/href://')"
if [ "${url:(-4)}" == ".zip" ]; then
echo "${green}[${reset}${blue}${bold} Downloading ${url##*\/} ${reset}${green}]${reset}"
echo "${cyan}"
cd ./"$3" || exit 1
curl -# -L -O "${url}" || networkErr "$2"
cd - > /dev/null 2>&1 || exit 1
echo "${reset}"
return
else
count=$((count+1))
echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: Failed to download $2, ${count} Attempt!"
echo
fi
done
if [ ${count} -ge ${RETRY_MAX} ]; then
# if ${RETRY_MAX} times are over and still fail to download, exit
networkErr "$2"
fi
}
# Download GitHub Binaries
function dPB() {
local url="https://raw.githubusercontent.com/$1/$2/master/$3"
echo "${green}[${reset}${blue}${bold} Downloading ${3##*\/} ${reset}${green}]${reset}"
echo "${cyan}"
cd ./"$4" || exit 1
curl -# -L -O "${url}" || networkErr "${3##*\/}"
cd - > /dev/null 2>&1 || exit 1
echo "${reset}"
}
# Build Pre-release Kexts
function bKextHelper() {
local liluPlugins
local voodooinputPlugins="VoodooI2C VoodooPS2"
local PATH_LONG_BIG="Build/Products/$3/"
local PATH_LONG_SMA="build/Products/$3/"
local PATH_SHORT_SMA="build/$3/"
local PATH_ITLWM="Build/Products/Debug/"
local PATH_VI2C="Build/Products/Release/"
local lineNum
if [[ "${model_input}" =~ "CML" ]]; then
liluPlugins="AppleALC BrcmPatchRAM HibernationFixup RealtekCardReaderFriend VirtualSMC WhateverGreen RestrictEvents NoTouchID"
elif [[ "${model_input}" =~ "KBL" ]]; then
liluPlugins="AppleALC BrcmPatchRAM HibernationFixup RealtekCardReaderFriend VirtualSMC WhateverGreen RestrictEvents"
fi
echo "${green}[${reset}${blue}${bold} Building $2 ${reset}${green}]${reset}"
git clone --depth=1 -q https://github.com/"$1"/"$2".git || networkErr "$2"
cd "$2" || exit 1
if [[ ${liluPlugins} =~ $2 ]]; then
cp -R "../MacKernelSDK" "./" || copyErr
cp -R "../Lilu.kext" "./" || copyErr
if [[ "$2" == "VirtualSMC" ]]; then
xcodebuild -jobs 1 -target Package -configuration "$3" -arch x86_64 > /dev/null 2>&1 || buildErr "$2"
mkdir ../Kexts
cp -R "${PATH_SHORT_SMA}"*.kext "../Kexts/" || copyErr
elif [[ "$2" == "AppleALC" ]]; then
mkdir -p "tmp" || exit 1
cp -R "Resources/ALC256" "tmp" || copyErr
(cd "tmp/ALC256" && find . -maxdepth 1 ! -path "./Info.plist" ! -path "./layout69.xml" ! -path "./Platforms69.xml" -exec rm -rf {} + > /dev/null 2>&1 || exit 1)
cp -R "Resources/ALC298" "tmp" || copyErr
(cd "tmp/ALC298" && find . -maxdepth 1 ! -path "./Info.plist" ! -path "./layout30.xml" ! -path "./Platforms30.xml" ! -path "./layout99.xml" ! -path "./Platforms99.xml" -exec rm -rf {} + > /dev/null 2>&1 || exit 1)
if [[ "${model_input}" =~ "CML" ]]; then
# Delete unrelated layout resources in AppleALC
(cd "Resources" && find . -type d -maxdepth 1 ! -path "./PinConfigs.kext" -exec rm -rf {} + > /dev/null 2>&1 || exit 1)
cp -R "tmp/ALC256" "Resources" || copyErr
xcodebuild -jobs 1 -configuration "$3" -arch x86_64 > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_SHORT_SMA}"*.kext "../CML" || copyErr
xcodebuild clean > /dev/null 2>&1 || buildErr "$2"
fi
if [[ "${model_input}" =~ "KBL" ]]; then
# Delete unrelated layout resources in AppleALC
(cd "Resources" && find . -type d -maxdepth 1 ! -path "./PinConfigs.kext" -exec rm -rf {} + > /dev/null 2>&1 || exit 1)
cp -R "tmp/ALC298" "Resources" || copyErr
xcodebuild -jobs 1 -configuration "$3" -arch x86_64 > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_SHORT_SMA}"*.kext "../KBL" || copyErr
fi
elif [[ "$2" == "NoTouchID" ]]; then
xcodebuild -jobs 1 -configuration "$3" -arch x86_64 CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_SHORT_SMA}"*.kext "../CML" || copyErr
elif [[ "$2" == "BrcmPatchRAM" ]]; then
xcodebuild -jobs 1 -target Package -configuration "$3" > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_LONG_SMA}"*.kext "../" || copyErr
else
xcodebuild -jobs 1 -configuration "$3" > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_SHORT_SMA}"*.kext "../" || copyErr
fi
elif [[ ${voodooinputPlugins} =~ $2 ]]; then
cp -R "../MacKernelSDK" "./" || copyErr
if [[ "$2" == "VoodooI2C" ]]; then
cp -R "../VoodooInput" "./Dependencies/" || copyErr
git submodule init -q && git submodule update -q || networkErr "VoodooI2C Satellites"
xcodebuild -workspace "VoodooI2C.xcworkspace" -scheme "VoodooI2C" -derivedDataPath . build -jobs 1 -configuration "$3" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO > /dev/null 2>&1 || buildErr "$2"
cp -R ${PATH_VI2C}*.kext "../" || copyErr
else
cp -R "../VoodooInput" "./" || copyErr
xcodebuild -jobs 1 -configuration "$3" > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_LONG_SMA}"*.kext "../" || copyErr
fi
elif [[ "$2" == "Lilu" ]]; then
rm -rf ../Lilu.kext
cp -R "../MacKernelSDK" "./" || copyErr
xcodebuild -jobs 1 -configuration "$3" -arch x86_64 > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_SHORT_SMA}"*.kext "../" || copyErr
elif [[ "$2" == "VoodooInput" ]]; then
cp -R "../MacKernelSDK" "./" || copyErr
xcodebuild -jobs 1 -configuration Debug > /dev/null 2>&1 || buildErr "$2"
xcodebuild -jobs 1 -configuration Release > /dev/null 2>&1 || buildErr "$2"
mkdir -p "../VoodooInput_build/Debug" && mkdir "../VoodooInput_build/Release"
cp -R "build/Debug/VoodooInput.kext" "../VoodooInput_build/Debug/" && cp -R "build/Release/VoodooInput.kext" "../VoodooInput_build/Release/" || copyErr
elif [[ "$2" == "EAPD-Codec-Commander" ]]; then
cp -R "../MacKernelSDK" "./" || copyErr
xcodebuild -scheme CodecCommander -derivedDataPath . -configuration "$3" > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_LONG_BIG}"*.kext "../KBL" || copyErr
elif [[ "$2" == "IntelBluetoothFirmware" ]]; then
cp -R "../MacKernelSDK" "./" || copyErr
# IntelBTPatcher needs Lilu as dependency
cp -R "../Lilu.kext" "./" || copyErr
mkdir -p "tmp" || exit 1
cp -R IntelBluetoothFirmware/fw/ibt-12* "tmp" || copyErr
cp -R IntelBluetoothFirmware/fw/ibt-19-0* "tmp" || copyErr
if [[ "${model_input}" =~ "CML" ]]; then
# Delete unrelated firmware and only keep ibt-19-0*.sfi for Intel Wireless 9462
rm -rf "IntelBluetoothFirmware/FwBinary.cpp" || exit 1
rm -rf IntelBluetoothFirmware/fw/* || exit 1
cp -R tmp/ibt-19-0* "IntelBluetoothFirmware/fw/" || copyErr
xcodebuild -alltargets -configuration "$3" > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_SHORT_SMA}"*.kext "../CML" || copyErr
xcodebuild -alltargets clean > /dev/null 2>&1 || buildErr "$2"
fi
if [[ "${model_input}" =~ "KBL" ]]; then
# Delete unrelated firmware and only keep ibt-12*.sfi for Intel Wireless 8265
rm -rf "IntelBluetoothFirmware/FwBinary.cpp" || exit 1
rm -rf IntelBluetoothFirmware/fw/* || exit 1
cp -R tmp/ibt-12* "IntelBluetoothFirmware/fw/" || copyErr
xcodebuild -alltargets -configuration "$3" > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_SHORT_SMA}"*.kext "../KBL" || copyErr
fi
elif [[ "$2" == "itlwm" ]]; then
cp -R "../MacKernelSDK" "./" || copyErr
mkdir -p "tmp" || exit 1
cp -R itlwm/firmware/iwlwifi-QuZ* "tmp" || copyErr
cp -R itlwm/firmware/iwm-8265* "tmp" || copyErr
if [[ "${model_input}" =~ "CML" ]]; then
# Delete unrelated firmware and only keep iwlwifi-QuZ* for Intel Wireless 9462
rm -rf "include/FwBinary.cpp" || exit 1
rm -rf itlwm/firmware/* || exit 1
cp -R tmp/iwlwifi-QuZ* "itlwm/firmware/" || copyErr
xcodebuild -scheme "AirportItlwm (all)" -configuration Debug -derivedDataPath . > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_ITLWM}"* "../CML" || copyErr
xcodebuild -scheme "AirportItlwm (all)" clean > /dev/null 2>&1 || buildErr "$2"
fi
if [[ "${model_input}" =~ "KBL" ]]; then
# Delete unrelated firmware and only keep iwm-8265* for Intel Wireless 8265
rm -rf "include/FwBinary.cpp" || exit 1
rm -rf itlwm/firmware/* || exit 1
cp -R tmp/iwm-8265* "itlwm/firmware/" || copyErr
xcodebuild -scheme "AirportItlwm (all)" -configuration Debug -derivedDataPath . > /dev/null 2>&1 || buildErr "$2"
cp -R "${PATH_ITLWM}"* "../KBL" || copyErr
xcodebuild -scheme "AirportItlwm (all)" clean > /dev/null 2>&1 || buildErr "$2"
fi
fi
cd ../ || exit 1
echo
}
function bKext() {
if [[ "${publish_efi}" = true ]]; then
# Force to call install_compiled_sdk in Lilu's bootstrap.sh
local GITHUB_REF=""
fi
if [[ ${no_xcode} == true ]]; then
echo "${yellow}[${reset}${red}${bold} ERROR ${reset}${yellow}]${reset}: Missing Xcode tools, won't build kexts!"
exit 1
fi
git clone -q https://github.com/acidanthera/MacKernelSDK || networkErr "MacKernelSDK"
src=$(/usr/bin/curl -LfsS https://raw.githubusercontent.com/acidanthera/Lilu/master/Lilu/Scripts/bootstrap.sh) && eval "$src" > /dev/null 2>&1 || networkErr "Lilu"
src=$(/usr/bin/curl -LfsS https://raw.githubusercontent.com/acidanthera/VoodooInput/master/VoodooInput/Scripts/bootstrap.sh) && eval "$src" > /dev/null 2>&1 || networkErr "VoodooInput"
if [[ ${model_input} =~ "CML" ]]; then
bKextHelper al3xtjames NoTouchID "${build_mode}"
fi
if [[ ${model_input} =~ "KBL" ]]; then
bKextHelper Sniki EAPD-Codec-Commander "${build_mode}"
fi
# for frwfKext in "${frwfKexts[@]}"; do
# bKextHelper ${FRWF} "${frwfKext}" "${build_mode}"
# done
for acdtKext in "${acdtKexts[@]}"; do
bKextHelper ${ACDT} "${acdtKext}" "${build_mode}"
done
for oiwKext in "${oiwKexts[@]}"; do
bKextHelper ${OIW} "${oiwKext}" "${build_mode}"
done
# FIXME: Ref: https://github.com/daliansky/XiaoMi-Pro-Hackintosh/issues/732
bKextHelper VoodooI2C VoodooI2C
# dGR VoodooI2C VoodooI2C
# Make sure Lilu is later than Lilu based kexts
bKextHelper ${ACDT} "Lilu" "${build_mode}"
echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: Please clean Xcode cache in ~/Library/Developer/Xcode/DerivedData!"
echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: Some kexts only work on current macOS SDK build!"
echo
}
function download() {
# Clover
if [[ "${bl_input}" =~ "CLOVER" ]]; then
dGR CloverHackyColor CloverBootloader NULL "Clover"
fi
# OpenCore
if [[ "${bl_input}" =~ "OC" ]]; then
if [[ "${pre_release}" =~ "OC" ]]; then
dGR dortania build-repo NULL "OpenCore" "skip" || dGR ${ACDT} OpenCorePkg NULL "OpenCore"
else
dGR ${ACDT} OpenCorePkg NULL "OpenCore"
fi
fi
# Kexts
dBR Rehabman os-x-null-ethernet
if [[ "${pre_release}" =~ "Kext" ]]; then
bKext
else
for acdtKext in "${acdtKexts[@]}"; do
dGR ${ACDT} "${acdtKext}"
done
dGR ${ACDT} "Lilu"
# for frwfKext in "${frwfKexts[@]}"; do
# dGR ${FRWF} "${frwfKext}"
# done
for oiwKext in "${oiwKexts[@]}"; do
dGR ${OIW} "${oiwKext}"
done
if [[ "${model_input}" =~ "CML" ]]; then
dGR al3xtjames NoTouchID NULL "CML"
fi
if [[ "${model_input}" =~ "KBL" ]]; then
dGR Sniki EAPD-Codec-Commander NULL "KBL"
fi
dGR VoodooI2C VoodooI2C
fi
# UEFI
if [[ "${bl_input}" =~ "CLOVER" ]]; then
dPB ${ACDT} VirtualSMC EfiDriver/VirtualSmc.efi
fi
# ExFatDxe.efi & HfsPlus.efi & OC Resources
if [[ "${bl_input}" =~ "OC" ]]; then
dGS ${ACDT} OcBinaryData master
elif [[ "${bl_input}" =~ "CLOVER" ]]; then
mkdir -p "OcBinaryData-master/Drivers" || exit 1
dPB ${ACDT} OcBinaryData Drivers/ExFatDxe.efi "OcBinaryData-master/Drivers"
dPB ${ACDT} OcBinaryData Drivers/HfsPlus.efi "OcBinaryData-master/Drivers"
fi
# XiaoMi-Pro ACPI patch
if [[ ${remote} == true ]]; then
dGS daliansky ${REPO_NAME} ${REPO_BRANCH}
fi
# Menchen's ALCPlugFix
if [[ "${model_input}" =~ "KBL" ]] && [[ ${remote} == true ]]; then
dGS Menchen ALCPlugFix master
fi
}
# Unpack
function unpack() {
echo "${green}[${reset}${yellow}${bold} Unpacking ${reset}${green}]${reset}"
# Unzip non-standard AirportItlwm release packages
if [[ "${pre_release}" != *Kext* ]]; then
unzip -qq -d "Big Sur" "*BigSur*.zip" || echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: AirportItlwm has non-standard packages location!"
unzip -qq -d "Catalina" "*Catalina*.zip" || echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: AirportItlwm has non-standard packages location!"
unzip -qq -d "Monterey" "*Monterey*.zip" || echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: AirportItlwm has non-standard packages location!"
unzip -qq -d "Sonoma" "*Sonoma14.0*.zip" || echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: AirportItlwm has non-standard packages location!"
unzip -qq -d "Sonoma" "*Sonoma14.4*.zip" || echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: AirportItlwm has non-standard packages location!"
unzip -qq -d "Ventura" "*Ventura*.zip" || echo "${yellow}[${bold} WARNING ${reset}${yellow}]${reset}: AirportItlwm has non-standard packages location!"
fi
ditto -x -k ./*.zip . || exit 1
if [[ "${model_input}" =~ "CML" ]] && [[ "${pre_release}" != *Kext* ]]; then
(cd "CML" && unzip -qq ./*.zip || exit 1)
fi
if [[ "${model_input}" =~ "KBL" ]] && [[ "${pre_release}" != *Kext* ]]; then
(cd "KBL" && unzip -qq ./*.zip || exit 1)
fi
echo
}
# Patch
function patch() {
local unusedItems=(
"BlueToolFixup.kext/Contents/_CodeSignature"
"HibernationFixup.kext/Contents/_CodeSignature"
"Kexts/SMCBatteryManager.kext/Contents/Resources"
"KBL/CodecCommander.kext/Contents/Resources"
# "RealtekCardReader.kext/Contents/_CodeSignature"
# "RealtekCardReader.kext/Contents/Resources"
# "RealtekCardReaderFriend.kext/Contents/_CodeSignature"
# "RealtekCardReaderFriend.kext/Contents/Resources"
"RestrictEvents.kext/Contents/_CodeSignature"
"VoodooI2C.kext/Contents/PlugIns/VoodooInput.kext.dSYM"
"VoodooI2C.kext/Contents/PlugIns/VoodooInput.kext/Contents/_CodeSignature"
"VoodooPS2Controller.kext/Contents/PlugIns/VoodooInput.kext"
"VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Mouse.kext"
"VoodooPS2Controller.kext/Contents/PlugIns/VoodooPS2Trackpad.kext"
"WhateverGreen.kext/Contents/_CodeSignature"
)
echo "${green}[${reset}${blue}${bold} Patching Resources ${reset}${green}]${reset}"
for unusedItem in "${unusedItems[@]}"; do
rm -rf "${unusedItem}" > /dev/null 2>&1
done
# Only keep OCEFIAudio_VoiceOver_Boot in OcBinaryData/Resources/Audio
if [[ "${bl_input}" =~ "OC" ]]; then
(cd "OcBinaryData-master/Resources/Audio/" && find . -maxdepth 1 -not -name "OCEFIAudio_VoiceOver_Boot*" -delete || exit 1)
fi
# Rename AirportItlwm.kexts to distinguish different versions
if [[ "${pre_release}" =~ "Kext" ]]; then
for model in "${model_list[@]}"; do
mv "${model}/Big Sur/AirportItlwm.kext" "${model}/Big Sur/AirportItlwm_Big_Sur.kext" || exit 1
mv "${model}/Catalina/AirportItlwm.kext" "${model}/Catalina/AirportItlwm_Catalina.kext" || exit 1
mv "${model}/Monterey/AirportItlwm.kext" "${model}/Monterey/AirportItlwm_Monterey.kext" || exit 1
mv "${model}/Sonoma14.0/AirportItlwm.kext" "${model}/Sonoma14.0/AirportItlwm_Sonoma140.kext" || exit 1
mv "${model}/Sonoma14.4/AirportItlwm.kext" "${model}/Sonoma14.4/AirportItlwm_Sonoma144.kext" || exit 1
mv "${model}/Ventura/AirportItlwm.kext" "${model}/Ventura/AirportItlwm_Ventura.kext" || exit 1
done
else
mv "Big Sur/AirportItlwm.kext" "Big Sur/AirportItlwm_Big_Sur.kext" || exit 1
mv "Catalina/AirportItlwm.kext" "Catalina/AirportItlwm_Catalina.kext" || exit 1
mv "Monterey/AirportItlwm.kext" "Monterey/AirportItlwm_Monterey.kext" || exit 1
mv "Sonoma14.0/AirportItlwm.kext" "Sonoma14.0/AirportItlwm_Sonoma140.kext" || exit 1
mv "Sonoma14.4/AirportItlwm.kext" "Sonoma14.4/AirportItlwm_Sonoma144.kext" || exit 1
mv "Ventura/AirportItlwm.kext" "Ventura/AirportItlwm_Ventura.kext" || exit 1
fi
echo
}
# Install
function install() {
# Kexts
local sharedKextItems=(
"HibernationFixup.kext"
"Kexts/SMCBatteryManager.kext"
"Kexts/SMCLightSensor.kext"
"Kexts/SMCProcessor.kext"
"Kexts/VirtualSMC.kext"
"Lilu.kext"
# "RealtekCardReader.kext"
# "RealtekCardReaderFriend.kext"
"Release/NullEthernet.kext"
"RestrictEvents.kext"
"VoodooI2C.kext"
"VoodooI2CHID.kext"
"VoodooPS2Controller.kext"
"WhateverGreen.kext"
)
if [[ "${model_input}" =~ "CML" ]]; then
local cmlKextItems=(
"AppleALC.kext"
"IntelBluetoothFirmware.kext"
"IntelBTPatcher.kext"
)
if [[ "${pre_release}" =~ "Kext" ]]; then
cmlKextItems=("${cmlKextItems[@]/#/CML/}")
fi
cmlKextItems+=(
"${sharedKextItems[@]}"
)
local cmlWifiKextItems=(
"Big Sur/AirportItlwm_Big_Sur.kext"
"Catalina/AirportItlwm_Catalina.kext"
"Monterey/AirportItlwm_Monterey.kext"
"Sonoma14.0/AirportItlwm_Sonoma140.kext"
"Sonoma14.4/AirportItlwm_Sonoma144.kext"
"Ventura/AirportItlwm_Ventura.kext"
)
if [[ "${pre_release}" =~ "Kext" ]]; then
cmlWifiKextItems=("${cmlWifiKextItems[@]/#/CML/}")
fi
if [[ "${bl_input}" =~ "CLOVER" ]]; then
local cmlCloverKextFolders=(
"10.15"
"11"
"12"
"13"
"14"
)
local cmlCloverIbtInjctrDirs=(
"10.15"
"11"
)
fi
fi
if [[ "${model_input}" =~ "KBL" ]]; then
local kblKextItems=(
"AppleALC.kext"
"IntelBluetoothFirmware.kext"
"IntelBTPatcher.kext"
)
if [[ "${pre_release}" =~ "Kext" ]]; then
kblKextItems=("${kblKextItems[@]/#/KBL/}")
fi
kblKextItems+=(
"${sharedKextItems[@]}"
"KBL/CodecCommander.kext"
)
local kblWifiKextItems=(
"Big Sur/AirportItlwm_Big_Sur.kext"
"Catalina/AirportItlwm_Catalina.kext"
"Monterey/AirportItlwm_Monterey.kext"
"Sonoma14.0/AirportItlwm_Sonoma140.kext"
"Sonoma14.4/AirportItlwm_Sonoma144.kext"
"Ventura/AirportItlwm_Ventura.kext"
)
if [[ "${pre_release}" =~ "Kext" ]]; then
kblWifiKextItems=("${kblWifiKextItems[@]/#/KBL/}")
fi
if [[ "${bl_input}" =~ "CLOVER" ]]; then
local kblCloverKextFolders=(
"10.15"
"11"
"12"
"13"
"14"
)
local kblCloverIbtInjctrDirs=(
"10.15"
"11"
)
fi
fi
echo "${green}[${reset}${blue}${bold} Installing Kexts ${reset}${green}]${reset}"
for model in "${model_list[@]}"; do
model_prefix=$(echo "${model}" | tr '[:upper:]' '[:lower:]')
model_kextItems="${model_prefix}KextItems"
model_wifiKextItems="${model_prefix}WifiKextItems"
kextItems="${model_kextItems}[@]"
for bl in "${bl_list[@]}"; do
OUTDir_MODEL_BL="OUTDir_${model}_${bl}"
if [[ "${bl}" == "CLOVER" ]]; then
kextDir="${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/Other/"
model_cloverKextFolders="${model_prefix}CloverKextFolders"
model_cloverIbtInjctrDirs="${model_prefix}CloverIbtInjctrDirs"
cloverKextFolder="${model_cloverKextFolders}[@]"
for cloverKextFolder in "${!cloverKextFolder}"; do
mkdir -p "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/${cloverKextFolder}" || exit 1
done
elif [[ "${bl}" == "OC" ]]; then
kextDir="${!OUTDir_MODEL_BL}/EFI/OC/Kexts/"
fi
mkdir -p "${kextDir}" || exit 1
for kextItem in "${!kextItems}"; do
cp -R "${kextItem}" "${kextDir}" || copyErr
done
# CML: NoTouchID.kext
if [[ "${model}" == "CML" ]]; then
if [[ "${bl}" == "CLOVER" ]]; then
noTouchIDDir="${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/10.15/"
elif [[ "${bl}" == "OC" ]]; then
noTouchIDDir="${!OUTDir_MODEL_BL}/EFI/OC/Kexts/"
fi
cp -R "CML/NoTouchID.kext" "${noTouchIDDir}" || copyErr
fi
# Move AirportItlwm to corresponding Clover and OC Kext folders
if [[ "${bl}" == "CLOVER" ]]; then
if [[ "${pre_release}" =~ "Kext" ]]; then
cp -R "${model}/Big Sur/AirportItlwm_Big_Sur.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/11/" || copyErr
cp -R "${model}/Catalina/AirportItlwm_Catalina.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/10.15/" || copyErr
cp -R "${model}/Monterey/AirportItlwm_Monterey.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/12/" || copyErr
# cp -R "${model}/Sonoma14.0/AirportItlwm_Sonoma140.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/14/" || copyErr
cp -R "${model}/Sonoma14.4/AirportItlwm_Sonoma144.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/14/" || copyErr
cp -R "${model}/Ventura/AirportItlwm_Ventura.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/13/" || copyErr
else
cp -R "Big Sur/AirportItlwm_Big_Sur.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/11/" || copyErr
cp -R "Catalina/AirportItlwm_Catalina.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/10.15/" || copyErr
cp -R "Monterey/AirportItlwm_Monterey.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/12/" || copyErr
# cp -R "Sonoma14.0/AirportItlwm_Sonoma140.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/14/" || copyErr
cp -R "Sonoma14.4/AirportItlwm_Sonoma144.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/14/" || copyErr
cp -R "Ventura/AirportItlwm_Ventura.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/13/" || copyErr
fi
elif [[ "${bl}" == "OC" ]]; then
kextItems="${model_wifiKextItems}[@]"
for kextItem in "${!kextItems}"; do
cp -R "${kextItem}" "${!OUTDir_MODEL_BL}/EFI/OC/Kexts/" || copyErr
done
fi
# Move IntelBluetoothInjector and BlueToolFixup to corresponding Clover and OC Kext folders
if [[ "${bl}" == "CLOVER" ]]; then
kextDirs="${model_cloverIbtInjctrDirs}[@]"
for kextDir in "${!kextDirs}"; do
if [[ "${pre_release}" =~ "Kext" ]]; then
cp -R "${model}/IntelBluetoothInjector.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/${kextDir}" || copyErr
else
cp -R "IntelBluetoothInjector.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/${kextDir}" || copyErr
fi
done
cp -R "BlueToolFixup.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/12/" || copyErr
cp -R "BlueToolFixup.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/13/" || copyErr
cp -R "BlueToolFixup.kext" "${!OUTDir_MODEL_BL}/EFI/CLOVER/kexts/14/" || copyErr
fi
if [[ "${bl}" == "OC" ]]; then
if [[ "${pre_release}" =~ "Kext" ]]; then
cp -R "${model}/IntelBluetoothInjector.kext" "${!OUTDir_MODEL_BL}/EFI/OC/Kexts/" || copyErr
else
cp -R "IntelBluetoothInjector.kext" "${!OUTDir_MODEL_BL}/EFI/OC/Kexts/" || copyErr
fi
cp -R "BlueToolFixup.kext" "${!OUTDir_MODEL_BL}/EFI/OC/Kexts/" || copyErr
fi
done
done
echo
# Drivers
local driverItems=(
"OcBinaryData-master/Drivers/ExFatDxe.efi"
"OcBinaryData-master/Drivers/HfsPlus.efi"
)
echo "${green}[${reset}${blue}${bold} Installing Drivers ${reset}${green}]${reset}"
for model in "${model_list[@]}"; do
for bl in "${bl_list[@]}"; do
OUTDir_MODEL_BL="OUTDir_${model}_${bl}"
if [[ "${bl}" == "CLOVER" ]]; then
driverDir="${!OUTDir_MODEL_BL}/EFI/CLOVER/drivers/UEFI/"
elif [[ "${bl}" == "OC" ]]; then
driverDir="${!OUTDir_MODEL_BL}/EFI/OC/Drivers/"
fi
mkdir -p "${driverDir}" || exit 1
for driverItem in "${driverItems[@]}"; do
cp "${driverItem}" "${driverDir}" || copyErr
done
if [[ "${bl}" == "CLOVER" ]]; then
cp "VirtualSmc.efi" "${!OUTDir_MODEL_BL}/EFI/CLOVER/drivers/UEFI/" || copyErr
fi
done
done
echo
# ACPI
local sharedAcpiItems=(
"${REPO_NAME_BRANCH}/ACPI/Shared/SSDT-ALS0.aml"
"${REPO_NAME_BRANCH}/ACPI/Shared/SSDT-EC-USBX.aml"
"${REPO_NAME_BRANCH}/ACPI/Shared/SSDT-GPRW.aml"
"${REPO_NAME_BRANCH}/ACPI/Shared/SSDT-HPET.aml"
"${REPO_NAME_BRANCH}/ACPI/Shared/SSDT-MCHC.aml"
"${REPO_NAME_BRANCH}/ACPI/Shared/SSDT-PNLF.aml"
"${REPO_NAME_BRANCH}/ACPI/Shared/SSDT-PS2K.aml"
"${REPO_NAME_BRANCH}/ACPI/Shared/SSDT-RMNE.aml"
)
if [[ "${model_input}" =~ "KBL" ]]; then
local kblAcpiItems=( "${sharedAcpiItems[@]}"
"${REPO_NAME_BRANCH}/ACPI/KBL/SSDT-DDGPU.aml"
"${REPO_NAME_BRANCH}/ACPI/KBL/SSDT-LGPA.aml"
"${REPO_NAME_BRANCH}/ACPI/KBL/SSDT-MEM2.aml"
"${REPO_NAME_BRANCH}/ACPI/KBL/SSDT-PLUG.aml"
"${REPO_NAME_BRANCH}/ACPI/KBL/SSDT-PMCR.aml"
"${REPO_NAME_BRANCH}/ACPI/KBL/SSDT-TPD0.aml"
"${REPO_NAME_BRANCH}/ACPI/KBL/SSDT-USB.aml"
)
if [[ ${remote} == false ]]; then
kblAcpiItems=("${kblAcpiItems[@]/${REPO_NAME_BRANCH}/..}")
fi
fi
if [[ "${model_input}" =~ "CML" ]]; then
local cmlAcpiItems=( "${sharedAcpiItems[@]}"
"${REPO_NAME_BRANCH}/ACPI/CML/SSDT-AWAC-DISABLE.aml"
"${REPO_NAME_BRANCH}/ACPI/CML/SSDT-DDGPU.aml"
"${REPO_NAME_BRANCH}/ACPI/CML/SSDT-LGPA.aml"
"${REPO_NAME_BRANCH}/ACPI/CML/SSDT-PLUG.aml"
"${REPO_NAME_BRANCH}/ACPI/CML/SSDT-PMC.aml"
"${REPO_NAME_BRANCH}/ACPI/CML/SSDT-TPD0.aml"
"${REPO_NAME_BRANCH}/ACPI/CML/SSDT-USB.aml"
)
if [[ ${remote} == false ]]; then
cmlAcpiItems=("${cmlAcpiItems[@]/${REPO_NAME_BRANCH}/..}")
fi
fi
echo "${green}[${reset}${blue}${bold} Installing ACPIs ${reset}${green}]${reset}"
for model in "${model_list[@]}"; do
model_prefix=$(echo "${model}" | tr '[:upper:]' '[:lower:]')
model_acpiItems="${model_prefix}AcpiItems"
acpiItems="${model_acpiItems}[@]"
for bl in "${bl_list[@]}"; do
OUTDir_MODEL_BL="OUTDir_${model}_${bl}"
if [[ "${bl}" == "CLOVER" ]]; then
acpiDir="${!OUTDir_MODEL_BL}/EFI/CLOVER/ACPI/patched/"
elif [[ "${bl}" == "OC" ]]; then
acpiDir="${!OUTDir_MODEL_BL}/EFI/OC/ACPI/"
fi
mkdir -p "${acpiDir}" || exit 1
for acpiItem in "${!acpiItems}"; do
cp "${acpiItem}" "${acpiDir}" || copyErr
done
done
done
echo
# Theme
echo "${green}[${reset}${blue}${bold} Installing Themes ${reset}${green}]${reset}"
for model in "${model_list[@]}"; do
for bl in "${bl_list[@]}"; do
OUTDir_MODEL_BL="OUTDir_${model}_${bl}"
if [[ "${bl}" == "CLOVER" ]]; then
if [[ ${remote} == true ]]; then
cp -R "${REPO_NAME_BRANCH}/CLOVER/themes" "${!OUTDir_MODEL_BL}/EFI/CLOVER/" || copyErr
else