This repository has been archived by the owner on Sep 27, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23e7648
commit 8542ede
Showing
1 changed file
with
42 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
cd "$(dirname "${BASH_SOURCE[0]}")/.." | ||
./scripts/install_tools.sh | ||
|
||
PACKAGE_DIR=${PACKAGE_DIR:-"${PWD##*/}_$(openssl rand -hex 4)"} | ||
|
||
full_path=$(realpath "$PACKAGE_DIR") | ||
args=".bin/packager -uncached" | ||
|
||
while getopts "acv:" arg | ||
do | ||
case $arg in | ||
a) archive=true;; | ||
c) cached=true;; | ||
v) version="${OPTARG}";; | ||
esac | ||
done | ||
|
||
if [[ ! -z "$cached" ]]; then #package as cached | ||
full_path="$full_path-cached" | ||
args=".bin/packager" | ||
fi | ||
|
||
if [[ ! -z "$archive" ]]; then #package as archive | ||
args="${args} -archive" | ||
fi | ||
|
||
if [[ -z "$version" ]]; then #version not provided, use latest git tag | ||
git_tag=$(git describe --abbrev=0 --tags) | ||
version=${git_tag:1} | ||
fi | ||
|
||
args="${args} -version ${version}" | ||
|
||
eval "${args}" "${full_path}" | ||
|
||
if [[ -n "$BP_REWRITE_HOST" ]]; then | ||
sed -i '' -e "s|^uri = \"https:\/\/buildpacks\.cloudfoundry\.org\(.*\)\"$|uri = \"http://$BP_REWRITE_HOST\1\"|g" "$full_path/buildpack.toml" | ||
fi | ||
|