This repository has been archived by the owner on Sep 2, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
setup.sh
executable file
·81 lines (65 loc) · 1.96 KB
/
setup.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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env bash
# some quick pre-setup for the multi-site demo
function xiterr() { [[ $1 =~ ^[0-9]+$ ]] && { XIT=$1; shift; } || XIT=1; printf "FATAL: $*\n"; exit $XIT; }
export PATH=$HOME/multi-site-demo:$PATH
set -e
# unpack *.gz files - not *.zip files
ZIPS=$(ls -1 *.gz)
ZIPS+=" .terraform/plugins/linux_amd64/terraform-provider-linode_v1.9.0_x4.gz"
( which gunzip > /dev/null ) || xiterr 1 "Unable to fine 'gunzip' in path"
for ZIP in $ZIPS
do
[[ ! -r "$ZIP" ]] && continue || true
echo "Starting gunzip for: $ZIP"
gunzip $ZIP &
done
echo "Waiting for unzip processes to complete..."
wait
source /etc/os-release
case $ID in
centos|rhel|fedora) $PKG="yum -y" ;;
ubuntu|debian) $PKG="apt -y" ;;
*) xiterr 1 "Unsupported platform '$ID', don't know how to install pkg dependencies."
;;
esac
# install packages
echo "Installing required packages..."
$PKG install epel-release
$PKG install git jq docker wget curl vim unzip
# just assuming we're all one big happy systemd family
if $(which systemctl > /dev/null 2>&1 )
then
systemctl daemon-reload
systemctl enable docker
systemctl start docker
else
echo "!!! WARNING - didn't start Docker, no 'systemctl' daemon - make sure Docker is started correctly."
fi
echo ""
# fixup PATHs
printf "Writing updated PATH to .bashrc... "
echo "PATH=$HOME/multi-site-demo:$PATH" >> $HOME/.bashrc
echo "done"
# collect LINODE infoz:
if [[ -z "$LINODE_TOKEN" ]]
then
read -p "Enter LINODE_TOKEN: " LINODE_TOKEN
export LINODE_TOKEN
fi
echo ""
printf "Writing LINODE_TOKEN to .bashrc... "
echo "export LINODE_TOKEN=$LINODE_TOKEN" >> $HOME/.bashrc
echo "done"
echo ""
echo "Updating multi-site-demo content in place"
cd $HOME/multi-site-demo
git pull
echo ""
echo ""
echo "Either log out and back in, or source .bashrc:"
echo ""
echo "source $HOME/.bashrc"
echo ""
echo "Maybe you need to update the 'rackn-license.json' ??"
echo "Maybe upload your own customer Catalog ?? Otherwise the S3 one will be downloaded."
echo ""