18a69c72f6
build_archive. Updated ImageRules accordingly. Tested on the following: * jam -q -sTARGET_BOOT_PLATFORM=pxe_ia32 pxehaiku-loader haiku-netboot-archive * jam -q haiku-boot-floppy * jam -q haiku-alternative-gcc-archive git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@36005 a95241bf-73f2-0310-859d-f6bbb57e9c96
89 lines
1.3 KiB
Bash
Executable File
89 lines
1.3 KiB
Bash
Executable File
#!/bin/sh
|
|
set -o errexit
|
|
|
|
if [ $# -lt 2 ]; then
|
|
echo "Usage: $0 <archive> <scripts> ..."
|
|
fi
|
|
|
|
# get the archive name
|
|
archive=$1
|
|
shift
|
|
|
|
# The second argument is the shell script that initializes the variables:
|
|
# tmpDir
|
|
# addBuildCompatibilityLibDir
|
|
#
|
|
# copyattr
|
|
# rmAttrs
|
|
# zip
|
|
# NOTE: rmAttrs and zip are only passed in when building zip
|
|
#
|
|
. $1
|
|
shift
|
|
|
|
outputDir=$tmpDir/archive
|
|
|
|
# this adds the build library dir to LD_LIBRARY_PATH
|
|
eval "$addBuildCompatibilityLibDir"
|
|
|
|
# map the shell commands
|
|
sPrefix=
|
|
tPrefix="$outputDir/"
|
|
cd=cd
|
|
scd=:
|
|
cp="$copyattr -d"
|
|
ln=ln
|
|
mkdir=mkdir
|
|
rm=rm
|
|
|
|
|
|
cleanDir()
|
|
{
|
|
# clearDir <directory>
|
|
if [ $rmAttrs ] ; then
|
|
$rmAttrs -rf $1
|
|
else
|
|
$rm -rf $1
|
|
fi
|
|
}
|
|
|
|
|
|
# clean output dir
|
|
cleanDir $outputDir
|
|
$mkdir -p $outputDir
|
|
|
|
# populate output dir
|
|
echo "Preparing contents of archive $archive ..."
|
|
while [ $# -gt 0 ]; do
|
|
. $1
|
|
shift
|
|
done
|
|
|
|
# get an absolute path for the archive
|
|
cwd=$(pwd)
|
|
cd $(dirname $archive)
|
|
archive=$(pwd)/$(basename $archive)
|
|
cd $cwd
|
|
|
|
# build the archive
|
|
echo "Building archive $archive ..."
|
|
$rm -f $archive
|
|
cd $outputDir
|
|
case "$archive" in
|
|
*.zip)
|
|
$zip -ryq $archive .
|
|
;;
|
|
*.tgz)
|
|
contents=$(ls)
|
|
tar --format ustar -czf $archive $contents
|
|
;;
|
|
*)
|
|
echo "Unhandled archive format in build_archive"
|
|
exit 1
|
|
;;
|
|
esac
|
|
cd ..
|
|
|
|
# clean up
|
|
cleanDir $outputDir
|