Index: trunk/package/Distribution =================================================================== --- trunk/package/Distribution (revision 1795) +++ trunk/package/Distribution (revision 1796) @@ -53,27 +53,26 @@ 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; } Index: trunk/package/OptionalSettings/Resolution.txt =================================================================== --- trunk/package/OptionalSettings/Resolution.txt (revision 1795) +++ trunk/package/OptionalSettings/Resolution.txt (revision 1796) @@ -4,16 +4,16 @@ # 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. @@ -25,14 +25,14 @@ # --------------------------------------------- # 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 Index: trunk/package/OptionalSettings/Video.txt =================================================================== --- trunk/package/OptionalSettings/Video.txt (revision 1795) +++ trunk/package/OptionalSettings/Video.txt (revision 1796) @@ -4,16 +4,16 @@ # 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. @@ -25,7 +25,7 @@ # --------------------------------------------- # 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 Index: trunk/package/OptionalSettings/PowerManagement.txt =================================================================== --- trunk/package/OptionalSettings/PowerManagement.txt (revision 1795) +++ trunk/package/OptionalSettings/PowerManagement.txt (revision 1796) @@ -4,16 +4,16 @@ # 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. @@ -25,10 +25,10 @@ # --------------------------------------------- # 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 Index: trunk/package/OptionalSettings/General.txt =================================================================== --- trunk/package/OptionalSettings/General.txt (revision 1795) +++ trunk/package/OptionalSettings/General.txt (revision 1796) @@ -4,16 +4,16 @@ # 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. @@ -25,13 +25,13 @@ # --------------------------------------------- # 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 Index: trunk/package/OptionalSettings/KernelFlags.txt =================================================================== --- trunk/package/OptionalSettings/KernelFlags.txt (revision 1795) +++ trunk/package/OptionalSettings/KernelFlags.txt (revision 1796) @@ -4,16 +4,16 @@ # 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. @@ -25,8 +25,8 @@ # --------------------------------------------- # 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 Index: trunk/package/OptionalSettings/Control.txt =================================================================== --- trunk/package/OptionalSettings/Control.txt (revision 1795) +++ trunk/package/OptionalSettings/Control.txt (revision 1796) @@ -4,16 +4,16 @@ # 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. @@ -25,10 +25,10 @@ # --------------------------------------------- # 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 Index: trunk/package/buildpkg.sh =================================================================== --- trunk/package/buildpkg.sh (revision 1795) +++ trunk/package/buildpkg.sh (revision 1796) @@ -611,14 +611,13 @@ # 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 =================" @@ -628,29 +627,32 @@ 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#*=} @@ -660,14 +662,22 @@ # 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