2005-10-29 20:27:43 +04:00
|
|
|
#!/bin/sh
|
|
|
|
|
2007-04-07 01:13:35 +04:00
|
|
|
# The first argument is the shell script that initializes the variables:
|
2005-10-29 20:27:43 +04:00
|
|
|
# sourceDir
|
|
|
|
# outputDir
|
|
|
|
# tmpDir
|
|
|
|
# installDir
|
|
|
|
# isImage
|
|
|
|
# imagePath
|
|
|
|
# imageSize
|
2008-09-19 21:32:57 +04:00
|
|
|
# imageLabel
|
2005-10-29 20:27:43 +04:00
|
|
|
# addBuildCompatibilityLibDir
|
2007-04-07 01:13:35 +04:00
|
|
|
# updateOnly
|
2007-10-01 21:27:13 +04:00
|
|
|
# dontClearImage
|
2008-02-17 16:54:32 +03:00
|
|
|
# isVMwareImage
|
2008-05-04 20:06:41 +04:00
|
|
|
# optionalPackageDescriptions
|
2008-08-18 12:39:46 +04:00
|
|
|
#
|
2008-04-19 19:55:54 +04:00
|
|
|
# addattr
|
2005-10-29 20:27:43 +04:00
|
|
|
# bfsShell
|
|
|
|
# copyattr
|
|
|
|
# fsShellCommand
|
|
|
|
# makebootable
|
|
|
|
# resattr
|
|
|
|
# rc
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
# rmAttrs
|
2007-09-05 01:50:00 +04:00
|
|
|
# unzip
|
2008-04-04 01:18:18 +04:00
|
|
|
# vmdkimage
|
2005-10-29 20:27:43 +04:00
|
|
|
#
|
|
|
|
if [ $# -gt 0 ]; then
|
|
|
|
. $1
|
|
|
|
shift
|
|
|
|
fi
|
|
|
|
|
2008-06-18 17:02:41 +04:00
|
|
|
# If the haiku image path is a symlink resolve it now (makebootable needs the
|
|
|
|
# path of the actual device path under Linux).
|
2008-06-19 04:23:20 +04:00
|
|
|
if readlink -f "$imagePath" &> /dev/null; then
|
|
|
|
normalizedImagePath=$(readlink -f "$imagePath")
|
2008-06-18 17:02:41 +04:00
|
|
|
if [ $normalizedImagePath ]; then
|
|
|
|
imagePath="$normalizedImagePath"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# this adds the build library dir to LD_LIBRARY_PATH
|
|
|
|
eval "$addBuildCompatibilityLibDir"
|
|
|
|
|
|
|
|
# map the shell commands
|
|
|
|
if [ $isImage ]; then
|
|
|
|
sPrefix=:
|
|
|
|
tPrefix=/myfs/
|
|
|
|
cd="$fsShellCommand cd"
|
|
|
|
scd="$fsShellCommand cd"
|
2008-08-18 12:39:46 +04:00
|
|
|
cp="$fsShellCommand cp -f"
|
2007-07-27 03:20:58 +04:00
|
|
|
copyAttrs="$fsShellCommand cp -a"
|
2005-10-29 20:27:43 +04:00
|
|
|
ln="$fsShellCommand ln"
|
|
|
|
mkdir="$fsShellCommand mkdir"
|
|
|
|
rm="$fsShellCommand rm"
|
|
|
|
mkindex="$fsShellCommand mkindex"
|
|
|
|
else
|
|
|
|
sPrefix=
|
|
|
|
# TODO: This should come from the environment.
|
|
|
|
tPrefix="$installDir/"
|
|
|
|
cd=cd
|
|
|
|
scd=:
|
|
|
|
cp="$copyattr -d"
|
2007-07-27 03:20:58 +04:00
|
|
|
copyAttrs="$copyattr"
|
2005-10-29 20:27:43 +04:00
|
|
|
ln=ln
|
|
|
|
mkdir=mkdir
|
|
|
|
rm=rm
|
2006-11-03 12:36:49 +03:00
|
|
|
mkindex=mkindex
|
2005-10-29 20:27:43 +04:00
|
|
|
fi
|
|
|
|
|
2007-09-05 01:50:00 +04:00
|
|
|
|
|
|
|
unzipFile()
|
|
|
|
{
|
|
|
|
# unzipFile <archive> <directory>
|
|
|
|
zipFile=$1
|
|
|
|
targetUnzipDir=$2
|
|
|
|
|
|
|
|
echo "Unzipping $zipFile ..."
|
|
|
|
|
2008-04-19 19:55:54 +04:00
|
|
|
unzipDir=$tmpDir/unzip
|
|
|
|
$rmAttrs -rf "$unzipDir"
|
|
|
|
mkdir -p "$unzipDir"
|
2007-09-05 01:50:00 +04:00
|
|
|
|
2008-04-19 19:55:54 +04:00
|
|
|
$unzip -q -d "$unzipDir" "$zipFile"
|
2007-09-05 01:50:00 +04:00
|
|
|
|
2008-04-19 19:55:54 +04:00
|
|
|
if [ -f $unzipDir/.OptionalPackageDescription ]; then
|
|
|
|
cat $unzipDir/.OptionalPackageDescription >> $copyrightsFile
|
|
|
|
echo >> $copyrightsFile
|
|
|
|
rm $unzipDir/.OptionalPackageDescription
|
2007-09-05 01:50:00 +04:00
|
|
|
fi
|
2008-04-19 19:55:54 +04:00
|
|
|
|
|
|
|
$cp -r "${sPrefix}$unzipDir/." "${tPrefix}$targetUnzipDir"
|
|
|
|
|
|
|
|
$rmAttrs -rf "$unzipDir"
|
2007-09-05 01:50:00 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-04-19 19:55:54 +04:00
|
|
|
mkdir -p $tmpDir
|
|
|
|
copyrightsFile=$tmpDir/copyrights
|
|
|
|
$rmAttrs -f $copyrightsFile
|
2008-05-04 20:06:41 +04:00
|
|
|
if [ "$optionalPackageDescriptions" ]; then
|
|
|
|
cp "$optionalPackageDescriptions" $copyrightsFile
|
|
|
|
fi
|
2008-04-19 19:55:54 +04:00
|
|
|
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# create the image and mount it
|
|
|
|
if [ $isImage ]; then
|
|
|
|
echo
|
2008-02-17 16:54:32 +03:00
|
|
|
|
|
|
|
imageOffsetFlags=
|
|
|
|
if [ $isVMwareImage ]; then
|
|
|
|
imageOffsetFlags="--start-offset 65536"
|
|
|
|
fi
|
|
|
|
|
2007-04-07 01:13:35 +04:00
|
|
|
if [ ! $updateOnly ]; then
|
|
|
|
echo "Creating image ..."
|
2008-02-17 16:54:32 +03:00
|
|
|
|
2008-04-04 01:18:18 +04:00
|
|
|
ddFlags=
|
2008-02-17 16:54:32 +03:00
|
|
|
if [ $isVMwareImage ]; then
|
2008-04-04 01:18:18 +04:00
|
|
|
vmdkImageFlags=
|
|
|
|
if [ ! "$dontClearImage" ]; then
|
|
|
|
vmdkImageFlags="-c"
|
|
|
|
fi
|
|
|
|
$vmdkimage -h 64k -i${imageSize}M $vmdkImageFlags "$imagePath" \
|
|
|
|
|| exit 1
|
|
|
|
elif [ ! -e "$imagePath" -o ! "$dontClearImage" ]; then
|
|
|
|
dd if=/dev/zero of="$imagePath" bs=1048576 count=$imageSize \
|
|
|
|
|| exit 1
|
2008-02-17 16:54:32 +03:00
|
|
|
fi
|
|
|
|
|
2008-09-19 21:32:57 +04:00
|
|
|
$bfsShell --initialize $imageOffsetFlags "$imagePath" \
|
|
|
|
"$imageLabel" "block_size 2048" || exit 1
|
2008-03-28 00:11:04 +03:00
|
|
|
$makebootable $imageOffsetFlags "$imagePath"
|
2007-04-07 01:13:35 +04:00
|
|
|
fi
|
2008-03-28 00:11:04 +03:00
|
|
|
$bfsShell -n $imageOffsetFlags "$imagePath" > /dev/null &
|
2005-10-29 20:27:43 +04:00
|
|
|
sleep 1
|
2008-03-09 20:34:26 +03:00
|
|
|
# bail out, if mounting fails
|
|
|
|
$cd . || exit 1
|
2005-10-29 20:27:43 +04:00
|
|
|
fi
|
|
|
|
|
2007-04-07 01:13:35 +04:00
|
|
|
# create BEOS:APP_SIG index -- needed to launch apps via signature
|
|
|
|
if [ ! $updateOnly ]; then
|
|
|
|
$mkindex BEOS:APP_SIG
|
|
|
|
fi
|
2005-10-29 20:27:43 +04:00
|
|
|
|
|
|
|
echo "Populating image ..."
|
|
|
|
while [ $# -gt 0 ]; do
|
|
|
|
. $1
|
|
|
|
shift
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
|
|
# install MIME database
|
|
|
|
# TODO: It should be possible to do that in the build system too.
|
2007-04-07 01:13:35 +04:00
|
|
|
|
|
|
|
if [ ! $updateOnly ]; then
|
|
|
|
mimeDBSource=$sourceDir/src/data/beos_mime
|
|
|
|
mimeDBDest=${tPrefix}home/config/settings/beos_mime
|
|
|
|
|
|
|
|
echo "Deleting old MIME database ..."
|
|
|
|
|
|
|
|
$rm -rf $mimeDBDest
|
|
|
|
$mkdir -p $mimeDBDest
|
|
|
|
mimeTmpDir=$tmpDir/mime
|
2008-04-15 19:46:00 +04:00
|
|
|
mimeDBTmpDir=$tmpDir/mime/db
|
2007-04-07 01:13:35 +04:00
|
|
|
mimeTmpIndex=0
|
2008-04-15 19:46:00 +04:00
|
|
|
mimeTmpFile=$mimeTmpDir/mimedb$$.rsrc
|
2007-04-07 01:13:35 +04:00
|
|
|
|
|
|
|
# create tmp dir for the MIME conversion stuff
|
2008-04-15 19:46:00 +04:00
|
|
|
mkdir -p $mimeDBTmpDir
|
2007-04-07 01:13:35 +04:00
|
|
|
|
|
|
|
echo "Installing MIME database ..."
|
|
|
|
|
|
|
|
for inSuperFile in $mimeDBSource/*.super; do
|
|
|
|
superType=$(basename $inSuperFile .super)
|
2008-04-15 19:46:00 +04:00
|
|
|
tmpSuperDir=$mimeDBTmpDir/$superType
|
2007-04-07 01:13:35 +04:00
|
|
|
|
|
|
|
# compile rdef to rsrc file and the rsrc file to attributes
|
2008-04-15 19:46:00 +04:00
|
|
|
$rc -o $mimeTmpFile $inSuperFile
|
|
|
|
mkdir -p $tmpSuperDir
|
|
|
|
$resattr -O -o $tmpSuperDir $mimeTmpFile
|
|
|
|
$rmAttrs $mimeTmpFile
|
2007-04-07 01:13:35 +04:00
|
|
|
|
|
|
|
# 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)
|
2008-04-15 19:46:00 +04:00
|
|
|
tmpSubFile=$mimeDBTmpDir/$superType/$subType
|
2007-04-07 01:13:35 +04:00
|
|
|
|
|
|
|
# compile rdef to rsrc file and the rsrc file to attributes
|
2008-04-15 19:46:00 +04:00
|
|
|
$rc -o $mimeTmpFile $inSubFile
|
|
|
|
$resattr -O -o $tmpSubFile $mimeTmpFile
|
|
|
|
$rmAttrs $mimeTmpFile
|
2007-04-07 01:13:35 +04:00
|
|
|
fi
|
|
|
|
done
|
2005-10-29 20:27:43 +04:00
|
|
|
done
|
|
|
|
|
2008-04-15 19:46:00 +04:00
|
|
|
$cp -r ${sPrefix}$mimeDBTmpDir/. $mimeDBDest
|
|
|
|
|
2007-04-07 01:13:35 +04:00
|
|
|
# cleanup tmp dir
|
* BuildPlatformMain supports overriding HOST_LIBROOT on the target now,
so one can set it to the static libroot, if desired.
* Generic attribute emulation:
- Added build tool rm_attrs, a simple "rm" replacement, which also
removes the attributes directory for a given file.
- Added build/scripts/rm_attrs shell script, which wraps the
invocation of the rm_attrs tool. If it doesn't exist yet, the
ordinary rm is used.
- The RM jam variable refers to the rm_attrs script now, i.e. whenever
something is removed by the build system, the attributes are removed
too (if the build tool has already been built, that is).
- Removed the shell function attrrmrf() in build_haiku_image. We use
the rm_attrs tool instead, if necessary.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@24528 a95241bf-73f2-0310-859d-f6bbb57e9c96
2008-03-23 00:05:03 +03:00
|
|
|
$rmAttrs -rf $mimeTmpDir
|
2007-04-07 01:13:35 +04:00
|
|
|
fi # ! updateOnly
|
2005-10-29 20:27:43 +04:00
|
|
|
|
2007-03-25 03:34:28 +04:00
|
|
|
|
2008-04-19 19:55:54 +04:00
|
|
|
# add the concatenated copyrights as an attribute to AboutSystem
|
|
|
|
|
|
|
|
if [ ! $updateOnly ]; then
|
|
|
|
if [ -f $copyrightsFile ]; then
|
|
|
|
copyrightAttrs=$tmpDir/copyrightAttrs
|
|
|
|
$rmAttrs -f $copyrightAttrs
|
|
|
|
touch $copyrightAttrs
|
|
|
|
$addattr -f $copyrightsFile COPYRIGHTS $copyrightAttrs
|
|
|
|
$copyAttrs ${sPrefix}$copyrightAttrs ${tPrefix}beos/apps/AboutSystem
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2005-10-29 20:27:43 +04:00
|
|
|
# unmount
|
|
|
|
if [ $isImage ]; then
|
|
|
|
echo "Unmounting ..."
|
|
|
|
$fsShellCommand sync
|
|
|
|
$fsShellCommand quit
|
|
|
|
fi
|