diff --git a/build/jam/HaikuImage b/build/jam/HaikuImage index efd0563d09..cd7dfc2667 100644 --- a/build/jam/HaikuImage +++ b/build/jam/HaikuImage @@ -461,6 +461,7 @@ AddTargetVariableToScript $(script) : fs_shell_command : fsShellCommand ; AddTargetVariableToScript $(script) : copyattr ; AddTargetVariableToScript $(script) : create_image : createImage ; AddTargetVariableToScript $(script) : makebootable ; +AddTargetVariableToScript $(script) : package ; AddTargetVariableToScript $(script) : rc ; AddTargetVariableToScript $(script) : resattr ; AddTargetVariableToScript $(script) : unzip ; @@ -475,6 +476,16 @@ if $(optionalPackageDescriptions) { : optionalPackageDescriptions ; } +# add a variable "packages" with the packages copied/updated +local container = $(HAIKU_IMAGE_CONTAINER_NAME) ; +local packages = [ on $(container) return $(HAIKU_PACKAGES_IN_IMAGE) ] ; +if [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] + && ! [ IncludeAllTargetsInContainer $(container) ] { + packages = [ FilterContainerUpdateTargets $(packages) + : HAIKU_INCLUDE_IN_IMAGE ] ; +} + +AddTargetVariableToScript $(script) : $(packages) : packages ; # create the other scripts HAIKU_IMAGE_MAKE_DIRS_SCRIPT = haiku.image-make-dirs ; diff --git a/build/jam/ImageRules b/build/jam/ImageRules index 11eff03b2c..cabfbbb5d9 100644 --- a/build/jam/ImageRules +++ b/build/jam/ImageRules @@ -883,6 +883,9 @@ rule AddBootModuleSymlinksToHaikuImage targets rule AddPackageFilesToHaikuImage location : packages { + HAIKU_PACKAGES_IN_IMAGE on $(HAIKU_IMAGE_CONTAINER_NAME) + = [ on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_PACKAGES_IN_IMAGE) ] + $(packages) ; AddFilesToHaikuImage $(location) packages : $(packages) ; } diff --git a/build/scripts/build_haiku_image b/build/scripts/build_haiku_image index 1025c4bf7b..727e1fb9af 100755 --- a/build/scripts/build_haiku_image +++ b/build/scripts/build_haiku_image @@ -6,6 +6,7 @@ set -o errexit # outputDir # tmpDir # addBuildCompatibilityLibDir +# packages - a list of the hpkg packages copied/updated # The following are only for image types: # installDir # isImage @@ -20,6 +21,7 @@ set -o errexit # # addattr # copyattr +# package # rc # rmAttrs # unzip @@ -158,7 +160,7 @@ stripDebugInfo() extractFile() { - # extractFile + # extractFile archiveFile=$1 targetExtractedDir=$2 extractedSubDir=$3 @@ -177,11 +179,17 @@ extractFile() tar -C "$extractDir" -xf "$archiveFile" ;; *.hpkg) - echo "Adding package $archiveFile ..." - cp "$archiveFile" "$extractDir" + echo "Extracting $archiveFile ..." + if [ -n "$extractedSubDir" ]; then + $package extract -C "$extractDir" "$archiveFile" \ + "$extractedSubDir" + else + $package extract -C "$extractDir" "$archiveFile" + fi ;; *) - echo "Unhandled archive extension in build_haiku_image extractFile()" + echo "Unhandled archive extension in build_haiku_image" \ + "extractFile()" exit 1 ;; esac @@ -210,7 +218,8 @@ extractFile() fi fi - $cp -r "${sPrefix}$extractDir/$extractedSubDir/." "${tPrefix}$targetExtractedDir" + $cp -r "${sPrefix}$extractDir/$extractedSubDir/." \ + "${tPrefix}$targetExtractedDir" $rmAttrs -rf "$extractDir" } @@ -277,6 +286,14 @@ while [ $# -gt 0 ]; do done +# install default settings for packages +for packageFile in $packages; do + if $package list -p $packageFile | egrep '^settings/' > /dev/null; then + extractFile $packageFile common/settings settings + fi +done + + # install MIME database # TODO: It should be possible to do that in the build system too.