-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathupdate_config.sh
executable file
·42 lines (36 loc) · 1.07 KB
/
update_config.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
#!/bin/bash
EFI=$(./mount_efi.sh /)
config=$EFI/EFI/Clover/config.plist
function replaceVar() {
value=$(/usr/libexec/plistbuddy -c "Print '$1'" config.plist)
/usr/libexec/plistbuddy -c "Set '$1' '$value'" $config
}
function replaceDict() {
/usr/libexec/plistbuddy -x -c "Print '$1'" config.plist > /tmp/org_rehabman_node.plist
/usr/libexec/plistbuddy -c "Delete '$1'" $config
/usr/libexec/plistbuddy -c "Add '$1' dict" $config
/usr/libexec/plistbuddy -c "Merge /tmp/org_rehabman_node.plist '$1'" $config
}
# existing config.plist, preserve:
# CPU
# DisableDrivers
# GUI
# RtVariables, except CsrActiveConfig and BooterConfig
# SMBIOS
#
# replaced are:
# ACPI
# Boot
# Devices
# KernelAndKextPatches
# SystemParameters
# RtVariables:BooterConfig
# RtVariables:CsrActiveConfig
echo The config.plist at $config will be updated.
replaceDict ":ACPI"
replaceDict ":Boot"
replaceDict ":Devices"
replaceDict ":KernelAndKextPatches"
replaceDict ":SystemParameters"
replaceVar ":RtVariables:BooterConfig"
replaceVar ":RtVariables:CsrActiveConfig"