Index: branches/blackosx/package/BootOptions/Resolution.txt =================================================================== --- branches/blackosx/package/BootOptions/Resolution.txt (revision 1581) +++ branches/blackosx/package/BootOptions/Resolution.txt (revision 1582) @@ -1,4 +1,10 @@ -none:DONT=ADD +# --------------------------------------------- +# Chameleon boot options list. +#ÊStructure is name:key=value +# Note: There must be a carriage return at end of last line +# --------------------------------------------- +Exclusive=True +# --------------------------------------------- 1024x600x32:Graphics Mode=1024x600x32 1024x768x32:Graphics Mode=1024x768x32 1280x768x32:Graphics Mode=1280x768x32 Index: branches/blackosx/package/BootOptions/Video.txt =================================================================== --- branches/blackosx/package/BootOptions/Video.txt (revision 1581) +++ branches/blackosx/package/BootOptions/Video.txt (revision 1582) @@ -1,3 +1,10 @@ +# --------------------------------------------- +# Chameleon boot options list. +# Structure is name:key=value +# Note: There must be a carriage return at end of last line +# --------------------------------------------- +Exclusive=False +# --------------------------------------------- GraphicsEnabler:GraphicsEnabler=Yes UseAtiROM:UseAtiROM=Yes UseNvidiaROM:UseNvidiaROM=Yes Index: branches/blackosx/package/BootOptions/PowerManagement.txt =================================================================== --- branches/blackosx/package/BootOptions/PowerManagement.txt (revision 1581) +++ branches/blackosx/package/BootOptions/PowerManagement.txt (revision 1582) @@ -1,4 +1,10 @@ -CSTUsingSystemIO:CSTUsingSystemIO=Yes +# --------------------------------------------- +# Chameleon boot options list. +# Structure is name:key=value +# Note: There must be a carriage return at end of last line +# --------------------------------------------- +Exclusive=False +# ---------------------------------------------CSTUsingSystemIO:CSTUsingSystemIO=Yes DropSSDT:DropSSDT=Yes EnableC2State:EnableC2State=Yes EnableC3State:EnableC3State=Yes Index: branches/blackosx/package/BootOptions/General.txt =================================================================== --- branches/blackosx/package/BootOptions/General.txt (revision 1581) +++ branches/blackosx/package/BootOptions/General.txt (revision 1582) @@ -1,3 +1,10 @@ +# --------------------------------------------- +# Chameleon boot options list. +# Structure is name:key=value +# Note: There must be a carriage return at end of last line +# --------------------------------------------- +Exclusive=False +# --------------------------------------------- arch:arch=i386 EHCIacquire:EHCIacquire=Yes EthernetBuiltIn:EthernetBuiltIn=Yes Index: branches/blackosx/package/BootOptions/KernelFlags.txt =================================================================== --- branches/blackosx/package/BootOptions/KernelFlags.txt (revision 1581) +++ branches/blackosx/package/BootOptions/KernelFlags.txt (revision 1582) @@ -1 +1,8 @@ +# --------------------------------------------- +# Chameleon boot options list. +# Structure is name:key=value +# Note: There must be a carriage return at end of last line +# --------------------------------------------- +Exclusive=False +# --------------------------------------------- Npci:KF npci=0x2000 Index: branches/blackosx/package/BootOptions/Control.txt =================================================================== --- branches/blackosx/package/BootOptions/Control.txt (revision 1581) +++ branches/blackosx/package/BootOptions/Control.txt (revision 1582) @@ -1,3 +1,10 @@ +# --------------------------------------------- +# Chameleon boot options list. +# Structure is name:key=value +# Note: There must be a carriage return at end of last line +# --------------------------------------------- +Exclusive=False +# --------------------------------------------- BootBanner:Boot Banner=No GUI:GUI=No LegacyLogo:Legacy Logo=Yes Index: branches/blackosx/package/Resources/en.lproj/Localizable.strings =================================================================== --- branches/blackosx/package/Resources/en.lproj/Localizable.strings (revision 1581) +++ branches/blackosx/package/Resources/en.lproj/Localizable.strings (revision 1582) @@ -173,11 +173,8 @@ // Resolution "Resolution_title" = "Resolution"; -"Resolution_description" = "Set the screen resolution of your display"; +"Resolution_description" = "Set one resolution to use, or select 'None' if you don't want to select a resolution."; -"none_title" = "Don't add a resolution"; -"none_description" = "Don't add a resolution"; - "1024x600x32_title" = "1024x600x32"; "1024x600x32_description" = "Set Graphics Mode to 1024x600x32"; @@ -231,7 +228,7 @@ // KeyLayout "KeyLayout_title" = "KeyLayout"; -"KeyLayout_description" = "Set keylayout to use"; +"KeyLayout_description" = "Set one keylayout to use, or select 'None' if you don't want to select a keylayout."; "mac-de_title" = "German Mac Keyboard"; "mac-de_description" = "Use the keyboard layout for a German Mac keyboard"; @@ -282,4 +279,15 @@ "Newer_Package_Installed_message" = "A newer version of Chameleon is already installed"; "Intel_Mac_message" = "This software cannot be installed on this computer."; + +// Exclusive boot ptions string +// Name to be used should be ChooseNone-xxxxxx +// Where xxxxx = the name of the BootOptions file (minus the .txt) +"ChooseNone-Resolution_title" = "None"; +"ChooseNone-Resolution_description" = "Don't choose a resolution."; + +"ChooseNone-keylayout_title" = "None"; +"ChooseNone-keylayout_description" = "Don't choose a keylayout."; + + \ No newline at end of file Index: branches/blackosx/package/buildpkg.sh =================================================================== --- branches/blackosx/package/buildpkg.sh (revision 1581) +++ branches/blackosx/package/buildpkg.sh (revision 1582) @@ -88,7 +88,7 @@ mkdir -p ${1}/Standard/Root mkdir -p ${1}/Standard/Scripts/Resources cp -f ${pkgroot}/Scripts/Main/Standard/* ${1}/Standard/Scripts - cp -f ${pkgroot}/Scripts/Sub/* ${1}/Standard/Scripts + cp -f ${pkgroot}/Scripts/Sub/* ${1}/Standard/Scripts ditto --arch i386 `which SetFile` ${1}/Standard/Scripts/Resources/SetFile ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/Standard/Scripts/Resources/revision ditto --noextattr --noqtn ${1%/*/*}/version ${1}/Standard/Scripts/Resources/version @@ -100,7 +100,7 @@ mkdir -p ${1}/EFI/Root mkdir -p ${1}/EFI/Scripts/Resources cp -f ${pkgroot}/Scripts/Main/EFI/* ${1}/EFI/Scripts - cp -f ${pkgroot}/Scripts/Sub/* ${1}/EFI/Scripts + cp -f ${pkgroot}/Scripts/Sub/* ${1}/EFI/Scripts ditto --arch i386 `which SetFile` ${1}/EFI/Scripts/Resources/SetFile ditto --noextattr --noqtn ${1%/*/*}/revision ${1}/EFI/Scripts/Resources/revision ditto --noextattr --noqtn ${1%/*/*}/version ${1}/EFI/Scripts/Resources/version @@ -198,89 +198,37 @@ do # Take filename and Strip .txt from end and path from front - builtOptionsFolderName=$( echo ${bootOptionFiles[$i]%.txt} ) - builtOptionsFolderName=$( echo ${builtOptionsFolderName##*/} ) - echo "================= $builtOptionsFolderName =================" - - outline[$((outlinecount++))]="${indent[$xmlindent]}\t" - choices[$((choicescount++))]="\n\n" + builtOptionsList=$( echo ${bootOptionFiles[$i]%.txt} ) + builtOptionsList=$( echo ${builtOptionsList##*/} ) + echo "================= $builtOptionsList =================" + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" ((xmlindent++)) - packagesidentity="org.chameleon.options.$builtOptionsFolderName" + packagesidentity="org.chameleon.options.$builtOptionsList" # ------------------------------------------------------ - # Read boot option file in to an array. - # Structure of boot option in file is name:key=value - # Note: This requires the boot option file to have - # a carriage return at the end of the last line. - # ------------------------------------------------------ - count=0 - availableOptions=() - while read textLine - do - availableOptions[count]=$textLine - ((count++)) - done < ${bootOptionFiles[$i]} - - # ------------------------------------------------------ - # Loop through options in array and process each in turn - # ------------------------------------------------------ - for (( c = 0 ; c < ${#availableOptions[@]} ; c++ )) + # Read boot option file in to an array. + # ------------------------------------------------------ + availableOptions=() # array to hold the list of boot options, per 'section'. + exclusiveFlag=0 # used to indicate list has exclusive options. + exclusiveName="" # will be appended to exclusive 'none' option name. + count=0 # used as index for stepping through array. + while read textLine do - textLine=${availableOptions[c]} - # split line - taking all before ':' as option name - # and all after ':' as key/value - optionName=${textLine%:*} - keyValue=${textLine##*:} - - # create folders required for each boot option - mkdir -p "${1}/$optionName/Root/" - - # create dummy file with name of key/value - echo "" > "${1}/$optionName/Root/${keyValue}" - - echo " [BUILD] ${optionName} " - - # ------------------------------------------------------ - # Before calling buildpackage, see if any bootOptionFiles - # have requested being set to exclusive. - # Manually set for now to 'Resolutions'. - # It can eventually be non-specifc by adding a dedicated - # field at the top of each bootOptionFiles to indicate - # if the set should be exclusive or not. - # ------------------------------------------------------ - if [ $builtOptionsFolderName = "Resolution" ]; then - - # Prepare individual string parts - stringStart="selected=\"" - stringBefore="exclusive(choices['" - stringAfter="']) && " - stringEnd="'])\"" - x=${stringStart}${stringBefore} - - # build string for sending to buildpackage - totalItems="${#availableOptions[@]}" - lastItem=$((totalItems-1)) - - for (( r = 0 ; r < ${totalItems} ; r++ )) - do - textLineTemp=${availableOptions[r]} - optionNameTemp=${textLineTemp%:*} - if [ "${optionNameTemp}" != "${optionName}" ]; then - x="${x}${optionNameTemp}" - # Only add these to end of string up to the one before the last item - if [ $r -lt $lastItem ]; then - x="${x}${stringAfter}${stringBefore}" - fi - fi - done - x="${x}${stringEnd}" - buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\" ${x}" >/dev/null 2>&1 - else - buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\"" >/dev/null 2>&1 + # 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=1 + exclusiveName=$builtOptionsList + else + availableOptions[count]=$textLine + ((count++)) + fi fi - - done - + done < ${bootOptionFiles[$i]} + buildbootoptions "$1" "${exclusiveFlag}" "${exclusiveName}" + ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}\t" done @@ -291,14 +239,16 @@ choices[$((choicescount++))]="\n\n" ((xmlindent++)) packagesidentity="org.chameleon.options.keylayout" - keymaps=($( find "${1%/sym/*}/Keymaps" -type f -depth 1 -name '*.lyt' | sed 's|.*/||;s|\.lyt||' )) - for (( i = 0 ; i < ${#keymaps[@]} ; i++ )) - do - mkdir -p "${1}/${keymaps[$i]##*/}/Root/" - echo "dummy file" >"${1}/${keymaps[$i]##*/}/Root/KeyLayout=${keymaps[$i]##*/}" - echo " [BUILD] ${keymaps[$i]##*/} " - buildpackage "${1}/${keymaps[$i]##*/}" "/$chamTemp/options" "" "start_selected=\"false\"" >/dev/null 2>&1 - done + + # ------------------------------------------------------ + # Available Keylayout boot options are discovered by + # reading contents of /Keymaps folder after compilation + # ------------------------------------------------------ + availableOptions=() + availableOptions=($( find "${1%/sym/*}/Keymaps" -type f -depth 1 -name '*.lyt' | sed 's|.*/||;s|\.lyt||' )) + # call buildbootoptions with 1 to indicate exclusive option wanted. + buildbootoptions "$1" "1" "keylayout" + ((xmlindent--)) outline[$((outlinecount++))]="${indent[$xmlindent]}\t" @@ -348,7 +298,7 @@ # clean up - #rm -R -f "${1}" + rm -R -f "${1}" } @@ -360,6 +310,85 @@ chown -R 0:0 "${1}" } +buildbootoptions() +{ + # $1 Path to package to build containing Root and or Scripts + # $2 = exclusiveFlag + # S3 = exclusiveName + + # ------------------------------------------------------ + # if exclusiveFlag=1 then re-build array + # adding extra boot option at beginning to give + #Êuser a chance to choose none of them. + # ------------------------------------------------------ + if [ ${2} = "1" ]; then + tempArray=("${availableOptions[@]}") + availableOptions=() + availableOptions[0]="ChooseNone-"$3":DONT=ADD" + position=0 + totalItems="${#tempArray[@]}" + for (( position = 0 ; position < $totalItems ; position++ )) + do + availableOptions[$position+1]=${tempArray[${position}]} + done + fi + + # ------------------------------------------------------ + # Loop through options in array and process each in turn + # ------------------------------------------------------ + for (( c = 0 ; c < ${#availableOptions[@]} ; c++ )) + do + textLine=${availableOptions[c]} + # split line - taking all before ':' as option name + # and all after ':' as key/value + optionName=${textLine%:*} + keyValue=${textLine##*:} + + # create folders required for each boot option + mkdir -p "${1}/$optionName/Root/" + + # create dummy file with name of key/value + echo "" > "${1}/$optionName/Root/${keyValue}" + + echo " [BUILD] ${optionName} " + + # ------------------------------------------------------ + # Before calling buildpackage, add exclusive options + # to buildpackage call if requested. + # ------------------------------------------------------ + if [ $2 = "1" ]; then + + # Prepare individual string parts + stringStart="selected=\"" + stringBefore="exclusive(choices['" + stringAfter="']) && " + stringEnd="'])\"" + x=${stringStart}${stringBefore} + + # build string for sending to buildpackage + totalItems="${#availableOptions[@]}" + lastItem=$((totalItems-1)) + + for (( r = 0 ; r < ${totalItems} ; r++ )) + do + textLineTemp=${availableOptions[r]} + optionNameTemp=${textLineTemp%:*} + if [ "${optionNameTemp}" != "${optionName}" ]; then + x="${x}${optionNameTemp}" + # Only add these to end of string up to the one before the last item + if [ $r -lt $lastItem ]; then + x="${x}${stringAfter}${stringBefore}" + fi + fi + done + x="${x}${stringEnd}" + buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\" ${x}" >/dev/null 2>&1 + else + buildpackage "${1}/${optionName}" "/$chamTemp/options" "" "start_selected=\"false\"" >/dev/null 2>&1 + fi + done +} + buildpackage () { # $1 Path to package to build containing Root and or Scripts @@ -389,7 +418,7 @@ header+="auth=\"root\">\n" header+="\t\n" - #rm -R -f "${1}/Temp" + rm -R -f "${1}/Temp" [ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp" [ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom" @@ -426,7 +455,7 @@ fi choices[$((choicescount++))]="\n\t#${packagename// /}.pkg\n\n" - #rm -R -f "${1}" + rm -R -f "${1}" fi }