-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
46 lines (36 loc) · 1.23 KB
/
Copy pathinstall.sh
File metadata and controls
46 lines (36 loc) · 1.23 KB
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
#!/usr/bin/env bash
set -e
export VERSION="${VERSION:-latest}"
export DESTDIR="${DESTDIR:-/usr/local/bin}"
if [[ "$VERSION" = "latest" ]]; then {
# The remote script treats empty input as "latest"
unset VERSION
} fi
apt_get_update()
{
if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then
echo "Running apt-get update..."
apt-get update -y
fi
}
# Checks if packages are installed and installs them if not
check_packages() {
if ! dpkg -s "$@" > /dev/null 2>&1; then
apt_get_update
apt-get -y install --no-install-recommends "$@"
fi
}
export DEBIAN_FRONTEND=noninteractive
check_packages curl ca-certificates bash-completion
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | bash
# Set telemetry or ignore if the subcommand does not exist.
circleci --skip-update-check telemetry $TELEMETRY || true
if [ "$COMPLETIONS" = "true" ]; then {
# circleci bash completion
mkdir -p /etc/bash_completion.d
circleci completion bash > /etc/bash_completion.d/circleci
# circleci zsh completion
if [ -e "/usr/share/zsh/vendor-completions" ]; then
circleci completion zsh > /usr/share/zsh/vendor-completions/_circleci
fi
} fi