317bd7dda3
* Made the TimeZoneView less error prone, and also actually use Haiku code (the previous check didn't work since it used #if, not #ifdef). * Also took the liberty to rename our boot loader to haiku_loader, since I had to update the nasm binary anyway. Updated the assembly sources to nasm 2.0. * I haven't found where the synth location in the MIDI code is specified, though. * Also, NetBootArchive, and FloppyBootImage haven't been updated yet. Will do so next. * Some optional packages still put their license to beos/etc/licenses. I didn't update them yet, as we'll probably do so anyway at some point. Also, I think we might want to introduce a common/data/licenses instead for those. * If you encounter any problems, please tell! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@29876 a95241bf-73f2-0310-859d-f6bbb57e9c96
221 lines
4.7 KiB
Bash
Executable File
221 lines
4.7 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
# The first argument is the shell script that initializes the variables:
|
|
# sourceDir
|
|
# outputDir
|
|
# tmpDir
|
|
# installDir
|
|
# isImage
|
|
# imagePath
|
|
# imageSize
|
|
# imageLabel
|
|
# addBuildCompatibilityLibDir
|
|
# updateOnly
|
|
# dontClearImage
|
|
# isVMwareImage
|
|
# optionalPackageDescriptions
|
|
#
|
|
# addattr
|
|
# bfsShell
|
|
# copyattr
|
|
# fsShellCommand
|
|
# makebootable
|
|
# resattr
|
|
# rc
|
|
# rmAttrs
|
|
# unzip
|
|
# vmdkimage
|
|
#
|
|
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).
|
|
if readlink -f "$imagePath" &> /dev/null; then
|
|
normalizedImagePath=$(readlink -f "$imagePath")
|
|
if [ $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
|
|
sPrefix=:
|
|
tPrefix=/myfs/
|
|
cd="$fsShellCommand cd"
|
|
scd="$fsShellCommand cd"
|
|
cp="$fsShellCommand cp -f"
|
|
copyAttrs="$fsShellCommand cp -a"
|
|
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"
|
|
copyAttrs="$copyattr"
|
|
ln=ln
|
|
mkdir=mkdir
|
|
rm=rm
|
|
mkindex=mkindex
|
|
fi
|
|
|
|
|
|
unzipFile()
|
|
{
|
|
# unzipFile <archive> <directory>
|
|
zipFile=$1
|
|
targetUnzipDir=$2
|
|
|
|
echo "Unzipping $zipFile ..."
|
|
|
|
unzipDir=$tmpDir/unzip
|
|
$rmAttrs -rf "$unzipDir"
|
|
mkdir -p "$unzipDir"
|
|
|
|
$unzip -q -d "$unzipDir" "$zipFile"
|
|
|
|
if [ -f $unzipDir/.OptionalPackageDescription ]; then
|
|
cat $unzipDir/.OptionalPackageDescription >> $copyrightsFile
|
|
echo >> $copyrightsFile
|
|
rm $unzipDir/.OptionalPackageDescription
|
|
fi
|
|
|
|
$cp -r "${sPrefix}$unzipDir/." "${tPrefix}$targetUnzipDir"
|
|
|
|
$rmAttrs -rf "$unzipDir"
|
|
}
|
|
|
|
|
|
mkdir -p $tmpDir
|
|
copyrightsFile=$tmpDir/copyrights
|
|
$rmAttrs -f $copyrightsFile
|
|
if [ "$optionalPackageDescriptions" ]; then
|
|
cp "$optionalPackageDescriptions" $copyrightsFile
|
|
fi
|
|
|
|
|
|
# create the image and mount it
|
|
if [ $isImage ]; then
|
|
echo
|
|
|
|
imageOffsetFlags=
|
|
if [ $isVMwareImage ]; then
|
|
imageOffsetFlags="--start-offset 65536"
|
|
fi
|
|
|
|
if [ ! $updateOnly ]; then
|
|
echo "Creating image ..."
|
|
|
|
ddFlags=
|
|
if [ $isVMwareImage ]; then
|
|
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
|
|
fi
|
|
|
|
$bfsShell --initialize $imageOffsetFlags "$imagePath" \
|
|
"$imageLabel" "block_size 2048" || exit 1
|
|
$makebootable $imageOffsetFlags "$imagePath"
|
|
fi
|
|
$bfsShell -n $imageOffsetFlags "$imagePath" > /dev/null &
|
|
sleep 1
|
|
# bail out, if mounting fails
|
|
$cd . || exit 1
|
|
fi
|
|
|
|
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.
|
|
|
|
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
|
|
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 ${sPrefix}$mimeDBTmpDir/. $mimeDBDest
|
|
|
|
# cleanup tmp dir
|
|
$rmAttrs -rf $mimeTmpDir
|
|
fi # ! updateOnly
|
|
|
|
|
|
# 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}system/apps/AboutSystem
|
|
fi
|
|
fi
|
|
|
|
|
|
# unmount
|
|
if [ $isImage ]; then
|
|
echo "Unmounting ..."
|
|
$fsShellCommand sync
|
|
$fsShellCommand quit
|
|
fi
|