-
Notifications
You must be signed in to change notification settings - Fork 234
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #272 from CircleCI-Public/packr2
[CIRCLE-15952]: Replace CI packr install with vendored binary
- Loading branch information
Showing
6 changed files
with
69 additions
and
18 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
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,53 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit | ||
set -o pipefail | ||
set -o nounset | ||
|
||
PACKR_VERSION="2.0.1" | ||
RELEASE_URL="https://github.com/gobuffalo/packr/releases/download" | ||
DESTDIR="${DESTDIR:-$PWD/bin}" | ||
|
||
SCRATCH=$(mktemp -d) | ||
cd "$SCRATCH" | ||
|
||
function error() { | ||
echo "An error occured installing the tool." | ||
echo "The contents of the directory $SCRATCH have been left in place to help to debug the issue." | ||
} | ||
|
||
trap error SIGINT | ||
|
||
function get_arch_type() { | ||
if [[ $(uname -m) == "i686" ]]; then | ||
echo "386" | ||
elif [[ $(uname -m) == "x86_64" ]]; then | ||
echo "amd64" | ||
fi | ||
} | ||
|
||
function get_arch_base() { | ||
if [[ "$OSTYPE" == "linux-gnu" ]]; then | ||
echo "linux" | ||
elif [[ "$OSTYPE" == "darwin"* ]]; then | ||
echo "darwin" | ||
fi | ||
} | ||
|
||
ARCH="$(get_arch_base)_$(get_arch_type)" | ||
PACKR_RELEASE_URL="${RELEASE_URL}/v${PACKR_VERSION}/packr_${PACKR_VERSION}_${ARCH}.tar.gz" | ||
|
||
echo "Fetching packr from $PACKR_RELEASE_URL" | ||
|
||
curl --retry 3 --fail --location "$PACKR_RELEASE_URL" | tar -xz | ||
|
||
echo "Installing packr for $ARCH to $DESTDIR" | ||
mv packr2 "$DESTDIR" | ||
chmod +x "$DESTDIR/packr2" | ||
|
||
command -v "$DESTDIR/packr2" | ||
|
||
# Delete the working directory when the install was successful. | ||
rm -r "$SCRATCH" | ||
|
||
exit 0 |
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 |
---|---|---|
|
@@ -21,3 +21,4 @@ stage/ | |
# packr related | ||
*/*-packr.go | ||
packrd/ | ||
/bin/packr2 |
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
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
Empty file.