forked from scylladb/scylla-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-dependencies.sh
executable file
·64 lines (53 loc) · 1.69 KB
/
install-dependencies.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
#!/usr/bin/env bash
#
# Copyright (C) 2017 ScyllaDB
#
set -eu -o pipefail
LINUX_PKGS="docker-compose jq make moreutils openssl"
GO_PKGS="
golangci-lint github.com/golangci/golangci-lint/cmd/golangci-lint
goreleaser github.com/goreleaser/goreleaser
license-detector github.com/go-enry/go-license-detector/v4/cmd/license-detector
mockgen github.com/golang/mock/mockgen
schemagen github.com/scylladb/gocqlx/v2/cmd/schemagen
stress golang.org/x/tools/cmd/stress
sup github.com/pressly/sup/cmd/sup
swagger github.com/go-swagger/go-swagger/cmd/swagger
yq github.com/mikefarah/yq/v3/cmd
"
source ./env
mkdir -p ${LOCAL_BIN}
if [ -f /etc/os-release ]; then
echo "==> Installing system packages"
DISTRO=$(cat /etc/os-release | grep '^ID=' | cut -d= -f2)||:
case ${DISTRO} in
"fedora")
sudo dnf install ${LINUX_PKGS}
;;
"ubuntu")
echo "> Updating package information from configured sources"
sudo apt-get update
echo "> Installing required system packages"
sudo apt-get install ${LINUX_PKGS}
;;
*)
echo "Your OS ${DISTRO} is not supported, conciser switching to Fedora"
;;
esac
fi
echo "==> Cleaning ${LOCAL_BIN}"
rm -f "${LOCAL_BIN}"/*
echo "==> Installing Go packages at ${LOCAL_BIN}"
function install() {
echo "$1 ($2)"
pushd mod > /dev/null
go build -mod=readonly -o "${LOCAL_BIN}/$1" ${2}
popd > /dev/null
}
pkgs=($(echo "${GO_PKGS}" | sed 's/\s+/\n/g'))
for i in "${!pkgs[@]}"; do
if [[ $(($i % 2)) == 0 ]]; then
install ${pkgs[$i]} ${pkgs[$((i+1))]}
fi
done
echo "==> Complete!"