-
Notifications
You must be signed in to change notification settings - Fork 1
/
install-ubuntu.sh
43 lines (35 loc) · 1.22 KB
/
install-ubuntu.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
#!/bin/sh
{
set -e
SUDO=''
if [ "$(id -u)" != "0" ]; then
SUDO='sudo'
echo "This script requires superuser access to install apt packages."
echo "You will be prompted for your password by sudo."
# clear any previous sudo permission
sudo -k
fi
# run inside sudo
$SUDO sh <<SCRIPT
set -ex
# if apt-transport-https is not installed, clear out old sources, update, then install apt-transport-https
dpkg -s apt-transport-https 1>/dev/null 2>/dev/null || \
(echo "" > /etc/apt/sources.list.d/cloudgraph.list \
&& apt-get update \
&& apt-get install -y apt-transport-https)
# add CloudGraph repository to apt
echo "deb https://cli-assets.cloudgraph.dev/apt ./" > /etc/apt/sources.list.d/cloudgraph.list
# remove toolbelt
(dpkg -s heroku-toolbelt 1>/dev/null 2>/dev/null && (apt-get remove -y heroku-toolbelt heroku || true)) || true
# install heroku's release key for package verification
curl https://cli-assets.cloudgraph.dev/apt/release.key | apt-key add -
# update your sources
apt-get update
# install the toolbelt
apt-get install -y cloudgraph
SCRIPT
# test the CLI
LOCATION=$(which cg)
echo "cloudgraph installed to $LOCATION"
cg version
}