xref: /haiku/build/scripts/build_haiku_repository (revision 991dadd6324f7b7a68e94743a39ebae789823228)
1#!/bin/sh
2#
3# Usage: build_haiku_repository <initScript> <repositoryDir> <repoInfo>
4#			<packages> ...
5
6set -o errexit
7
8if [ $# -le 2 ]; then
9	echo "$0: Missing parameters!" >&2
10	exit 1
11fi
12
13. $1
14shift
15
16repositoryDir="$1"
17repoInfo="$2"
18shift 2
19# the remaining arguments are the packages
20
21# this adds the build library dir to LD_LIBRARY_PATH
22eval "$addBuildCompatibilityLibDir"
23
24# create a clean repository directory
25rm -rf "$repositoryDir"
26mkdir "$repositoryDir"
27
28packageDir="$repositoryDir/packages"
29mkdir "$packageDir"
30
31# Get the canonical names for the packages and copy them to the package
32# directory.
33for packageFile in "$@"; do
34	fileName=`"$package" info -f "%fileName%" "$packageFile"`
35	cp "$packageFile" "$packageDir/$fileName"
36done
37
38# build the repository file
39cp "$repoInfo" "$repositoryDir/repo.info"
40"$packageRepo" create -C "$repositoryDir" "$repositoryDir/repo.info" \
41	"$packageDir"/*.hpkg
42
43# create the checksum file
44$sha256 "$repositoryDir/repo" \
45	| $sedExtendedRegex 's,([^[:space:]]*).*,\1,' > "$repositoryDir/repo.sha256"
46		# The sed part is only necessary for sha256sum, but it doesn't harm for
47		# sha256 either.
48