From 8542edea63d9a4c1c495200c0aa059bc3287697d Mon Sep 17 00:00:00 2001 From: CF Buildpacks Team CI Server Date: Wed, 11 Sep 2019 18:30:23 +0000 Subject: [PATCH] Update CNB tools --- scripts/package-shim | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 scripts/package-shim diff --git a/scripts/package-shim b/scripts/package-shim new file mode 100755 index 0000000..a124ded --- /dev/null +++ b/scripts/package-shim @@ -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 +