Chameleon

Chameleon Commit Details

Date:2012-01-14 12:12:40 (8 years 10 months ago)
Author:JrCs
Commit:1796
Parents: 1795
Message:Improved installer - Options have now a "type"
Changes:
M/trunk/package/OptionalSettings/Control.txt
M/trunk/package/OptionalSettings/Resolution.txt
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
5353
5454
5555
56
57
58
59
60
61
56
57
58
59
6260
63
61
6462
65
66
67
68
63
64
65
66
67
6968
70
71
72
73
74
75
76
69
70
71
72
73
74
75
7776
7877
7978
return bootPlist ? true : false;
}
function check_chameleon_kernel_option(kernelFlags, value) {
var flags = kernelFlags.split(" ");
for ( var i = 0; i < flags.length; i++ ) {
if (flags[i] == value)
return true;
}
function check_chameleon_bool_option(key, value) {
if ( bootPlist && bootPlist[ key ] )
// check if the first letter (in lowercase) is the same
return bootPlist[ key ].charAt(0).toLowerCase() == value.charAt(0).toLowerCase();
return false;
}
}
function check_chameleon_option(key, value) {
if ( bootPlist && bootPlist[ key ] ) {
if ( key == "Kernel Flags" )
return check_chameleon_kernel_option( bootPlist[ key ], value );
function check_chameleon_text_option(key, value) {
if ( bootPlist && bootPlist[ key ] )
return bootPlist[ key ] == value; // check if the strings are equal
return false;
}
// 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
function check_chameleon_list_option(key, value) {
if ( bootPlist && bootPlist[ key ] ) {
var items = bootPlist[ key ].split(" ");
for ( var i = 0; i < items.length; i++ ) {
if (items[i] == value)
return true;
}
}
return false;
}
trunk/package/OptionalSettings/Resolution.txt
44
55
66
7
7
88
99
10
11
12
10
11
12
13
14
1315
14
15
16
16
1717
1818
1919
......
2525
2626
2727
28
29
30
31
32
33
34
35
36
37
38
28
29
30
31
32
33
34
35
36
37
38
# Add boot options or kernel flags to the bottom of this file.
# They will appear under the package installer's Settings menu
# in a sub menu named with the filename of this file.
# Use one file or many files - it's flexible to make it easy
# to group different options under separate sub menus.
# ---------------------------------------------
# To add boot option: Structure is name:key=value
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# To add boot option: Structure is:
# type@name:key=value
# example1: Bool@InstantMenu:Instant Menu=Yes
# example2: Text@1024x600x32:Graphics Mode=1024x600x32
# example3: List@Npci:Kernel Flags=npci=0x2000
# ---------------------------------------------
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# type can be: Bool, Text or List
# ---------------------------------------------
# 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
# ---------------------------------------------
1024x600x32:Graphics Mode=1024x600x32
1024x768x32:Graphics Mode=1024x768x32
1280x768x32:Graphics Mode=1280x768x32
1280x800x32:Graphics Mode=1280x800x32
1280x960x32:Graphics Mode=1280x960x32
1280x1024x32:Graphics Mode=1280x1024x32
1440x900x32:Graphics Mode=1440x900x32
1600x900x32:Graphics Mode=1600x900x32
1680x1050x32:Graphics Mode=1680x1050x32
1920x1080x32:Graphics Mode=1920x1080x32
1920x1200x32:Graphics Mode=1920x1200x32
Text@1024x600x32:Graphics Mode=1024x600x32
Text@1024x768x32:Graphics Mode=1024x768x32
Text@1280x768x32:Graphics Mode=1280x768x32
Text@1280x800x32:Graphics Mode=1280x800x32
Text@1280x960x32:Graphics Mode=1280x960x32
Text@1280x1024x32:Graphics Mode=1280x1024x32
Text@1440x900x32:Graphics Mode=1440x900x32
Text@1600x900x32:Graphics Mode=1600x900x32
Text@1680x1050x32:Graphics Mode=1680x1050x32
Text@1920x1080x32:Graphics Mode=1920x1080x32
Text@1920x1200x32:Graphics Mode=1920x1200x32
trunk/package/OptionalSettings/Video.txt
44
55
66
7
7
88
99
10
11
12
10
11
12
13
14
1315
14
15
16
16
1717
1818
1919
......
2525
2626
2727
28
29
30
31
28
29
30
31
# Add boot options or kernel flags to the bottom of this file.
# They will appear under the package installer's Settings menu
# in a sub menu named with the filename of this file.
# Use one file or many files - it's flexible to make it easy
# Use one file or many files - it's flexible to make it easy
# to group different options under separate sub menus.
# ---------------------------------------------
# To add boot option: Structure is name:key=value
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# To add boot option: Structure is:
# type@name:key=value
# example1: Bool@InstantMenu:Instant Menu=Yes
# example2: Text@1024x600x32:Graphics Mode=1024x600x32
# example3: List@Npci:Kernel Flags=npci=0x2000
# ---------------------------------------------
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# type can be: Bool, Text or List
# ---------------------------------------------
# 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
# ---------------------------------------------
GraphicsEnabler:GraphicsEnabler=Yes
UseAtiROM:UseAtiROM=Yes
UseNvidiaROM:UseNvidiaROM=Yes
VBIOS:VBIOS=Yes
Bool@GraphicsEnabler:GraphicsEnabler=Yes
Bool@UseAtiROM:UseAtiROM=Yes
Bool@UseNvidiaROM:UseNvidiaROM=Yes
Bool@VBIOS:VBIOS=Yes
trunk/package/OptionalSettings/PowerManagement.txt
44
55
66
7
7
88
99
10
11
12
10
11
12
13
14
1315
14
15
16
16
1717
1818
1919
......
2525
2626
2727
28
29
30
31
32
33
34
28
29
30
31
32
33
34
# Add boot options or kernel flags to the bottom of this file.
# They will appear under the package installer's Settings menu
# in a sub menu named with the filename of this file.
# Use one file or many files - it's flexible to make it easy
# to group different options under separate sub menus.
# ---------------------------------------------
# To add boot option: Structure is name:key=value
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# To add boot option: Structure is:
# type@name:key=value
# example1: Bool@InstantMenu:Instant Menu=Yes
# example2: Text@1024x600x32:Graphics Mode=1024x600x32
# example3: List@Npci:Kernel Flags=npci=0x2000
# ---------------------------------------------
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# type can be: Bool, Text or List
# ---------------------------------------------
# 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
# ---------------------------------------------
CSTUsingSystemIO:CSTUsingSystemIO=Yes
DropSSDT:DropSSDT=Yes
EnableC2State:EnableC2State=Yes
EnableC3State:EnableC3State=Yes
EnableC4State:EnableC4State=Yes
GenerateCStates:GenerateCStates=Yes
GeneratePStates:GeneratePStates=Yes
Bool@CSTUsingSystemIO:CSTUsingSystemIO=Yes
Bool@DropSSDT:DropSSDT=Yes
Bool@EnableC2State:EnableC2State=Yes
Bool@EnableC3State:EnableC3State=Yes
Bool@EnableC4State:EnableC4State=Yes
Bool@GenerateCStates:GenerateCStates=Yes
Bool@GeneratePStates:GeneratePStates=Yes
trunk/package/OptionalSettings/General.txt
44
55
66
7
7
88
99
10
11
12
10
11
12
13
14
1315
14
15
16
16
1717
1818
1919
......
2525
2626
2727
28
29
30
31
32
33
34
35
36
37
28
29
30
31
32
33
34
35
36
37
# Add boot options or kernel flags to the bottom of this file.
# They will appear under the package installer's Settings menu
# in a sub menu named with the filename of this file.
# Use one file or many files - it's flexible to make it easy
# to group different options under separate sub menus.
# ---------------------------------------------
# To add boot option: Structure is name:key=value
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# To add boot option: Structure is:
# type@name:key=value
# example1: Bool@InstantMenu:Instant Menu=Yes
# example2: Text@1024x600x32:Graphics Mode=1024x600x32
# example3: List@Npci:Kernel Flags=npci=0x2000
# ---------------------------------------------
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# type can be: Bool, Text or List
# ---------------------------------------------
# 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
# ---------------------------------------------
arch:arch=i386
EHCIacquire:EHCIacquire=Yes
EthernetBuiltIn:EthernetBuiltIn=Yes
ForceHPET:ForceHPET=Yes
ForceWake:ForceWake=Yes
RestartFix:RestartFix=No
UHCIreset:UHCIreset=Yes
UseMemDetect:UseMemDetect=No
UseKernelCache:UseKernelCache=Yes
Wake:Wake=Yes
Text@arch:arch=i386
Bool@EHCIacquire:EHCIacquire=Yes
Bool@EthernetBuiltIn:EthernetBuiltIn=Yes
Bool@ForceHPET:ForceHPET=Yes
Bool@ForceWake:ForceWake=Yes
Bool@RestartFix:RestartFix=No
Bool@UHCIreset:UHCIreset=Yes
Bool@UseMemDetect:UseMemDetect=No
Bool@UseKernelCache:UseKernelCache=Yes
Bool@Wake:Wake=Yes
trunk/package/OptionalSettings/KernelFlags.txt
44
55
66
7
7
88
99
10
11
12
10
11
12
13
14
1315
14
15
16
16
1717
1818
1919
......
2525
2626
2727
28
29
30
31
32
28
29
30
31
32
# Add boot options or kernel flags to the bottom of this file.
# They will appear under the package installer's Settings menu
# in a sub menu named with the filename of this file.
# Use one file or many files - it's flexible to make it easy
# to group different options under separate sub menus.
# ---------------------------------------------
# To add boot option: Structure is name:key=value
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# To add boot option: Structure is:
# type@name:key=value
# example1: Bool@InstantMenu:Instant Menu=Yes
# example2: Text@1024x600x32:Graphics Mode=1024x600x32
# example3: List@Npci:Kernel Flags=npci=0x2000
# ---------------------------------------------
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# type can be: Bool, Text or List
# ---------------------------------------------
# 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:Kernel Flags=-v
Singleusermode:Kernel Flags=-s
Ignorecaches:Kernel Flags=-f
Npci:Kernel Flags=npci=0x2000
Darkwake:Kernel Flags=darkwake=0
List@Verbose:Kernel Flags=-v
List@Singleusermode:Kernel Flags=-s
List@Ignorecaches:Kernel Flags=-f
List@Npci:Kernel Flags=npci=0x2000
List@Darkwake:Kernel Flags=darkwake=0
trunk/package/OptionalSettings/Control.txt
44
55
66
7
7
88
99
10
11
12
10
11
12
13
14
1315
14
15
16
16
1717
1818
1919
......
2525
2626
2727
28
29
30
31
32
33
34
28
29
30
31
32
33
34
# Add boot options or kernel flags to the bottom of this file.
# They will appear under the package installer's Settings menu
# in a sub menu named with the filename of this file.
# Use one file or many files - it's flexible to make it easy
# to group different options under separate sub menus.
# ---------------------------------------------
# To add boot option: Structure is name:key=value
# example1: InstantMenu:Instant Menu=Yes
# example2: DropSSDT:DropSSDT=Yes
# To add boot option: Structure is:
# type@name:key=value
# example1: Bool@InstantMenu:Instant Menu=Yes
# example2: Text@1024x600x32:Graphics Mode=1024x600x32
# example3: List@Npci:Kernel Flags=npci=0x2000
# ---------------------------------------------
# To add kernel flag: Structure is name:Kernel Flags=kernelflag
# example1: Npci:Kernel Flags=npci=0x2000
# example2: Verbose:Kernel Flags=-v
# type can be: Bool, Text or List
# ---------------------------------------------
# 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
# ---------------------------------------------
BootBanner:Boot Banner=No
GUI:GUI=No
LegacyLogo:Legacy Logo=Yes
InstantMenu:Instant Menu=Yes
QuietBoot:QuietBoot=Yes
ShowInfo:ShowInfo=Yes
Wait:Wait=Yes
Bool@BootBanner:Boot Banner=No
Bool@GUI:GUI=No
Bool@LegacyLogo:Legacy Logo=Yes
Bool@InstantMenu:Instant Menu=Yes
Bool@QuietBoot:QuietBoot=Yes
Bool@ShowInfo:ShowInfo=Yes
Bool@Wait:Wait=Yes
trunk/package/buildpkg.sh
611611
612612
613613
614
615614
616
617
615
618616
619617
620
621
618
619
620
622621
623622
624623
......
628627
629628
630629
631
632
633
634
635
636
637
638
639
640
630
631
632
633
634
635
636
637
638
639
640
641
642
641643
642644
643
644645
645646
646647
647648
648
649
649
650650
651651
652
653
652
653
654
655
654656
655657
656658
......
660662
661663
662664
665
666
667
668
669
670
671
672
663673
664674
665675
666
676
667677
668678
669679
670
680
671681
672682
673683
# parse OptionalSettings folder to find files of boot options.
# ------------------------------------------------------
OptionalSettingsFolder="${PKGROOT}/OptionalSettings"
OptionalSettingsFiles=($( find "${OptionalSettingsFolder}" -depth 1 ! -name '.svn' ! -name '.DS_Store' ))
for (( i = 0 ; i < ${#OptionalSettingsFiles[@]} ; i++ ))
do
while IFS= read -r -d '' OptionsFile; do
# Take filename and Strip .txt from end and path from front
builtOptionsList=$( echo ${OptionalSettingsFiles[$i]%.txt} )
builtOptionsList=$( echo ${builtOptionsList##*/} )
builtOptionsList=${OptionsFile%.txt}
builtOptionsList=${builtOptionsList##*/}
packagesidentity="${chameleon_package_identity}.options.$builtOptionsList"
echo "================= $builtOptionsList ================="
availableOptions=() # array to hold the list of boot options, per 'section'.
exclusiveFlag="" # used to indicate list has exclusive options
while read textLine; do
# ignore lines in the file beginning with a # and Exclusive=False
if [[ ${textLine} != \#* ]] && [[ ${textLine} != "Exclusive=False" ]];then
# check for 'Exclusive=True' option in file
if [[ ${textLine} == "Exclusive=True" ]];then
exclusiveFlag="--exclusive_zero_or_one_choice"
else
availableOptions[${#availableOptions[@]}]=$textLine
fi
fi
done < ${OptionalSettingsFiles[$i]}
# ignore lines in the file beginning with a #
[[ $textLine = \#* ]] && continue
local optionName="" key="" value=""
case "$textLine" in
Exclusive=[Tt][Rr][Uu][Ee]) exclusiveFlag="--exclusive_zero_or_one_choice" ;;
Exclusive=*) continue ;;
*@*:*=*)
availableOptions[${#availableOptions[*]}]="$textLine" ;;
*) echo "Error: invalid line '$textLine' in file '$OptionsFile'" >&2
exit 1
;;
esac
done < "$OptionsFile"
addGroupChoices --parent="Options" $exclusiveFlag "${builtOptionsList}"
packagesidentity="${chameleon_package_identity}.options.$builtOptionsList"
# ------------------------------------------------------
# Loop through options in array and process each in turn
# ------------------------------------------------------
for (( c = 0 ; c < ${#availableOptions[@]} ; c++ )); do
textLine=${availableOptions[c]}
for textLine in "${availableOptions[@]}"; do
# split line - taking all before ':' as option name
# and all after ':' as key/value
optionName=${textLine%%:*}
keyValue=${textLine##*:}
type=$( echo "${textLine%%@*}" | tr '[:upper:]' '[:lower:]' )
tmp=${textLine#*@}
optionName=${tmp%%:*}
keyValue=${tmp##*:}
key=${keyValue%%=*}
value=${keyValue#*=}
# create dummy file with name of key/value
echo "" > "${PKG_BUILD_DIR}/$optionName/Root/${keyValue}"
case "$type" in
bool) startSelected="check_chameleon_bool_option('$key','$value')" ;;
text) startSelected="check_chameleon_text_option('$key','$value')" ;;
list) startSelected="check_chameleon_list_option('$key','$value')" ;;
*) echo "Error: invalid type '$type' in line '$textLine' in '$OptionsFile'" >&2
exit 1
;;
esac
packageRefId=$(getPackageRefId "${packagesidentity}" "${optionName}")
buildpackage "$packageRefId" "${optionName}" "${PKG_BUILD_DIR}/${optionName}" "/$chamTemp/options"
addChoice --group="${builtOptionsList}" \
--start-selected="check_chameleon_option('$key','$value')" \
--start-selected="$startSelected" \
--pkg-refs="$packageRefId" "${optionName}"
done
done
done < <( find "${OptionalSettingsFolder}" -depth 1 -type f -name '*.txt' -print0 )
# End build options packages

Archive Download the corresponding diff file

Revision: 1796