Unified build_haiku_[cd|image] scripts. Fixes #5490.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36123 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
732c9b3eb8
commit
218aa6d9e8
@ -2,7 +2,7 @@ rule BuildHaikuCD haikuCD : bootFloppy : scripts
|
||||
{
|
||||
# BuildHaikuCD <haiku cd> : <bootFloppy> : <scripts> ;
|
||||
|
||||
local mainScript = build_haiku_cd ;
|
||||
local mainScript = build_haiku_image ;
|
||||
SEARCH on $(mainScript) = [ FDirName $(HAIKU_TOP) build scripts ] ;
|
||||
|
||||
Depends $(haikuCD) : $(mainScript) $(scripts) ;
|
||||
|
@ -17,6 +17,7 @@ Always $(script) ;
|
||||
AddVariableToScript $(script) : sourceDir : $(HAIKU_TOP) ;
|
||||
AddVariableToScript $(script) : outputDir : $(HAIKU_OUTPUT_DIR) ;
|
||||
AddVariableToScript $(script) : tmpDir : $(HAIKU_TMP_DIR) ;
|
||||
AddVariableToScript $(script) : isCD : 1 ;
|
||||
AddVariableToScript $(script) : cdLabel : $(HAIKU_CD_LABEL) ;
|
||||
AddVariableToScript $(script) : addBuildCompatibilityLibDir
|
||||
: $(HOST_ADD_BUILD_COMPATIBILITY_LIB_DIR) ;
|
||||
|
@ -1,166 +0,0 @@
|
||||
#!/bin/sh
|
||||
set -o errexit
|
||||
|
||||
# The first argument is the shell script that initializes the variables:
|
||||
# sourceDir
|
||||
# outputDir
|
||||
# tmpDir
|
||||
# addBuildCompatibilityLibDir
|
||||
#
|
||||
# addattr
|
||||
# copyattr
|
||||
# resattr
|
||||
# rc
|
||||
# rmAttrs
|
||||
# unzip
|
||||
# generate_attribute_stores
|
||||
#
|
||||
if [ $# -gt 0 ]; then
|
||||
. $1
|
||||
shift
|
||||
fi
|
||||
|
||||
# this adds the build library dir to LD_LIBRARY_PATH
|
||||
eval "$addBuildCompatibilityLibDir"
|
||||
|
||||
outputDir=$tmpDir/cdsource
|
||||
|
||||
sPrefix=
|
||||
tPrefix="$outputDir/"
|
||||
cd=cd
|
||||
scd=:
|
||||
cp="$copyattr -d"
|
||||
copyAttrs="$copyattr"
|
||||
ln=ln
|
||||
mkdir=mkdir
|
||||
rm=rm
|
||||
|
||||
|
||||
extractFile()
|
||||
{
|
||||
# extractFile <archive> <directory>
|
||||
archiveFile=$1
|
||||
targetExtractDir=$2
|
||||
extractedSubDir=$3
|
||||
|
||||
echo "Extracting $archiveFile ..."
|
||||
|
||||
extractDir=$tmpDir/extract
|
||||
$rmAttrs -rf "$extractDir"
|
||||
mkdir -p "$extractDir"
|
||||
|
||||
case "$archiveFile" in
|
||||
*.zip)
|
||||
$unzip -q -d "$extractDir" "$archiveFile"
|
||||
;;
|
||||
*.tgz|*.tar.gz)
|
||||
tar -C "$extractDir" -xf "$archiveFile"
|
||||
;;
|
||||
*)
|
||||
echo "Unhandled archive extension in build_haiku_image extractFile()"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -f $extractDir/.OptionalPackageDescription ]; then
|
||||
cat $extractDir/.OptionalPackageDescription >> $copyrightsFile
|
||||
echo >> $copyrightsFile
|
||||
rm $extractDir/.OptionalPackageDescription
|
||||
fi
|
||||
|
||||
$cp -r "$extractDir/$extractedSubDir/." "${tPrefix}$targetExtractDir"
|
||||
|
||||
$rmAttrs -rf "$extractDir"
|
||||
}
|
||||
|
||||
|
||||
mkdir -p $tmpDir
|
||||
copyrightsFile=$tmpDir/copyrights
|
||||
$rmAttrs -f $copyrightsFile
|
||||
if [ "$optionalPackageDescriptions" ]; then
|
||||
cp "$optionalPackageDescriptions" $copyrightsFile
|
||||
fi
|
||||
|
||||
# setup output dir
|
||||
$rmAttrs -rf "$outputDir"
|
||||
mkdir -p "$outputDir"
|
||||
|
||||
echo "Populating CD ..."
|
||||
while [ $# -gt 0 ]; do
|
||||
. $1
|
||||
shift
|
||||
done
|
||||
|
||||
|
||||
# install MIME database
|
||||
# TODO: It should be possible to do that in the build system too.
|
||||
|
||||
mimeDBSource=$sourceDir/src/data/beos_mime
|
||||
mimeDBDest=${tPrefix}home/config/settings/beos_mime
|
||||
|
||||
$rm -rf $mimeDBDest
|
||||
$mkdir -p $mimeDBDest
|
||||
mimeTmpDir=$tmpDir/mime
|
||||
mimeDBTmpDir=$tmpDir/mime/db
|
||||
mimeTmpIndex=0
|
||||
mimeTmpFile=$mimeTmpDir/mimedb$$.rsrc
|
||||
|
||||
# create tmp dir for the MIME conversion stuff
|
||||
mkdir -p $mimeDBTmpDir
|
||||
|
||||
echo "Installing MIME database ..."
|
||||
|
||||
for inSuperFile in $mimeDBSource/*.super; do
|
||||
superType=$(basename $inSuperFile .super)
|
||||
tmpSuperDir=$mimeDBTmpDir/$superType
|
||||
|
||||
# compile rdef to rsrc file and the rsrc file to attributes
|
||||
$rc -o $mimeTmpFile $inSuperFile
|
||||
mkdir -p $tmpSuperDir
|
||||
$resattr -O -o $tmpSuperDir $mimeTmpFile
|
||||
$rmAttrs $mimeTmpFile
|
||||
|
||||
# iterate through the sub types
|
||||
for inSubFile in $mimeDBSource/$superType/*; do
|
||||
# check, if the type exists
|
||||
if test -f $inSubFile && grep META:TYPE $inSubFile > /dev/null 2>&1 ; then
|
||||
subType=$(basename $inSubFile)
|
||||
tmpSubFile=$mimeDBTmpDir/$superType/$subType
|
||||
|
||||
# compile rdef to rsrc file and the rsrc file to attributes
|
||||
$rc -o $mimeTmpFile $inSubFile
|
||||
$resattr -O -o $tmpSubFile $mimeTmpFile
|
||||
$rmAttrs $mimeTmpFile
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
$cp -r $mimeDBTmpDir/. $mimeDBDest
|
||||
|
||||
# cleanup tmp dir
|
||||
$rmAttrs -rf $mimeTmpDir
|
||||
|
||||
|
||||
# add the concatenated copyrights as an attribute to AboutSystem
|
||||
|
||||
if [ -f $copyrightsFile ]; then
|
||||
copyrightAttrs=$tmpDir/copyrightAttrs
|
||||
$rmAttrs -f $copyrightAttrs
|
||||
touch $copyrightAttrs
|
||||
$addattr -f $copyrightsFile COPYRIGHTS $copyrightAttrs
|
||||
$copyAttrs $copyrightAttrs ${tPrefix}system/apps/AboutSystem
|
||||
fi
|
||||
|
||||
# generate the attribute stores
|
||||
echo "Generating attribute stores ..."
|
||||
$generate_attribute_stores "$tPrefix"
|
||||
|
||||
echo "Copying boot image ..."
|
||||
$cp "$cdBootFloppy" "$outputDir"
|
||||
|
||||
# build the iso image
|
||||
echo "Building CD image ..."
|
||||
mkisofs -uid 0 -gid 0 -b `basename $cdBootFloppy` -R -V "$cdLabel" -o "$cdImagePath" "$tPrefix"
|
||||
|
||||
# cleanup output dir
|
||||
$rmAttrs -rf "$outputDir"
|
@ -5,50 +5,69 @@ set -o errexit
|
||||
# sourceDir
|
||||
# outputDir
|
||||
# tmpDir
|
||||
# addBuildCompatibilityLibDir
|
||||
# The following are only for image types:
|
||||
# installDir
|
||||
# isImage
|
||||
# imagePath
|
||||
# imageSize
|
||||
# imageLabel
|
||||
# addBuildCompatibilityLibDir
|
||||
# updateOnly
|
||||
# dontClearImage
|
||||
# isVMwareImage
|
||||
# optionalPackageDescriptions
|
||||
#
|
||||
# addattr
|
||||
# bfsShell
|
||||
# copyattr
|
||||
# fsShellCommand
|
||||
# makebootable
|
||||
# resattr
|
||||
# rc
|
||||
# rmAttrs
|
||||
# unzip
|
||||
# The following are only for image types:
|
||||
# bfsShell
|
||||
# fsShellCommand
|
||||
# makebootable
|
||||
# resattr
|
||||
# vmdkimage
|
||||
# The following is only for cd types:
|
||||
# generate_attribute_stores
|
||||
# isCD
|
||||
#
|
||||
if [ $# -gt 0 ]; then
|
||||
. $1
|
||||
shift
|
||||
fi
|
||||
|
||||
# If the haiku image path is a symlink resolve it now (makebootable needs the
|
||||
# path of the actual device path under Linux).
|
||||
normalizedImagePath=''
|
||||
if readlink -f "$imagePath" > /dev/null 2>&1 ; then
|
||||
normalizedImagePath=$(readlink -f "$imagePath")
|
||||
elif greadlink -f "$imagePath" > /dev/null 2>&1 ; then
|
||||
normalizedImagePath=$(greadlink -f "$imagePath")
|
||||
fi
|
||||
if [ -n "$normalizedImagePath" ]; then
|
||||
imagePath="$normalizedImagePath"
|
||||
if [ ! $isCD ]; then
|
||||
# If the haiku image path is a symlink resolve it now (makebootable needs the
|
||||
# path of the actual device path under Linux).
|
||||
normalizedImagePath=''
|
||||
if readlink -f "$imagePath" > /dev/null 2>&1 ; then
|
||||
normalizedImagePath=$(readlink -f "$imagePath")
|
||||
elif greadlink -f "$imagePath" > /dev/null 2>&1 ; then
|
||||
normalizedImagePath=$(greadlink -f "$imagePath")
|
||||
fi
|
||||
if [ -n "$normalizedImagePath" ]; then
|
||||
imagePath="$normalizedImagePath"
|
||||
fi
|
||||
fi
|
||||
|
||||
# this adds the build library dir to LD_LIBRARY_PATH
|
||||
eval "$addBuildCompatibilityLibDir"
|
||||
|
||||
# map the shell commands
|
||||
if [ $isImage ]; then
|
||||
if [ $isCD ]; then
|
||||
outputDir=$tmpDir/cdsource
|
||||
|
||||
sPrefix=
|
||||
tPrefix="$outputDir/"
|
||||
cd=cd
|
||||
scd=:
|
||||
cp="$copyattr -d"
|
||||
copyAttrs="$copyattr"
|
||||
ln=ln
|
||||
mkdir=mkdir
|
||||
rm=rm
|
||||
elif [ $isImage ]; then
|
||||
sPrefix=:
|
||||
tPrefix=/myfs/
|
||||
cd="$fsShellCommand cd"
|
||||
@ -119,6 +138,11 @@ if [ "$optionalPackageDescriptions" ]; then
|
||||
cp "$optionalPackageDescriptions" $copyrightsFile
|
||||
fi
|
||||
|
||||
if [ $isCD ]; then
|
||||
# setup output dir
|
||||
$rmAttrs -rf "$outputDir"
|
||||
mkdir -p "$outputDir"
|
||||
fi
|
||||
|
||||
# create the image and mount it
|
||||
if [ $isImage ]; then
|
||||
@ -225,6 +249,21 @@ if [ ! $updateOnly ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $isCD ]; then
|
||||
# generate the attribute stores
|
||||
echo "Generating attribute stores ..."
|
||||
$generate_attribute_stores "$tPrefix"
|
||||
|
||||
echo "Copying boot image ..."
|
||||
$cp "$cdBootFloppy" "$outputDir"
|
||||
|
||||
# build the iso image
|
||||
echo "Building CD image ..."
|
||||
mkisofs -uid 0 -gid 0 -b `basename $cdBootFloppy` -R -V "$cdLabel" -o "$cdImagePath" "$tPrefix"
|
||||
|
||||
# cleanup output dir
|
||||
$rmAttrs -rf "$outputDir"
|
||||
fi
|
||||
|
||||
# unmount
|
||||
if [ $isImage ]; then
|
||||
|
Loading…
x
Reference in New Issue
Block a user