Created
July 10, 2014 06:43
-
-
Save tobynet/eab44788828dd01c487c to your computer and use it in GitHub Desktop.
Install latest peco binary for Linux amd64 from https://github.com/peco/peco/releases/latest
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
#!/usr/bin/env bash | |
# Usage: BINDIR=$HOME/bin/ bash install-peco.sh | |
set -o xtrace # for debug output. ( abbr. set -x ) | |
set -o errexit # for exit on error. ( abbr. set -e ) | |
set -o pipefail # errexit for pipe | |
set -o nounset # exit when the script to use undeclared variables (abbr. set -u) | |
filename=peco_linux_amd64.tar.gz | |
latest_tag="$(curl -L --head https://github.com/peco/peco/releases/latest | grep -i location: | sed 's/^.*\/tag\/\([^\/]*\)\r$/\1/')" | |
uri_to_download="https://github.com/peco/peco/releases/download/${latest_tag}/${filename}" | |
bindir="${BINDIR:-"$HOME/bin/"}" | |
pushd "$(mktemp -d "/tmp/tmp.XXXXXXXXXX")" | |
curl -O -L "$uri_to_download" | |
tar xf "$filename" | |
cp "${filename%%.*}/peco" "$bindir" | |
popd | |
if [[ ! -x "${bindir}/peco" ]]; then | |
echo '"peco" was not successfully installed!' >&2 | |
exit 2 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment