File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11{
22 "createpackage" : " v1.73.0" ,
33 "jam" : " v2.11.5" ,
4- "pack" : " v0.37.0"
4+ "libpaktools" : " v0.2.0" ,
5+ "pack" : " v0.38.1"
56}
Original file line number Diff line number Diff line change @@ -31,6 +31,8 @@ function util::tools::arch() {
3131 amd64|x86_64)
3232 if [[ " ${1:- } " == " --blank-amd64" ]]; then
3333 echo " "
34+ elif [[ " ${1:- } " == " --format-amd64-x86_64" ]]; then
35+ echo " x86_64"
3436 else
3537 echo " amd64"
3638 fi
@@ -196,6 +198,64 @@ function util::tools::packager::install () {
196198 fi
197199}
198200
201+ function util::tools::libpak-tools::install () {
202+ local dir token
203+ token=" "
204+
205+ while [[ " ${# } " != 0 ]]; do
206+ case " ${1} " in
207+ --directory)
208+ dir=" ${2} "
209+ shift 2
210+ ;;
211+
212+ --token)
213+ token=" ${2} "
214+ shift 2
215+ ;;
216+
217+ * )
218+ util::print::error " unknown argument \" ${1} \" "
219+ esac
220+ done
221+
222+ mkdir -p " ${dir} "
223+ util::tools::path::export " ${dir} "
224+
225+
226+ if [[ ! -f " ${dir} /libpak-tools" ]]; then
227+ local version curl_args os arch
228+
229+ version=" $( jq -r .libpaktools " $( dirname " ${BASH_SOURCE[0]} " ) /tools.json" ) "
230+
231+ curl_args=(
232+ " --fail"
233+ " --silent"
234+ " --location"
235+ " --output" " ${dir} /libpak-tools.tar.gz"
236+ )
237+
238+ if [[ " ${token} " != " " ]]; then
239+ curl_args+=(" --header" " Authorization: Token ${token} " )
240+ fi
241+
242+ util::print::title " Installing libpak-tools ${version} "
243+
244+ os=$( util::tools::os)
245+ arch=$( util::tools::arch --format-amd64-x86_64)
246+
247+ curl " https://github.com/paketo-buildpacks/libpak-tools/releases/download/${version} /libpak-tools_${os^} _${arch} .tar.gz" \
248+ " ${curl_args[@]} "
249+
250+ tar -xzf " ${dir} /libpak-tools.tar.gz" -C $dir
251+ rm " ${dir} /libpak-tools.tar.gz"
252+
253+ chmod +x " ${dir} /libpak-tools"
254+ else
255+ util::print::info " Using libpak-tools"
256+ fi
257+ }
258+
199259function util::tools::create-package::install () {
200260 local dir version
201261 while [[ " ${# } " != 0 ]]; do
Original file line number Diff line number Diff line change @@ -110,6 +110,9 @@ function tools::install() {
110110 --directory " ${BUILDPACKDIR} /.bin" \
111111 --token " ${token} "
112112
113+ util::tools::libpak-tools::install \
114+ --directory " ${BUILDPACKDIR} /.bin"
115+
113116 util::tools::create-package::install \
114117 --directory " ${BUILDPACKDIR} /.bin"
115118
You can’t perform that action at this time.
0 commit comments