#!/bin/sh## Usage: build_haiku_repository <initScript> <repositoryDir> <repoInfo># <packages> ...set -o errexitif [ $# -le 2 ]; thenecho "$0: Missing parameters!" >&2exit 1fi. $1shiftrepositoryDir="$1"repoInfo="$2"shift 2# the remaining arguments are the packages# this adds the build library dir to LD_LIBRARY_PATHeval "$addBuildCompatibilityLibDir"# create a clean repository directoryrm -rf "$repositoryDir"mkdir "$repositoryDir"packageDir="$repositoryDir/packages"mkdir "$packageDir"# Get the canonical names for the packages and copy them to the package# directory.for packageFile in "$@"; dofileName=`"$package" info -f "%fileName%" "$packageFile"`cp "$packageFile" "$packageDir/$fileName"done# build the repository filecp "$repoInfo" "$repositoryDir/repo.info""$packageRepo" create "$repositoryDir/repo.info" "$packageDir"/*.hpkg# create the checksum file$sha256 "$repositoryDir/repo" \| $sedExtendedRegex 's,([^[:space:]]*).*,\1,' > "$repositoryDir/repo.sha256"# The sed part is only necessary for sha256sum, but it doesn't harm for# sha256 either.