Index: trunk/PackageBuilder/Distribution =================================================================== --- trunk/PackageBuilder/Distribution (revision 0) +++ trunk/PackageBuilder/Distribution (revision 129) @@ -0,0 +1,64 @@ + + + + + + + + + + + + + + + Chameleon_title + + Index: trunk/PackageBuilder/fdisk =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: trunk/PackageBuilder/fdisk ___________________________________________________________________ Added: svn:mime-type + application/octet-stream Index: trunk/PackageBuilder/buildpkg =================================================================== --- trunk/PackageBuilder/buildpkg (revision 0) +++ trunk/PackageBuilder/buildpkg (revision 129) @@ -0,0 +1,402 @@ +#!/bin/bash + +# $1 Path to store built package + +packagesidentity="org.chameleon" + +packagename="Chameleon" + +pkgroot="${0%/*}" + +#version=$( grep I386BOOT_CHAMELEONVERSION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' ) +version=$( cat version ) +stage=${version##*-} +revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' ) +builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' ) +timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" ) + +distributioncount=0 +xmlindent=0 + +indent[0]="\t" +indent[1]="\t\t" +indent[2]="\t\t\t" +indent[3]="\t\t\t\t" + +main () +{ + +# clean up the destination path + + rm -R -f "${1}" + + echo "Building $packagename Install Package v${version%%-*} $stage r$revision $builddate" + + outline[$((outlinecount++))]="${indent[$xmlindent]}" + +# build core package + + ((xmlindent++)) + packagesidentity="org.chameleon" + mkdir -p ${1}/Core/Root/usr/sbin +# mkdir -p ${1}/Core/Root/usr/local/bin + mkdir -p ${1}/Core/Root/usr/standalone/i386 +# mkdir -p ${1}/Core/Root/Extra + cp -f ${1%/*}/i386/boot ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot0 ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot0hfs ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot1hp ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/cdboot ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/chain0 ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/bdmesg ${1}/Core/Root/usr/sbin + fixperms "${1}/Core/Root/" +# cp -Rf ${pkgroot}/Configuration/Chameleon.prefPane ${1}/Core/Root/Library/PreferencePanes +# cp -f ${pkgroot}/Configuration/smbios.plist ${1}/Core/Root/Extra + cp -f ${pkgroot}/fdisk440 ${1}/Core/Root/usr/sbin + local coresize=$( du -hkc "${1}/Core/Root" | tail -n1 | awk {'print $1'} ) + buildpackage "${1}/Core" "/" "0" "start_visible=\"false\" start_selected=\"true\"" + + +# build Chameleon package + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + +# build standard package + + mkdir -p ${1}/Standard/Root + mkdir -p ${1}/Standard/Scripts/Tools + cp -f ${pkgroot}/Scripts/Standard/* ${1}/Standard/Scripts + ditto --arch i386 `which SetFile` ${1}/Standard/Scripts/Tools/SetFile + buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EnhancedHFS']) && exclusive(choices['Standardhfs']) && exclusive(choices['EnhancedFAT'])\"" + +# build standard package with boot0hfs + + mkdir -p ${1}/Standardhfs/Root + mkdir -p ${1}/Standardhfs/Scripts/Tools + cp -f ${pkgroot}/Scripts/Standardhfs/* ${1}/Standardhfs/Scripts + ditto --arch i386 `which SetFile` ${1}/Standardhfs/Scripts/Tools/SetFile + buildpackage "${1}/Standardhfs" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"false\" selected=\"exclusive(choices['EnhancedHFS']) && exclusive(choices['Standard']) && exclusive(choices['EnhancedFAT'])\"" + + +# build efi fat32 package + + mkdir -p ${1}/EnhancedFAT/Root + mkdir -p ${1}/EnhancedFAT/Scripts/Tools + cp -f ${pkgroot}/Scripts/FAT/* ${1}/EnhancedFAT/Scripts + ditto --arch i386 `which SetFile` ${1}/EnhancedFAT/Scripts/Tools/SetFile + buildpackage "${1}/EnhancedFAT" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['Standardhfs']) && exclusive(choices['EnhancedHFS'])\"" + +# build efi hfs package + + mkdir -p ${1}/EnhancedHFS/Root + mkdir -p ${1}/EnhancedHFS/Scripts/Tools + cp -f ${pkgroot}/Scripts/HFS/* ${1}/EnhancedHFS/Scripts + ditto --arch i386 `which SetFile` ${1}/EnhancedHFS/Scripts/Tools/SetFile + buildpackage "${1}/EnhancedHFS" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['Standardhfs']) && exclusive(choices['EnhancedFAT'])\"" + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + +# build PrefPanel package + +# mkdir -p ${1}/PrefPanel/Root +# mkdir -p ${1}/PrefPanel/Root/Library/PreferencePanes +# cp -Rf ${pkgroot}/Configuration/Chameleon.prefPane ${1}/PrefPanel/Root/Library/PreferencePanes +# buildpackage "${1}/PrefPanel" "/" "${coresize}" "start_visible=\"true\" start_selected=\"false\"" + +# build utility package + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + packagesidentity="org.chameleon" + + # build package for bdmesg +# mkdir -p "${1}/bdmesg/Root" +# ditto --noextattr --noqtn "${1%/*}/i386/bdmesg" "${1}/bdmesg/Root" +# echo "Building bdmesg package" +# buildpackage "${1}/bdmesg" "/usr/sbin" "" "start_selected=\"false\"" + # End build package for bdmesg + + # build package for Chameleon PrefPanel + mkdir -p "${1}/PrefPanel/Root/" + ditto --noextattr --noqtn "${pkgroot}/Configuration/PrefPanel/Chameleon.prefPane" "${1}/PrefPanel/Root" + echo "Building Chameleon Preference Panel package" + buildpackage "${1}/PrefPanel" "/Library/PreferencePanes/Chameleon.prefPane" "" "start_selected=\"false\"" + # End build package for Chameleon PrefPanel + + # build package for SMBIOSDefault + mkdir -p "${1}/SMBIOSDefault/Root/" + ditto --noextattr --noqtn "${pkgroot}/Configuration/SMBIOSDefault/smbios.plist" "${1}/SMBIOSDefault/Root" + echo "Building SMBIOSDefault package" + buildpackage "${1}/SMBIOSDefault" "/Extra/Example" "" "start_selected=\"false\"" + # End build package for SMBIOSDefault + + # build package for EFIMounter + mkdir -p "${1}/EFIMounter/Root/" + ditto --noextattr --noqtn "${pkgroot}/Configuration/EFIMounter/EFI Mounter.app" "${1}/EFIMounter/Root" + echo "Building EFIMounter package" + buildpackage "${1}/EFIMounter" "/Applications/EFI Mounter.app" "" "start_selected=\"false\"" + # End build package for EFIMounter + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" +# End utility package + +# build Documentation package +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" +# choices[$((choicescount++))]="\n\n" +# ((xmlindent++)) +# packagesidentity="org.chameleon" + + # build package for Documentation +# mkdir -p "${1}/Documentation/Root" +# cp -f ${pkgroot}/doc/BootHelp.txt ${1}/Documentation/Root +# cp -f ${pkgroot}/doc/README ${1}/Documentation/Root +# cp -f ${pkgroot}/doc/Users_Guide0.5.pdf ${1}/Documentation/Root +# echo "Building Documentation package" +# buildpackage "${1}/Documentation" "/Documentation/Chameleon2RC5" "" "start_selected=\"false\"" + # End build package for bdmesg + +# ((xmlindent--)) +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" +# End utility package + +ß# build options packages + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + packagesidentity="org.chameleon" + options=($( find "${pkgroot}/Scripts/Options" -type d -depth 1 -not -name '.svn' )) + for (( i = 0 ; i < ${#options[@]} ; i++ )) + do + mkdir -p "${1}/${options[$i]##*/}/Root" + mkdir -p "${1}/${options[$i]##*/}/Scripts" + + ditto --noextattr --noqtn "${options[$i]}/postinstall" "${1}/${options[$i]##*/}/Scripts/postinstall" + + buildpackage "${1}/${options[$i]##*/}" "/" "" "start_selected=\"false\"" + done + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + +# build resolution packages + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + packagesidentity="org.chameleon.resolution" + resolutions=($( find "${pkgroot}/Scripts/Resolutions" -type d -depth 1 -not -name '.svn' )) + for (( i = 0 ; i < ${#resolutions[@]} ; i++ )) + do + mkdir -p "${1}/${resolutions[$i]##*/}/Root/" + mkdir -p "${1}/${resolutions[$i]##*/}/Scripts/" + ditto --noextattr --noqtn "${resolutions[$i]}/postinstall" "${1}/${resolutions[$i]##*/}/Scripts/postinstall" + + buildpackage "${1}/${resolutions[$i]##*/}" "/" "" "start_selected=\"false\"" + done + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + +# build theme packages + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + packagesidentity="org.chameleon.theme" + artwork="${1%/*}" + themes=($( find "${artwork%/*}/artwork/themes" -type d -depth 1 -not -name '.svn' )) + for (( i = 0 ; i < ${#themes[@]} ; i++ )) + do + theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' ) + mkdir -p "${1}/${theme}/Root/" + ditto --noextattr --noqtn "${themes[$i]}" "${1}/${themes[$i]##*/}/Root/${theme}" + find "${1}/${themes[$i]##*/}" -name '.DS_Store' -or -name '.svn' -exec rm -R {} \+ + find "${1}/${themes[$i]##*/}" -type f -exec chmod 644 {} \+ + + buildpackage "${1}/${theme}" "/.Chameleon/Extra/Themes" "" "start_selected=\"false\"" + rm -R -f "${1}/${i##*/}" + done + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + + ((xmlindent++)) + +# build kext packages + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + packagesidentity="org.chameleon" + kexts=($( find "${pkgroot}/Kexts" -type d -name '*.kext' -depth 1 )) + for (( i = 0 ; i < ${#kexts[@]} ; i++ )) + do + filename="${kexts[$i]##*/}" + mkdir -p "${1}/${filename%.kext}/Root/" + ditto --noextattr --noqtn --arch i386 "${kexts[$i]}" "${1}/${filename%.kext}/Root/${filename}" + find "${1}/${filename%.kext}" -name '.DS_Store' -or -name '.svn' -exec rm -R -f {} \; 2>/dev/null + fixperms "${1}/${filename%.kext}/Root/" + chown 501:20 "${1}/${filename%.kext}/Root/" + buildpackage "${1}/${filename%.kext}" "/.Chameleon/Extra/Extensions" "" "start_selected=\"false\"" + rm -R -f "${1}/${filename%.kext}" + done + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + +# build post install package + + mkdir -p ${1}/Post/Root + mkdir -p ${1}/Post/Scripts + cp -f ${pkgroot}/Scripts/Post/* ${1}/Post/Scripts + buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + +# build meta package + + makedistribution "${1}" "${2}" "${3}" "${4}" "${5}" + +# clean up + + rm -R -f "${1}" + +} + +fixperms () +{ + # $1 path + find "${1}" -type f -exec chmod 644 {} \; + find "${1}" -type d -exec chmod 755 {} \; + chown -R 0:0 "${1}" +} + +buildpackage () +{ +# $1 Path to package to build containing Root and or Scripts +# $2 Install Location +# $3 Size +# $4 Options + +if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then + + local packagename="${1##*/}" + local identifier=$( echo ${packagesidentity}.${packagename//_/.} | tr [:upper:] [:lower:] ) + find "${1}" -name '.DS_Store' -delete + local filecount=$( find "${1}/Root" | wc -l ) + if [ "${3}" ]; then + local installedsize="${3}" + else + local installedsize=$( du -hkc "${1}/Root" | tail -n1 | awk {'print $1'} ) + fi + local header="\n\n" + header+="\t\n" + rm -R -f "${1}/Temp" + + [ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp" + [ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom" + + if [ -d "${1}/Scripts" ]; then + header+="\t\n" + for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) ) + do + header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n" + done + header+="\t\n" + chown -R 0:0 "${1}/Scripts" + pushd "${1}/Scripts" >/dev/null + find . -print | cpio -o -z -H cpio > "../Temp/Scripts" + popd >/dev/null + fi + + header+="" + echo -e "${header}" > "${1}/Temp/PackageInfo" + pushd "${1}/Root" >/dev/null + find . -print | cpio -o -z -H cpio > "../Temp/Payload" + popd >/dev/null + pushd "${1}/Temp" >/dev/null + + xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none . + + popd >/dev/null + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + if [ "${4}" ]; then + local choiceoptions="${indent[$xmlindent]}${4}\n" + fi + choices[$((choicescount++))]="\n\t#${packagename// /}.pkg\n\n" + + rm -R -f "${1}" +fi +} + +makedistribution () +{ + rm -f "${1%/*}/${packagename// /}"*.pkg + + find "${1}" -type f -name '*.pkg' -depth 1 | while read component + do + mkdir -p "${1}/${packagename}/${component##*/}" + pushd "${1}/${packagename}/${component##*/}" >/dev/null + xar -x -f "${1%}/${component##*/}" + popd >/dev/null + done + + ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution" + ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources" + + find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null + + for (( i=0; i < ${#outline[*]} ; i++)); + do + echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution" + done + + for (( i=0; i < ${#choices[*]} ; i++)); + do + echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution" + done + + echo "" >> "${1}/${packagename}/Distribution" + + perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" `find "${1}/${packagename}/Resources" -type f` + perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" `find "${1}/${packagename}/Resources" -type f` + + stage=${stage/RC/Release Candidate } + stage=${stage/FINAL/2.0 Final} + perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" `find "${1}/${packagename}/Resources" -type f` + + find "${1}/${packagename}" -name '.DS_Store' -delete + pushd "${1}/${packagename}" >/dev/null + xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none . + popd >/dev/null + + md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} ) + echo "MD5 (${packagename// /}-${version}-r${revision}.pkg) = ${md5}" > "${1%/*}/${packagename// /}-${version}-r${revision}.pkg.md5" +} + +main "${1}" "${2}" "${3}" "${4}" "${5}" + Property changes on: trunk/PackageBuilder/buildpkg ___________________________________________________________________ Added: svn:executable + * Index: trunk/PackageBuilder/buildpkgTEST =================================================================== --- trunk/PackageBuilder/buildpkgTEST (revision 0) +++ trunk/PackageBuilder/buildpkgTEST (revision 129) @@ -0,0 +1,443 @@ +#!/bin/bash + +# $1 Path to store built package + +packagesidentity="org.chameleon" + +packagename="Chameleon" + +pkgroot="${0%/*}" + +#version=$( grep I386BOOT_CHAMELEONVERSION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' ) +version=$( cat version ) +stage=${version##*-} +revision=$( grep I386BOOT_CHAMELEONREVISION sym/i386/vers.h | awk '{ print $3 }' | tr -d '\"' ) +builddate=$( grep I386BOOT_BUILDDATE sym/i386/vers.h | awk '{ print $3,$4 }' | tr -d '\"' ) +timestamp=$( date -j -f "%Y-%m-%d %H:%M:%S" "${builddate}" "+%s" ) + +distributioncount=0 +xmlindent=0 + +indent[0]="\t" +indent[1]="\t\t" +indent[2]="\t\t\t" +indent[3]="\t\t\t\t" + +main () +{ + +# clean up the destination path + + rm -R -f "${1}" + + echo "Building $packagename Install Package v${version%%-*} $stage r$revision $builddate" + + outline[$((outlinecount++))]="${indent[$xmlindent]}" + +# build core package + + ((xmlindent++)) + packagesidentity="org.chameleon" + mkdir -p ${1}/Core/Root/usr/sbin +# mkdir -p ${1}/Core/Root/usr/local/bin + mkdir -p ${1}/Core/Root/usr/standalone/i386 +# mkdir -p ${1}/Core/Root/Extra + cp -f ${1%/*}/i386/boot ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot0 ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot0hfs ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot1f32 ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot1h ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot1he ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/boot1hp ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/cdboot ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/chain0 ${1}/Core/Root/usr/standalone/i386 + cp -f ${1%/*}/i386/bdmesg ${1}/Core/Root/usr/sbin + fixperms "${1}/Core/Root/" +# cp -Rf ${pkgroot}/Configuration/Chameleon.prefPane ${1}/Core/Root/Library/PreferencePanes +# cp -f ${pkgroot}/Configuration/smbios.plist ${1}/Core/Root/Extra + cp -f ${pkgroot}/fdisk440 ${1}/Core/Root/usr/sbin + local coresize=$( du -hkc "${1}/Core/Root" | tail -n1 | awk {'print $1'} ) + buildpackage "${1}/Core" "/" "0" "start_visible=\"false\" start_selected=\"true\"" + + +# build Chameleon package + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + +# build standard package + + mkdir -p ${1}/Standard/Root + mkdir -p ${1}/Standard/Scripts/Tools + cp -f ${pkgroot}/Scripts/Standard/* ${1}/Standard/Scripts + ditto --arch i386 `which SetFile` ${1}/Standard/Scripts/Tools/SetFile + buildpackage "${1}/Standard" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"upgrade_allowed()\" selected=\"exclusive(choices['EnhancedHFS']) && exclusive(choices['Standardhfs']) && exclusive(choices['EnhancedFAT'])\"" + +# build standard package with boot0hfs + + mkdir -p ${1}/Standardhfs/Root + mkdir -p ${1}/Standardhfs/Scripts/Tools + cp -f ${pkgroot}/Scripts/Standardhfs/* ${1}/Standardhfs/Scripts + ditto --arch i386 `which SetFile` ${1}/Standardhfs/Scripts/Tools/SetFile + buildpackage "${1}/Standardhfs" "/" "${coresize}" "start_enabled=\"true\" start_selected=\"false\" selected=\"exclusive(choices['EnhancedHFS']) && exclusive(choices['Standard']) && exclusive(choices['EnhancedFAT'])\"" + + +# build efi fat32 package + + mkdir -p ${1}/EnhancedFAT/Root + mkdir -p ${1}/EnhancedFAT/Scripts/Tools + cp -f ${pkgroot}/Scripts/FAT/* ${1}/EnhancedFAT/Scripts + ditto --arch i386 `which SetFile` ${1}/EnhancedFAT/Scripts/Tools/SetFile + buildpackage "${1}/EnhancedFAT" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['Standardhfs']) && exclusive(choices['EnhancedHFS'])\"" + +# build efi hfs package + + mkdir -p ${1}/EnhancedHFS/Root + mkdir -p ${1}/EnhancedHFS/Scripts/Tools + cp -f ${pkgroot}/Scripts/HFS/* ${1}/EnhancedHFS/Scripts + ditto --arch i386 `which SetFile` ${1}/EnhancedHFS/Scripts/Tools/SetFile + buildpackage "${1}/EnhancedHFS" "/" "${coresize}" "start_visible=\"systemHasGPT()\" start_selected=\"false\" selected=\"exclusive(choices['Standard']) && exclusive(choices['Standardhfs']) && exclusive(choices['EnhancedFAT'])\"" + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + +# build PrefPanel package + +# mkdir -p ${1}/PrefPanel/Root +# mkdir -p ${1}/PrefPanel/Root/Library/PreferencePanes +# cp -Rf ${pkgroot}/Configuration/Chameleon.prefPane ${1}/PrefPanel/Root/Library/PreferencePanes +# buildpackage "${1}/PrefPanel" "/" "${coresize}" "start_visible=\"true\" start_selected=\"false\"" + +# build utility package + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + packagesidentity="org.chameleon" + + # build package for bdmesg +# mkdir -p "${1}/bdmesg/Root" +# ditto --noextattr --noqtn "${1%/*}/i386/bdmesg" "${1}/bdmesg/Root" +# echo "Building bdmesg package" +# buildpackage "${1}/bdmesg" "/usr/sbin" "" "start_selected=\"false\"" + # End build package for bdmesg + + # build package for Chameleon PrefPanel + mkdir -p "${1}/PrefPanel/Root/" + ditto --noextattr --noqtn "${pkgroot}/Configuration/PrefPanel/Chameleon.prefPane" "${1}/PrefPanel/Root" + echo "Building Chameleon Preference Panel package" + buildpackage "${1}/PrefPanel" "/Library/PreferencePanes/Chameleon.prefPane" "" "start_selected=\"false\"" + # End build package for Chameleon PrefPanel + + # build package for SMBIOSDefault + mkdir -p "${1}/SMBIOSDefault/Root/" + ditto --noextattr --noqtn "${pkgroot}/Configuration/SMBIOSDefault/smbios.plist" "${1}/SMBIOSDefault/Root" + echo "Building SMBIOSDefault package" + buildpackage "${1}/SMBIOSDefault" "/Extra/Example" "" "start_selected=\"false\"" + # End build package for SMBIOSDefault + + # build package for EFIMounter + mkdir -p "${1}/EFIMounter/Root/" + ditto --noextattr --noqtn "${pkgroot}/Configuration/EFIMounter/EFI Mounter.app" "${1}/EFIMounter/Root" + echo "Building EFIMounter package" + buildpackage "${1}/EFIMounter" "/Applications/EFI Mounter.app" "" "start_selected=\"false\"" + # End build package for EFIMounter + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" +# End utility package + +# build Documentation package +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" +# choices[$((choicescount++))]="\n\n" +# ((xmlindent++)) +# packagesidentity="org.chameleon" + + # build package for Documentation +# mkdir -p "${1}/Documentation/Root" +# cp -f ${pkgroot}/doc/BootHelp.txt ${1}/Documentation/Root +# cp -f ${pkgroot}/doc/README ${1}/Documentation/Root +# cp -f ${pkgroot}/doc/Users_Guide0.5.pdf ${1}/Documentation/Root +# echo "Building Documentation package" +# buildpackage "${1}/Documentation" "/Documentation/Chameleon2RC5" "" "start_selected=\"false\"" + # End build package for bdmesg + +# ((xmlindent--)) +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" +# End utility package + +# build options packages + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + packagesidentity="org.chameleon.options" + options=($( find "${pkgroot}/Scripts/Options" -type d -depth 1 -not -name '.svn' )) + for (( i = 0 ; i < ${#options[@]} ; i++)) + + do + packagesidentity="org.chameleon.${#options[@]}" + flagname=($( find "${options[$i]}" -type d -depth 1 -not -name '.svn' )) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + for (( j = 0 ; j < ${#flagname[@]} ; j++)) + + do + packagesidentity="org.chameleon.${#flagname[@]}" +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + mkdir -p "${1}/${options[$i]##*/}${flagname[$j]##*/}/Root" + mkdir -p "${1}/${options[$i]##*/}${flagname[$j]##*/}/Scripts" + cp -f "${flagname[$j]}/postinstall" "${1}/${options[$i]##*/}${flagname[$j]##*/}/Scripts" + echo "Building ${options[$i]##*/}${flagname[$j]##*/} package" + buildpackage "${1}/${options[$i]##*/}${flagname[$j]##*/}" "/" "" "start_selected=\"false\"" + rm -R -f "${1}/${j##*/}" + ((xmlindent--)) +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + done + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + echo "Building ${options[$i]##*/} package" + buildpackage "${1}/${options[$i]##*/}" "/" "" "start_selected=\"false\"" + rm -R -f "${1}/${i##*/}" + done + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" +# End build options packages + +# build options packages + +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" +# choices[$((choicescount++))]="\n\n" +# ((xmlindent++)) +# packagesidentity="org.chameleon" +# options=($( find "${pkgroot}/Scripts/Options" -type d -depth 1 -not -name '.svn' )) +# for (( i = 0 ; i < ${#options[@]} ; i++ )) +# do +# mkdir -p "${1}/${options[$i]##*/}/Root" +# mkdir -p "${1}/${options[$i]##*/}/Scripts" +# +# ditto --noextattr --noqtn "${options[$i]}/postinstall" "${1}/${options[$i]##*/}/Scripts/postinstall" + +# buildpackage "${1}/${options[$i]##*/}" "/" "" "start_selected=\"false\"" +# done + +# ((xmlindent--)) +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + +# build resolution packages + +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" +# choices[$((choicescount++))]="\n\n" +# ((xmlindent++)) +# packagesidentity="org.chameleon.resolution" +# resolutions=($( find "${pkgroot}/Scripts/Resolutions" -type d -depth 1 -not -name '.svn' )) +# for (( i = 0 ; i < ${#resolutions[@]} ; i++ )) +# do +# mkdir -p "${1}/${resolutions[$i]##*/}/Root/" +# mkdir -p "${1}/${resolutions[$i]##*/}/Scripts/" +# ditto --noextattr --noqtn "${resolutions[$i]}/postinstall" "${1}/${resolutions[$i]##*/}/Scripts/postinstall" + +# buildpackage "${1}/${resolutions[$i]##*/}" "/" "" "start_selected=\"false\"" +# done + +# ((xmlindent--)) +# outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + +# build theme packages + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + packagesidentity="org.chameleon.theme" + artwork="${1%/*}" + themes=($( find "${artwork%/*}/artwork/themes" -type d -depth 1 -not -name '.svn' )) + for (( i = 0 ; i < ${#themes[@]} ; i++ )) + do + theme=$( echo ${themes[$i]##*/} | awk 'BEGIN{OFS=FS=""}{$1=toupper($1);print}' ) + mkdir -p "${1}/${theme}/Root/" + ditto --noextattr --noqtn "${themes[$i]}" "${1}/${themes[$i]##*/}/Root/${theme}" + find "${1}/${themes[$i]##*/}" -name '.DS_Store' -or -name '.svn' -exec rm -R {} \+ + find "${1}/${themes[$i]##*/}" -type f -exec chmod 644 {} \+ + + buildpackage "${1}/${theme}" "/.Chameleon/Extra/Themes" "" "start_selected=\"false\"" + rm -R -f "${1}/${i##*/}" + done + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + + ((xmlindent++)) + +# build kext packages + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + choices[$((choicescount++))]="\n\n" + ((xmlindent++)) + packagesidentity="org.chameleon" + kexts=($( find "${pkgroot}/Kexts" -type d -name '*.kext' -depth 1 )) + for (( i = 0 ; i < ${#kexts[@]} ; i++ )) + do + filename="${kexts[$i]##*/}" + mkdir -p "${1}/${filename%.kext}/Root/" + ditto --noextattr --noqtn --arch i386 "${kexts[$i]}" "${1}/${filename%.kext}/Root/${filename}" + find "${1}/${filename%.kext}" -name '.DS_Store' -or -name '.svn' -exec rm -R -f {} \; 2>/dev/null + fixperms "${1}/${filename%.kext}/Root/" + chown 501:20 "${1}/${filename%.kext}/Root/" + buildpackage "${1}/${filename%.kext}" "/.Chameleon/Extra/Extensions" "" "start_selected=\"false\"" + rm -R -f "${1}/${filename%.kext}" + done + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + ((xmlindent--)) + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + +# build post install package + + mkdir -p ${1}/Post/Root + mkdir -p ${1}/Post/Scripts + cp -f ${pkgroot}/Scripts/Post/* ${1}/Post/Scripts + buildpackage "${1}/Post" "/" "" "start_visible=\"false\" start_selected=\"true\"" + outline[$((outlinecount++))]="${indent[$xmlindent]}" + +# build meta package + + makedistribution "${1}" "${2}" "${3}" "${4}" "${5}" + +# clean up + + rm -R -f "${1}" + +} + +fixperms () +{ + # $1 path + find "${1}" -type f -exec chmod 644 {} \; + find "${1}" -type d -exec chmod 755 {} \; + chown -R 0:0 "${1}" +} + +buildpackage () +{ +# $1 Path to package to build containing Root and or Scripts +# $2 Install Location +# $3 Size +# $4 Options + +if [ -d "${1}/Root" ] && [ "${1}/Scripts" ]; then + + local packagename="${1##*/}" + local identifier=$( echo ${packagesidentity}.${packagename//_/.} | tr [:upper:] [:lower:] ) + find "${1}" -name '.DS_Store' -delete + local filecount=$( find "${1}/Root" | wc -l ) + if [ "${3}" ]; then + local installedsize="${3}" + else + local installedsize=$( du -hkc "${1}/Root" | tail -n1 | awk {'print $1'} ) + fi + local header="\n\n" + header+="\t\n" + rm -R -f "${1}/Temp" + + [ -d "${1}/Temp" ] || mkdir -m 777 "${1}/Temp" + [ -d "${1}/Root" ] && mkbom "${1}/Root" "${1}/Temp/Bom" + + if [ -d "${1}/Scripts" ]; then + header+="\t\n" + for script in $( find "${1}/Scripts" -type f \( -name 'pre*' -or -name 'post*' \) ) + do + header+="\t\t<${script##*/} file=\"./${script##*/}\"/>\n" + done + header+="\t\n" + chown -R 0:0 "${1}/Scripts" + pushd "${1}/Scripts" >/dev/null + find . -print | cpio -o -z -H cpio > "../Temp/Scripts" + popd >/dev/null + fi + + header+="" + echo -e "${header}" > "${1}/Temp/PackageInfo" + pushd "${1}/Root" >/dev/null + find . -print | cpio -o -z -H cpio > "../Temp/Payload" + popd >/dev/null + pushd "${1}/Temp" >/dev/null + + xar -c -f "${1%/*}/${packagename// /}.pkg" --compression none . + + popd >/dev/null + + outline[$((outlinecount++))]="${indent[$xmlindent]}\t" + + if [ "${4}" ]; then + local choiceoptions="${indent[$xmlindent]}${4}\n" + fi + choices[$((choicescount++))]="\n\t#${packagename// /}.pkg\n\n" + + rm -R -f "${1}" +fi +} + +makedistribution () +{ + rm -f "${1%/*}/${packagename// /}"*.pkg + + find "${1}" -type f -name '*.pkg' -depth 1 | while read component + do + mkdir -p "${1}/${packagename}/${component##*/}" + pushd "${1}/${packagename}/${component##*/}" >/dev/null + xar -x -f "${1%}/${component##*/}" + popd >/dev/null + done + + ditto --noextattr --noqtn "${pkgroot}/Distribution" "${1}/${packagename}/Distribution" + ditto --noextattr --noqtn "${pkgroot}/Resources" "${1}/${packagename}/Resources" + + find "${1}/${packagename}/Resources" -type d -name '.svn' -exec rm -R -f {} \; 2>/dev/null + + for (( i=0; i < ${#outline[*]} ; i++)); + do + echo -e "${outline[$i]}" >> "${1}/${packagename}/Distribution" + done + + for (( i=0; i < ${#choices[*]} ; i++)); + do + echo -e "${choices[$i]}" >> "${1}/${packagename}/Distribution" + done + + echo "" >> "${1}/${packagename}/Distribution" + + perl -i -p -e "s/%CHAMELEONVERSION%/${version%%-*}/g" `find "${1}/${packagename}/Resources" -type f` + perl -i -p -e "s/%CHAMELEONREVISION%/${revision}/g" `find "${1}/${packagename}/Resources" -type f` + + stage=${stage/RC/Release Candidate } + stage=${stage/FINAL/2.0 Final} + perl -i -p -e "s/%CHAMELEONSTAGE%/${stage}/g" `find "${1}/${packagename}/Resources" -type f` + + find "${1}/${packagename}" -name '.DS_Store' -delete + pushd "${1}/${packagename}" >/dev/null + xar -c -f "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" --compression none . + popd >/dev/null + + md5=$( md5 "${1%/*}/${packagename// /}-${version}-r${revision}.pkg" | awk {'print $4'} ) + echo "MD5 (${packagename// /}-${version}-r${revision}.pkg) = ${md5}" > "${1%/*}/${packagename// /}-${version}-r${revision}.pkg.md5" +} + +main "${1}" "${2}" "${3}" "${4}" "${5}" + Property changes on: trunk/PackageBuilder/buildpkgTEST ___________________________________________________________________ Added: svn:executable + * Index: trunk/PackageBuilder/smbios.plist =================================================================== --- trunk/PackageBuilder/smbios.plist (revision 0) +++ trunk/PackageBuilder/smbios.plist (revision 129) @@ -0,0 +1,48 @@ + + + + + SMbiosversion + MP31.88Z.00C1.B00.0802091544 + SMmanufacter + Apple Inc. + SMproductname + MacPro3,1 + SMsystemversion + 1.0 + SMserial + W87234JHYA4 + SMexternalclock + 333 + SMmaximalclock + 3000 + SMmemtype + 19 + SMmemspeed + 800 + SMmemmanufacter_1 + 0xAD00000000000000 + SMmemserial_1 + 0x00001020 + SMmempart_1 + 0x48594D503131325336344350362D59352020 + SMmemmanufacter_2 + 0xAD00000000000000 + SMmemserial_2 + 0x00003021 + SMmempart_2 + 0x48594D503131325336344350362D59352020 + SMmemmanufacter_3 + 0xAD00000000000000 + SMmemserial_3 + 0x00003021 + SMmempart_3 + 0x48594D503131325336344350362D59352020 + SMmemmanufacter_4 + 0xAD00000000000000 + SMmemserial_4 + 0x00003021 + SMmempart_4 + 0x48594D503131325336344350362D59352020 + + Index: trunk/PackageBuilder/fdisk440 =================================================================== Cannot display: file marked as a binary type. svn:mime-type = application/octet-stream Property changes on: trunk/PackageBuilder/fdisk440 ___________________________________________________________________ Added: svn:executable + * Added: svn:mime-type + application/octet-stream Index: trunk/PackageBuilder/com.apple.Boot.plist =================================================================== --- trunk/PackageBuilder/com.apple.Boot.plist (revision 0) +++ trunk/PackageBuilder/com.apple.Boot.plist (revision 129) @@ -0,0 +1,80 @@ + + + + + Kernel + mach_kernel + Kernel Flags + cpus=4 blacklist=0 busratio=20 -v -f + arch + i386 + PciRoot + 0 + Graphics Mode + 1920x1080x32 + GraphicsEnabler + No + UseNvidiaROM + Yes + UseAtiROM + Yes + VBIOS + Yes + GUI + Yes + Theme + Default + Legacy Logo + No + Boot Banner + Yes + Default Partition + hd(0,2) + Hide Partition + + DropSSDT + Yes + GenerateCStates + Yes + GeneratePStates + Yes + Rescan + No + DSDT + /Extra/dsdt.aml + SMBIOS + /Extra/smbios.plist + SMBIOSdefaults + No + SystemId + uuid here + SystemType + 1 + Instant Menu + No + Quiet Boot + No + Timeout + 2 + EthernetBuiltIn + Yes + RestartFix + Yes + forceHPET + No + EHCIacquire + No + UHCIreset + No + USBBusFix + No + Wait + No + Wake + No + ForceWake + No + device-properties + + +