Skip to content
This repository has been archived by the owner on Sep 27, 2022. It is now read-only.

Commit

Permalink
Update CNB tools
Browse files Browse the repository at this point in the history
  • Loading branch information
cf-buildpacks-eng committed Sep 11, 2019
1 parent 23e7648 commit 8542ede
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions scripts/package-shim
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

0 comments on commit 8542ede

Please sign in to comment.