forked from the-braveknight/macos-tools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_lilu_helper.sh
executable file
·65 lines (54 loc) · 2.69 KB
/
_lilu_helper.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
#!/bin/bash
# Original idea from RehabMan
DIR=$(dirname ${BASH_SOURCE[0]})
source $DIR/_plist_utils.sh
output_dir=.
if [[ ! -d "$efi" ]]; then efi=$($tools_dir/mount_efi.sh); fi
kexts_directory=$efi/EFI/CLOVER/kexts/Other
function kextsWithLiluDependency() {
kexts=$(find $kexts_directory -name "*.kext" -not -name "LiluHelper.kext")
for kext in $kexts; do
local kext_plist=$kext/Contents/Info.plist
printValue "OSBundleLibraries:as.vit9696.Lilu" "$kext_plist" > /dev/null
if [[ $? -eq 0 ]]; then
echo $kext
fi
done
}
function createLiluHelper() {
# $1: Output directory
if [[ -d "$1" ]]; then
local output_dir="$1"
fi
rm -Rf $output_dir/LiluHelper.kext && mkdir -p $output_dir/LiluHelper.kext/Contents
local plist=$output_dir/LiluHelper.kext/Contents/Info.plist
addString "CFBundleDevelopmentRegion" "English" "$plist"
addString "CFBundleGetInfoString" "LiluHelper 1.0, Copyright © 2018 the-braveknight. All rights reserved." "$plist"
addString "CFBundleIdentifier" "com.apple.security.LiluHelper" "$plist"
addString "CFBundleInfoDictionaryVersion" "6.0" "$plist"
addString "CFBundleName" "LiluHelper" "$plist"
addString "CFBundlePackageType" "KEXT" "$plist"
addString "CFBundleVersion" "1.0" "$plist"
addString "IOKitPersonalities:LiluHelper:CFBundleIdentifier" "com.apple.kpi.iokit" "$plist"
addString "IOKitPersonalities:LiluHelper:IOClass" "IOService" "$plist"
addString "IOKitPersonalities:LiluHelper:IOMatchCategory" "LiluHelper" "$plist"
addString "IOKitPersonalities:LiluHelper:IOProviderClass" "IOResources" "$plist"
addString "IOKitPersonalities:LiluHelper:IOResourceMatch" "IOKit" "$plist"
addString "OSBundleLibraries:com.apple.kpi.bsd" "12.0.0" "$plist"
addString "OSBundleLibraries:com.apple.kpi.iokit" "12.0.0" "$plist"
addString "OSBundleLibraries:com.apple.kpi.libkern" "12.0.0" "$plist"
addString "OSBundleLibraries:com.apple.kpi.mach" "12.0.0" "$plist"
addString "OSBundleLibraries:com.apple.kpi.unsupported" "12.0.0" "$plist"
lilu=$kexts_directory/Lilu.kext
lilu_version=$(printValue "OSBundleCompatibleVersion" "$lilu/Contents/Info.plist")
addString "OSBundleLibraries:as.vit9696.Lilu" "$lilu_version" "$plist"
for kext in $(kextsWithLiluDependency); do
local kext_plist=$kext/Contents/Info.plist
local identifier=$(printValue "CFBundleIdentifier" "$kext_plist")
local version=$(printValue "OSBundleCompatibleVersion" "$kext_plist")
if [[ $? -ne 0 ]]; then
local version=$(printValue "OSBundleVersion" "$kext_plist")
fi
addString "OSBundleLibraries:$identifier" "$version" "$plist"
done
}