Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion scripts/.util/tools.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"createpackage": "v1.73.0",
"jam": "v2.11.5",
"pack": "v0.37.0"
"libpaktools": "v0.2.0",
"pack": "v0.38.2"
}
60 changes: 60 additions & 0 deletions scripts/.util/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ function util::tools::arch() {
amd64|x86_64)
if [[ "${1:-}" == "--blank-amd64" ]]; then
echo ""
elif [[ "${1:-}" == "--format-amd64-x86_64" ]]; then
echo "x86_64"
else
echo "amd64"
fi
Expand Down Expand Up @@ -196,6 +198,64 @@ function util::tools::packager::install () {
fi
}

function util::tools::libpak-tools::install () {
local dir token
token=""

while [[ "${#}" != 0 ]]; do
case "${1}" in
--directory)
dir="${2}"
shift 2
;;

--token)
token="${2}"
shift 2
;;

*)
util::print::error "unknown argument \"${1}\""
esac
done

mkdir -p "${dir}"
util::tools::path::export "${dir}"


if [[ ! -f "${dir}/libpak-tools" ]]; then
local version curl_args os arch

version="$(jq -r .libpaktools "$(dirname "${BASH_SOURCE[0]}")/tools.json")"

curl_args=(
"--fail"
"--silent"
"--location"
"--output" "${dir}/libpak-tools.tar.gz"
)

if [[ "${token}" != "" ]]; then
curl_args+=("--header" "Authorization: Token ${token}")
fi

util::print::title "Installing libpak-tools ${version}"

os=$(util::tools::os)
arch=$(util::tools::arch --format-amd64-x86_64)

curl "https://github.com/paketo-buildpacks/libpak-tools/releases/download/${version}/libpak-tools_${os^}_${arch}.tar.gz" \
"${curl_args[@]}"

tar -xzf "${dir}/libpak-tools.tar.gz" -C $dir
rm "${dir}/libpak-tools.tar.gz"

chmod +x "${dir}/libpak-tools"
else
util::print::info "Using libpak-tools"
fi
}

function util::tools::create-package::install () {
local dir version
while [[ "${#}" != 0 ]]; do
Expand Down
3 changes: 3 additions & 0 deletions scripts/integration.sh
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ function tools::install() {
--directory "${BUILDPACKDIR}/.bin" \
--token "${token}"

util::tools::libpak-tools::install \
--directory "${BUILDPACKDIR}/.bin"

util::tools::create-package::install \
--directory "${BUILDPACKDIR}/.bin"

Expand Down
Loading