Extract packages' settings dir to common/settings in image

That's a somewhat crude initial approach to installing the default
settings of packages when building the image.
This commit is contained in:
Ingo Weinhold 2013-04-29 19:38:29 +02:00
parent 330cb41ef5
commit e0f7f688f1
3 changed files with 36 additions and 5 deletions

View File

@ -461,6 +461,7 @@ AddTargetVariableToScript $(script) : <build>fs_shell_command : fsShellCommand ;
AddTargetVariableToScript $(script) : <build>copyattr ;
AddTargetVariableToScript $(script) : <build>create_image : createImage ;
AddTargetVariableToScript $(script) : <build>makebootable ;
AddTargetVariableToScript $(script) : <build>package ;
AddTargetVariableToScript $(script) : <build>rc ;
AddTargetVariableToScript $(script) : <build>resattr ;
AddTargetVariableToScript $(script) : <build>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 = <HaikuImage>haiku.image-make-dirs ;

View File

@ -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) ;
}

View File

@ -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 <archive> <directory>
# extractFile <archive> <directory> <extractedSubDir>
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.