* Added second parameter to AddDirectoryToHaikuImage, a list of resource
(or rdef) files which will be converted to attributes and added to the installed directory. Adjusted build_haiku_image script accordingly. * Added directory data/image_directories, which is where the resource files for the directories attributes shall be stored. As naming convention I suggest using the target directory path with slashes replaced by hyphens, e.g. home-config-bin.rdef for home/config/bin. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21711 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
+48
-5
@@ -108,6 +108,7 @@ rule AddDirectoryToContainer container : directoryTokens
|
|||||||
if ! [ on $(directory) return $(__is_on_image) ] {
|
if ! [ on $(directory) return $(__is_on_image) ] {
|
||||||
HAIKU_INSTALL_DIRECTORIES on $(container) += $(directory) ;
|
HAIKU_INSTALL_DIRECTORIES on $(container) += $(directory) ;
|
||||||
__is_on_image on $(directory) = true ;
|
__is_on_image on $(directory) = true ;
|
||||||
|
DIRECTORY_TOKENS on $(directory) = $(directoryTokens) ;
|
||||||
NotFile $(directory) ;
|
NotFile $(directory) ;
|
||||||
|
|
||||||
# mark the parent dir as not to be created
|
# mark the parent dir as not to be created
|
||||||
@@ -298,20 +299,48 @@ rule CreateContainerMakeDirectoriesScript container : script
|
|||||||
LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ;
|
LOCATE on $(scriptBody) = [ on $(script) return $(LOCATE) ] ;
|
||||||
Depends $(scriptBody) : $(initScript) ;
|
Depends $(scriptBody) : $(initScript) ;
|
||||||
Depends $(script) : $(scriptBody) ;
|
Depends $(script) : $(scriptBody) ;
|
||||||
|
|
||||||
|
# collect the directories to create
|
||||||
local dirsToCreate ;
|
local dirsToCreate ;
|
||||||
|
local directories = [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] ;
|
||||||
local dir ;
|
local dir ;
|
||||||
for dir in [ on $(container) return $(HAIKU_INSTALL_DIRECTORIES) ] {
|
for dir in $(directories) {
|
||||||
if ! [ on $(dir) return $(DONT_CREATE) ] {
|
if ! [ on $(dir) return $(DONT_CREATE) ] {
|
||||||
dirsToCreate += $(dir) ;
|
dirsToCreate += $(dir) ;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Depends $(scriptBody) : $(dirsToCreate) ;
|
|
||||||
# If the image shall only be updated, we don't create directories.
|
# If the image shall only be updated, we don't create directories.
|
||||||
if $(dirsToCreate)
|
if $(dirsToCreate)
|
||||||
&& ! [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] {
|
&& ! [ on $(container) return $(HAIKU_CONTAINER_UPDATE_ONLY) ] {
|
||||||
|
Depends $(scriptBody) : $(dirsToCreate) ;
|
||||||
CreateContainerMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ;
|
CreateContainerMakeDirectoriesScript1 $(scriptBody) : $(dirsToCreate) ;
|
||||||
|
|
||||||
|
# For directories with attributes, we convert those the specified
|
||||||
|
# resource files to files with attributes and add commands to the script
|
||||||
|
# adding the attributes to the directories.
|
||||||
|
for dir in $(directories) {
|
||||||
|
local resourceFiles = [ on $(dir) return $(ATTRIBUTE_FILES) ] ;
|
||||||
|
if $(resourceFiles) {
|
||||||
|
local dirTokens = [ on $(dir) return $(DIRECTORY_TOKENS) ] ;
|
||||||
|
|
||||||
|
# translate resources file to file with attributes
|
||||||
|
local attributeFile = $(script)-attributes-$(dirTokens:J=-) ;
|
||||||
|
ResAttr $(attributeFile) : $(resourceFiles) ;
|
||||||
|
|
||||||
|
# use a unique dummy target for this file, on which we
|
||||||
|
# can define the TARGET_DIR variable
|
||||||
|
local dummyTarget = $(script)-attributes-dummy-$(dir:G=) ;
|
||||||
|
NotFile $(dummyTarget) ;
|
||||||
|
TARGET_DIR on $(dummyTarget) = $(dir:G=) ;
|
||||||
|
|
||||||
|
Depends $(dummyTarget) : $(initScript) $(attributeFile) ;
|
||||||
|
Depends $(script) : $(dummyTarget) ;
|
||||||
|
|
||||||
|
AppendToContainerMakeDirectoriesScriptAttributes $(dummyTarget)
|
||||||
|
: $(initScript) $(attributeFile) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -320,6 +349,12 @@ actions piecemeal CreateContainerMakeDirectoriesScript1
|
|||||||
echo \$mkdir -p "\"\${tPrefix}$(2:G=)\"" >> $(1)
|
echo \$mkdir -p "\"\${tPrefix}$(2:G=)\"" >> $(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
actions AppendToContainerMakeDirectoriesScriptAttributes
|
||||||
|
{
|
||||||
|
echo \$copyAttrs "\"\${sPrefix}$(2[2])\"" \
|
||||||
|
"\"\${tPrefix}$(TARGET_DIR)\"" >> $(2[1])
|
||||||
|
}
|
||||||
|
|
||||||
rule CreateContainerCopyFilesScript container : script
|
rule CreateContainerCopyFilesScript container : script
|
||||||
{
|
{
|
||||||
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
MakeLocate $(script) : $(HAIKU_OUTPUT_DIR) ;
|
||||||
@@ -418,12 +453,20 @@ rule IsUpdateHaikuImageOnly
|
|||||||
on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_CONTAINER_UPDATE_ONLY) ;
|
on $(HAIKU_IMAGE_CONTAINER_NAME) return $(HAIKU_CONTAINER_UPDATE_ONLY) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
rule AddDirectoryToHaikuImage directoryTokens
|
rule AddDirectoryToHaikuImage directoryTokens : attributeFiles
|
||||||
{
|
{
|
||||||
# AddDirectoryToHaikuImage <directoryTokens>
|
# AddDirectoryToHaikuImage <directoryTokens>
|
||||||
|
|
||||||
return [ AddDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
local dir = [ AddDirectoryToContainer $(HAIKU_IMAGE_CONTAINER_NAME)
|
||||||
: $(directoryTokens) ] ;
|
: $(directoryTokens) ] ;
|
||||||
|
|
||||||
|
if $(attributeFiles) {
|
||||||
|
SEARCH on $(attributeFiles)
|
||||||
|
+= [ FDirName $(HAIKU_TOP) data image_directories ] ;
|
||||||
|
ATTRIBUTE_FILES on $(dir) += $(attributeFiles) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $(dir) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
rule AddFilesToHaikuImage directory : targets : destName
|
rule AddFilesToHaikuImage directory : targets : destName
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ if [ $isImage ]; then
|
|||||||
cd="$fsShellCommand cd"
|
cd="$fsShellCommand cd"
|
||||||
scd="$fsShellCommand cd"
|
scd="$fsShellCommand cd"
|
||||||
cp="$fsShellCommand cp"
|
cp="$fsShellCommand cp"
|
||||||
|
copyAttrs="$fsShellCommand cp -a"
|
||||||
ln="$fsShellCommand ln"
|
ln="$fsShellCommand ln"
|
||||||
mkdir="$fsShellCommand mkdir"
|
mkdir="$fsShellCommand mkdir"
|
||||||
rm="$fsShellCommand rm"
|
rm="$fsShellCommand rm"
|
||||||
@@ -45,6 +46,7 @@ else
|
|||||||
cd=cd
|
cd=cd
|
||||||
scd=:
|
scd=:
|
||||||
cp="$copyattr -d"
|
cp="$copyattr -d"
|
||||||
|
copyAttrs="$copyattr"
|
||||||
ln=ln
|
ln=ln
|
||||||
mkdir=mkdir
|
mkdir=mkdir
|
||||||
rm=rm
|
rm=rm
|
||||||
|
|||||||
Reference in New Issue
Block a user