-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathupdate_config.sh
executable file
·48 lines (41 loc) · 1.15 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
43
44
45
46
47
48
#!/bin/bash
#set -x
EFI=`sudo ./mount_efi.sh /`
CONFIG=$EFI/EFI/Clover/config.plist
function replace_var()
# $1 is path to replace
{
value=`/usr/libexec/plistbuddy -c "Print \"$1\"" config.plist`
/usr/libexec/plistbuddy -c "Set \"$1\" \"$value\"" $CONFIG
}
function replace_dict()
# $1 is path to replace
{
/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.
replace_dict ":ACPI"
replace_dict ":Boot"
replace_dict ":Devices"
replace_dict ":KernelAndKextPatches"
replace_dict ":SystemParameters"
replace_var ":RtVariables:BooterConfig"
replace_var ":RtVariables:CsrActiveConfig"