Index: branches/blackosx/package/Scripts/Main/Post/postinstall =================================================================== --- branches/blackosx/package/Scripts/Main/Post/postinstall (revision 1588) +++ branches/blackosx/package/Scripts/Main/Post/postinstall (revision 1589) @@ -93,22 +93,20 @@ # Read list of all boot options the user added. arrayCount=0 -ls "${chamTemp}"/options | while read FILE +kernelFlagCount=0 +while read FILE do options[arrayCount]="${FILE##*/}" # Check keyRead for 'KF' at beginning to # indicate that should be a kernel flag if [ ${options[arrayCount]:0:2} = "KF" ];then - kernelflag=${options[arrayCount]##*flag=} - sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelflag" "$tempOCBP" - "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: ${kernelflag}" - returnValue=$? - if [ ${returnValue}=1 ]; then - # Delete it for now, but need to append as more kernel flags could be added in future!! - sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" - sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelflag" "$tempOCBP" - fi + # plistbuddy only add's if the key doesn't already exist. + #ĘSo let's store any kernelflags and add them all at + # once we reach the end of the options list. + kernelflag[kernelFlagCount]="${options[arrayCount]##*flag=}" + "$scriptDir"InstallLog.sh "${dest_vol}" "Added kernel flag: ${kernelflag[kernelFlagCount]}" + (( kernelFlagCount++ )) else keyRead="${options[$arrayCount]%=*}" value="${options[$arrayCount]#*=}" @@ -120,8 +118,21 @@ fi fi (( arrayCount++ )) -done +done < <(ls "${chamTemp}"/options ) +if [ $kernelFlagCount -gt 0 ]; then + # Add kernel flags + for (( i=0 ; i < $kernelFlagCount ; i++ )) + do + # Add any kernel flags together in to one string. + kernelFlagString="${kernelFlagString} ${kernelflag[i]}" + done + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + if [ ${returnValue}=1 ]; then # key already exists. + sudo /usr/libexec/plistbuddy -c "Delete :Kernel\ Flags" "$tempOCBP" + sudo /usr/libexec/plistbuddy -c "Add :Kernel\ Flags string $kernelFlagString" "$tempOCBP" + fi +fi # --------------------------------------------- # Copy temp Extra folder to target destination Index: branches/blackosx/package/buildpkg.sh =================================================================== --- branches/blackosx/package/buildpkg.sh (revision 1588) +++ branches/blackosx/package/buildpkg.sh (revision 1589) @@ -253,7 +253,7 @@ availableOptions[i]=${availableOptions[i]}":KeyLayout="${availableOptions[i]} done - # call buildbootoptions with 1 to indicate exclusive option wanted. + # call buildoptionalsettings with 1 to indicate exclusive option wanted. buildoptionalsettings "$1" "1" "keylayout" ((xmlindent--)) @@ -308,7 +308,7 @@ # clean up - #rm -R -f "${1}" + rm -R -f "${1}" } @@ -428,7 +428,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" @@ -465,7 +465,7 @@ fi choices[$((choicescount++))]="\n\t#${packagename// /}.pkg\n\n" - #rm -R -f "${1}" + rm -R -f "${1}" fi }