haiku/build/scripts/build_tgz_archive
Ingo Weinhold b39c8d3711 * Refactored the image creation rules. There are now generalized rules that
work on arbitrary "containers". The image rules are just
  specializations.
* Added rules, a definition file (build/jam/NetBootArchive), and a shell
  script for creating a gzipped tar archive containing kernel and modules
  required for network booting (the contents may need some fine-tuning).
  ATM it can be built via the haiku-netboot-archive pseudo target. It is
  generated in the output directory (e.g. "generated").


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@21591 a95241bf-73f2-0310-859d-f6bbb57e9c96
2007-07-11 01:04:35 +00:00

54 lines
846 B
Bash
Executable File

#!/bin/sh
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
#
. $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
# clear output dir
$rm -rf $outputDir
$mkdir $outputDir
# populate output dir
echo "Preparing contents of archive $archive ..."
while [ $# -gt 0 ]; do
. $1
shift
done
# build the archive
echo "Building archive $archive ..."
$rm -f $archive
contents=$(cd $outputDir; ls)
tar -C $outputDir -czf $archive $contents || exit 1
# clean up
$rm -rf $outputDir