Chameleon

Chameleon Commit Details

Date:2012-01-07 02:17:00 (12 years 3 months ago)
Author:JrCs
Commit:1773
Parents: 1772
Message:Improved Installer - Simplify the postinstall script - Treat Kernel Flags option like any other options
Changes:
M/trunk/package/OptionalSettings/Control.txt
M/trunk/package/OptionalSettings/Resolution.txt
M/trunk/package/Scripts/Main/postinstall
M/trunk/package/OptionalSettings/Video.txt
M/trunk/package/buildpkg.sh
M/trunk/package/OptionalSettings/PowerManagement.txt
M/trunk/package/Distribution
M/trunk/package/OptionalSettings/General.txt
M/trunk/package/OptionalSettings/KernelFlags.txt

File differences

trunk/package/Distribution
6363
6464
6565
66
67
68
66
67
68
6969
70
71
72
73
74
75
76
77
78
79
80
81
70
71
72
73
74
8275
83
76
8477
8578
8679
}
function check_chameleon_option(key, value) {
if (bootPlist) {
if (key == "KFflag")
key = "Kernel Flags";
if ( bootPlist && bootPlist[ key ] ) {
if ( key == "Kernel Flags" )
return check_chameleon_kernel_option( bootPlist[ key ], value );
if (bootPlist[ key ]) {
if ( key == "Kernel Flags" )
return check_chameleon_kernel_option( bootPlist[ key ], value );
// Check if value is a boolean
var pattern=/^(Y(es)?|No?)$/i;
var result = value.match(pattern); // Check if the value is a boolean
if ( result && bootPlist[ key ].charAt(0).toLowerCase() == value.charAt(0).toLowerCase() )
return true;
else
return bootPlist[ key ] == value; // check if the strings are equal
}
// Check if value is a boolean
var pattern=/^(Y(es)?|No?)$/i;
var result = value.match(pattern); // Check if the value is a boolean
if ( result && bootPlist[ key ].charAt(0).toLowerCase() == value.charAt(0).toLowerCase() )
return true;
else
return false;
return bootPlist[ key ] == value; // check if the strings are equal
}
return false;
}
trunk/package/OptionalSettings/Resolution.txt
1111
1212
1313
14
15
16
14
15
16
1717
1818
1919
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# ---------------------------------------------
# To add kernel flag: Structure is name:KFflag=kernelflag
# example1: Npci:KFflag=npci=0x2000
# example2: Verbose:KFflag=-v
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# ---------------------------------------------
# The package installer has a setting which controls what
# the user is allowed to choose.
trunk/package/OptionalSettings/Video.txt
1111
1212
1313
14
15
16
14
15
16
1717
1818
1919
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# ---------------------------------------------
# To add kernel flag: Structure is name:KFflag=kernelflag
# example1: Npci:KFflag=npci=0x2000
# example2: Verbose:KFflag=-v
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# ---------------------------------------------
# The package installer has a setting which controls what
# the user is allowed to choose.
trunk/package/OptionalSettings/PowerManagement.txt
1111
1212
1313
14
15
16
14
15
16
1717
1818
1919
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# ---------------------------------------------
# To add kernel flag: Structure is name:KFflag=kernelflag
# example1: Npci:KFflag=npci=0x2000
# example2: Verbose:KFflag=-v
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# ---------------------------------------------
# The package installer has a setting which controls what
# the user is allowed to choose.
trunk/package/OptionalSettings/General.txt
1111
1212
1313
14
15
16
14
15
16
1717
1818
1919
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# ---------------------------------------------
# To add kernel flag: Structure is name:KFflag=kernelflag
# example1: Npci:KFflag=npci=0x2000
# example2: Verbose:KFflag=-v
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# ---------------------------------------------
# The package installer has a setting which controls what
# the user is allowed to choose.
trunk/package/OptionalSettings/KernelFlags.txt
1111
1212
1313
14
15
16
14
15
16
1717
1818
1919
......
2525
2626
2727
28
29
30
31
32
28
29
30
31
32
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# ---------------------------------------------
# To add kernel flag: Structure is name:KFflag=kernelflag
# example1: Npci:KFflag=npci=0x2000
# example2: Verbose:KFflag=-v
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# ---------------------------------------------
# The package installer has a setting which controls what
# the user is allowed to choose.
# ---------------------------------------------
# Note: There must be a carriage return at end of last line
# ---------------------------------------------
Verbose:KFflag=-v
Singleusermode:KFflag=-s
Ignorecaches:KFflag=-f
Npci:KFflag=npci=0x2000
Darkwake:KFflag=darkwake=0
Verbose:Kernel Flags=-v
Singleusermode:Kernel Flags=-s
Ignorecaches:Kernel Flags=-f
Npci:Kernel Flags=npci=0x2000
Darkwake:Kernel Flags=darkwake=0
trunk/package/OptionalSettings/Control.txt
1111
1212
1313
14
15
16
14
15
16
1717
1818
1919
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# ---------------------------------------------
# To add kernel flag: Structure is name:KFflag=kernelflag
# example1: Npci:KFflag=npci=0x2000
# example2: Verbose:KFflag=-v
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# ---------------------------------------------
# The package installer has a setting which controls what
# the user is allowed to choose.
trunk/package/Scripts/Main/postinstall
8080
8181
8282
83
84
85
86
87
83
84
85
86
8887
89
90
91
88
89
9290
9391
9492
95
96
97
93
94
9895
99
100
10196
102
103
104
105
106
107
108
109
110
97
98
99
100
101
102
103
111104
112105
113
114
106
115107
116
117
118
119
120
121
122
123
108
109
110
124111
125112
126113
cp "$4"/Library/Preferences/SystemConfiguration/com.apple.Boot.plist "$tempOCBP"
# Read list of all boot options the user added.
arrayCount=0
kernelFlagCount=0
while read FILE
do
options[arrayCount]="${FILE##*/}"
while IFS= read -r -d '' FILE; do
option="${FILE##*/}"
key="${option%%=*}"
value="${option#*=}"
# Check keyRead for 'KF' at beginning to
# indicate that should be a kernel flag
if [ ${options[arrayCount]:0:2} = "KF" ];then
# Check for 'Kernel Flags' key indicate that should be a kernel flag
if [[ "$key" = "Kernel Flags" ]];then
# plistbuddy only add's if the key doesn't already exist.
# So let's store any kernelflags and add them all at the
# same time once when we reach the end of the options list.
kernelflag[kernelFlagCount]="${options[arrayCount]##*flag=}"
"$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: ${kernelflag[kernelFlagCount]}"
(( kernelFlagCount++ ))
kernelflag[${#kernelflag[*]}]="$value"
"$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: $value"
else
keyRead="${options[$arrayCount]%=*}"
value="${options[$arrayCount]#*=}"
# escape any spaces
keyToUse=$( echo $keyRead | sed 's/ /\\ /g' )
if [ "${keyToUse}" != "DONT" ] && [ "${value}" != "ADD" ]; then
sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP"
returnValue=$?
if [ ${returnValue} -ne 1 ]; then
"$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${keyRead}=${value}"
else
"$scriptDir"InstallLog.sh "${dest_vol}" "Can't add ${keyRead}=${value} as an option already exists for: ${keyRead}"
fi
keyToUse=$( echo "$key" | sed 's/ /\\ /g' )
sudo /usr/libexec/plistbuddy -c "Add :${keyToUse} string ${value}" "$tempOCBP"
returnValue=$?
if [ ${returnValue} -ne 1 ]; then
"$scriptDir"InstallLog.sh "${dest_vol}" "Added boot option: ${key}=${value}"
else
"$scriptDir"InstallLog.sh "${dest_vol}" "Can't add ${key}=${value} as an option already exists for: ${key}"
fi
fi
(( arrayCount++ ))
done < <(ls "${chamTemp}"/options )
done < <( find "${chamTemp}/options" -type f -print0 )
if [ $kernelFlagCount -gt 0 ]; then
# Add any kernel flags together in to one string.
for (( i=0 ; i < $kernelFlagCount ; i++ ))
do
kernelFlagString="${kernelFlagString} ${kernelflag[i]}"
done
# We add the final string in the next section.
fi
# Add any kernel flags together in to one string.
kernelFlagString="${kernelflag[@]}"
# We add the final string in the next section.
fi
# ---------------------------------------------
trunk/package/buildpkg.sh
519519
520520
521521
522
522
523523
524524
525525
textLine=${availableOptions[c]}
# split line - taking all before ':' as option name
# and all after ':' as key/value
optionName=${textLine%:*}
optionName=${textLine%%:*}
keyValue=${textLine##*:}
key=${keyValue%%=*}
value=${keyValue#*=}

Archive Download the corresponding diff file

Revision: 1773