Skip to content

Commit

Permalink
fix: update install.sh script (#1828)
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr authored Apr 25, 2020
1 parent 1bbfb37 commit 7d56902
Showing 1 changed file with 40 additions and 54 deletions.
94 changes: 40 additions & 54 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh
set -e
# Code generated by godownloader on 2019-04-02T09:54:08Z. DO NOT EDIT.
# Code generated by godownloader on 2020-04-25T10:38:57Z. DO NOT EDIT.
#

usage() {
Expand Down Expand Up @@ -51,7 +51,7 @@ execute() {
srcdir="${tmpdir}"
(cd "${tmpdir}" && untar "${TARBALL}")
test ! -d "${BINDIR}" && install -d "${BINDIR}"
for binexe in "hydra" ; do
for binexe in $BINARIES; do
if [ "$OS" = "windows" ]; then
binexe="${binexe}.exe"
fi
Expand All @@ -60,49 +60,37 @@ execute() {
done
rm -rf "${tmpdir}"
}
is_supported_platform() {
platform=$1
found=1
case "$platform" in
freebsd/amd64) found=0 ;;
freebsd/386) found=0 ;;

freebsd/arm64) found=0 ;;
linux/amd64) found=0 ;;
linux/386) found=0 ;;

linux/arm64) found=0 ;;
windows/amd64) found=0 ;;
windows/386) found=0 ;;

windows/arm64) found=0 ;;
darwin/amd64) found=0 ;;
darwin/386) found=0 ;;

darwin/arm64) found=0 ;;
freebsd/armv5) found=0 ;;
freebsd/armv6) found=0 ;;
freebsd/armv7) found=0 ;;
linux/armv5) found=0 ;;
linux/armv6) found=0 ;;
linux/armv7) found=0 ;;
windows/armv5) found=0 ;;
windows/armv6) found=0 ;;
windows/armv7) found=0 ;;
darwin/armv5) found=0 ;;
darwin/armv6) found=0 ;;
darwin/armv7) found=0 ;;
get_binaries() {
case "$PLATFORM" in
darwin/386) BINARIES="hydra" ;;
darwin/amd64) BINARIES="hydra" ;;
darwin/arm64) BINARIES="hydra" ;;
darwin/armv5) BINARIES="hydra" ;;
darwin/armv6) BINARIES="hydra" ;;
darwin/armv7) BINARIES="hydra" ;;
freebsd/386) BINARIES="hydra" ;;
freebsd/amd64) BINARIES="hydra" ;;
freebsd/arm64) BINARIES="hydra" ;;
freebsd/armv5) BINARIES="hydra" ;;
freebsd/armv6) BINARIES="hydra" ;;
freebsd/armv7) BINARIES="hydra" ;;
linux/386) BINARIES="hydra" ;;
linux/amd64) BINARIES="hydra" ;;
linux/arm64) BINARIES="hydra" ;;
linux/armv5) BINARIES="hydra" ;;
linux/armv6) BINARIES="hydra" ;;
linux/armv7) BINARIES="hydra" ;;
windows/386) BINARIES="hydra" ;;
windows/amd64) BINARIES="hydra" ;;
windows/arm64) BINARIES="hydra" ;;
windows/armv5) BINARIES="hydra" ;;
windows/armv6) BINARIES="hydra" ;;
windows/armv7) BINARIES="hydra" ;;
*)
log_crit "platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX}/issues/new"
exit 1
;;
esac
return $found
}
check_platform() {
if is_supported_platform "$PLATFORM"; then
# optional logging goes here
true
else
log_crit "platform $PLATFORM is not supported. Make sure this script is up-to-date and file request at https://github.com/${PREFIX}/issues/new"
exit 1
fi
}
tag_to_version() {
if [ -z "${TAG}" ]; then
Expand All @@ -120,8 +108,8 @@ tag_to_version() {
VERSION=${TAG#v}
}
adjust_format() {
# change format (tar.gz or zip) based on ARCH
case ${ARCH} in
# change format (tar.gz or zip) based on OS
case ${OS} in
windows) FORMAT=zip ;;
esac
true
Expand All @@ -132,8 +120,6 @@ adjust_os() {
386) OS=32-bit ;;
amd64) OS=64-bit ;;
darwin) OS=macOS ;;
linux) OS=Linux ;;
windows) OS=Windows ;;
esac
true
}
Expand All @@ -143,8 +129,6 @@ adjust_arch() {
386) ARCH=32-bit ;;
amd64) ARCH=64-bit ;;
darwin) ARCH=macOS ;;
linux) ARCH=Linux ;;
windows) ARCH=Windows ;;
esac
true
}
Expand Down Expand Up @@ -209,7 +193,9 @@ log_crit() {
uname_os() {
os=$(uname -s | tr '[:upper:]' '[:lower:]')
case "$os" in
msys_nt) os="windows" ;;
cygwin_nt*) os="windows" ;;
mingw*) os="windows" ;;
msys_nt*) os="windows" ;;
esac
echo "$os"
}
Expand Down Expand Up @@ -269,8 +255,8 @@ uname_arch_check() {
untar() {
tarball=$1
case "${tarball}" in
*.tar.gz | *.tgz) tar -xzf "${tarball}" ;;
*.tar) tar -xf "${tarball}" ;;
*.tar.gz | *.tgz) tar --no-same-owner -xzf "${tarball}" ;;
*.tar) tar --no-same-owner -xf "${tarball}" ;;
*.zip) unzip "${tarball}" ;;
*)
log_err "untar unknown archive format for ${tarball}"
Expand Down Expand Up @@ -398,7 +384,7 @@ uname_arch_check "$ARCH"

parse_args "$@"

check_platform
get_binaries

tag_to_version

Expand Down

0 comments on commit 7d56902

Please sign in to comment.