haiku/build/scripts/build_haiku_package
Ingo Weinhold 161d45feb5 Support for package "update" build profile action
* Add global HAIKU_PACKAGES_UPDATE_ONLY build system variable, which is
  set for the "update" and "update-all" build profile actions.
* Change the HAIKU_INCLUDE_IN_CONTAINER_VAR variable on packages to
  HAIKU_INCLUDE_IN_PACKAGES for all packages. The variable is also
  set for the "update" and "update-all" build profile actions.
* Introduce HAIKU_CONTAINER_INHERIT_UPDATE_VARIABLE on container
  variable. If set, the contained variable will be set on the container
  when one or more files in it are updated. It is set on packages so an
  update of a file in a package causes the package to be updated in the
  image.
* Introduce HAIKU_CONTAINER_ALWAYS_CREATE_DIRECTORIES on container
  variable. If set, directories will be created also in update mode. It
  is set on packages.
2011-07-17 16:54:58 +02:00

70 lines
1.1 KiB
Bash
Executable File

#!/bin/sh
set -o errexit
# The first argument is the shell script that initializes the variables:
# sourceDir
# outputDir
# tmpDir
# addBuildCompatibilityLibDir
# updateOnly
#
# addattr
# copyattr
# package
# rc
# rmAttrs
# unzip
#
if [ $# -le 1 ]; then
echo "$0: Missing parameters!" >&2
exit 1
fi
packagePath="$1"
packageInfoPath="$2"
shift 2
if [ $# -gt 0 ]; then
. $1
shift
fi
# this adds the build library dir to LD_LIBRARY_PATH
eval "$addBuildCompatibilityLibDir"
# make a clean contents dir
contentsDir="$tmpDir/contents"
$rmAttrs -rf "$contentsDir"
mkdir -p "$contentsDir"
# map the shell commands
sPrefix=
tPrefix="$contentsDir/"
cd=cd
scd=:
cp="$copyattr -d"
copyAttrs="$copyattr"
ln=ln
mkdir=mkdir
rm=$rmAttrs
mkindex=mkindex
# execute the scripts preparing the package contents
while [ $# -gt 0 ]; do
. $1
shift
done
# create the package
if [ ! $updateOnly ]; then
rm -f "$packagePath"
$package create -q -i "$packageInfoPath" -C "$contentsDir" "$packagePath"
else
$package add -q -f -i "$packageInfoPath" -C "$contentsDir" "$packagePath" .
fi