зеркало из https://github.com/golang/dep.git
Added .exe suffix for windows binary; Added DEP_FAKE_* variables for testing and unusual scenarios
This commit is contained in:
Родитель
e0bb5ac8ff
Коммит
4f2a7ab76f
17
install.sh
17
install.sh
|
@ -9,6 +9,8 @@
|
|||
# Environment variables:
|
||||
# - INSTALL_DIRECTORY (optional): defaults to $GOPATH/bin
|
||||
# - DEP_RELEASE_TAG (optional): defaults to fetching the latest release
|
||||
# - DEP_FAKE_OS (optional): use a fake value for OS (mostly for testing)
|
||||
# - DEP_FAKE_ARCH (optional): use a fake value for ARCH (mostly for testing)
|
||||
#
|
||||
# You can install using this script:
|
||||
# $ curl https://raw.githubusercontent.com/golang/dep/master/install.sh | sh
|
||||
|
@ -78,6 +80,10 @@ findGoBinDirectory() {
|
|||
|
||||
initArch() {
|
||||
ARCH=$(uname -m)
|
||||
if [ -n "$DEP_FAKE_ARCH" ]; then
|
||||
echo "Using DEP_FAKE_ARCH"
|
||||
ARCH="$DEP_FAKE_ARCH"
|
||||
fi
|
||||
case $ARCH in
|
||||
amd64) ARCH="amd64";;
|
||||
x86_64) ARCH="amd64";;
|
||||
|
@ -89,7 +95,10 @@ initArch() {
|
|||
|
||||
initOS() {
|
||||
OS=$(uname | tr '[:upper:]' '[:lower:]')
|
||||
|
||||
if [ -n "$DEP_FAKE_OS" ]; then
|
||||
echo "Using DEP_FAKE_OS"
|
||||
OS="$DEP_FAKE_OS"
|
||||
fi
|
||||
case "$OS" in
|
||||
darwin) OS='darwin';;
|
||||
linux) OS='linux';;
|
||||
|
@ -105,6 +114,7 @@ initOS() {
|
|||
initArch
|
||||
initOS
|
||||
|
||||
# determine install directory if required
|
||||
if [ -z "$INSTALL_DIRECTORY" ]; then
|
||||
findGoBinDirectory INSTALL_DIRECTORY
|
||||
fi
|
||||
|
@ -113,6 +123,11 @@ echo "Will install into $INSTALL_DIRECTORY"
|
|||
# assemble expected release artifact name
|
||||
BINARY="dep-${OS}-${ARCH}"
|
||||
|
||||
# add .exe if on windows
|
||||
if [ "$OS" = "windows" ]; then
|
||||
BINARY="$BINARY.exe"
|
||||
fi
|
||||
|
||||
# if DEP_RELEASE_TAG was not provided, assume latest
|
||||
if [ -z "$DEP_RELEASE_TAG" ]; then
|
||||
downloadJSON LATEST_RELEASE "$RELEASES_URL/latest"
|
||||
|
|
Загрузка…
Ссылка в новой задаче