Skip to content

Commit 22d5def

Browse files
committed
adds setup.sh
1 parent 0e647dc commit 22d5def

File tree

2 files changed

+57
-15
lines changed

2 files changed

+57
-15
lines changed

dotfiles/install.sh

+24-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#!/bin/bash -exu
1+
#!/bin/bash
2+
set -eu
23

34
readonly PROGDIR="$(cd "$(dirname "${0}")" && pwd)"
45
readonly WORKSPACE="${HOME}/workspace"
@@ -30,6 +31,8 @@ function main() {
3031
}
3132

3233
function install::neovim() {
34+
echo "* Installing neovim"
35+
3336
wget --quiet https://github.com/neovim/neovim/releases/download/nightly/nvim.appimage --output-document nvim
3437
chmod +x nvim
3538
chown root:root nvim
@@ -47,6 +50,8 @@ function install::neovim() {
4750
}
4851

4952
function install::go() {
53+
echo "* Installing go"
54+
5055
curl -L -o /tmp/golang.tgz "https://dl.google.com/go/$(curl https://golang.org/VERSION?m=text).linux-amd64.tar.gz"
5156
tar -C /usr/local -xzf /tmp/golang.tgz
5257
export PATH=$PATH:/usr/local/go/bin
@@ -55,7 +60,9 @@ function install::go() {
5560
}
5661

5762
function install::docker() {
58-
DEBIAN_FRONTEND=noninteractive apt-get install -y \
63+
echo "* Installing docker"
64+
65+
apt-get install -y \
5966
apt-transport-https \
6067
ca-certificates \
6168
curl \
@@ -69,31 +76,34 @@ function install::docker() {
6976
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
7077
$(lsb_release -cs) stable"
7178

72-
DEBIAN_FRONTEND=noninteractive apt-get -y update
73-
DEBIAN_FRONTEND=noninteractive apt-get install -y docker-ce docker-ce-cli containerd.io
79+
apt-get -y update
80+
apt-get install -y docker-ce docker-ce-cli containerd.io
7481

7582
usermod -aG docker ubuntu
7683
}
7784

7885
function install::packages() {
79-
DEBIAN_FRONTEND=noninteractive apt-get -y update
80-
DEBIAN_FRONTEND=noninteractive apt-get -y upgrade
86+
echo "* Installing some useful programs"
8187

82-
DEBIAN_FRONTEND=noninteractive apt-get install -y bash-completion
83-
DEBIAN_FRONTEND=noninteractive apt-get install -y jq
84-
DEBIAN_FRONTEND=noninteractive apt-get install -y gcc
88+
apt-get -y update
89+
apt-get -y upgrade
90+
91+
apt-get install -y bash-completion
92+
apt-get install -y jq
93+
apt-get install -y gcc
8594

8695
curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
87-
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y nodejs
96+
sudo apt-get install -y nodejs
8897

89-
DEBIAN_FRONTEND=noninteractive apt-get install -y shellcheck
90-
DEBIAN_FRONTEND=noninteractive apt-get install -y silversearcher-ag
91-
DEBIAN_FRONTEND=noninteractive apt-get install -y python3-pip
98+
apt-get install -y shellcheck
99+
apt-get install -y silversearcher-ag
100+
apt-get install -y python3-pip
92101
}
93102

94103
function install::lpass() {
104+
echo "* Installing the lastpass cli"
105+
95106
apt-get --no-install-recommends -yqq install \
96-
bash-completion \
97107
build-essential \
98108
cmake \
99109
libcurl4 \
@@ -117,7 +127,6 @@ function install::lpass() {
117127

118128
rm -rf /tmp/lpass
119129
rm -rf /tmp/lpass.tgz
120-
121130
}
122131

123132
main

setup.sh

+33
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#!/usr/bin/env bash
2+
set -eu
3+
set -o pipefail
4+
5+
readonly PROGDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
7+
function main() {
8+
pushd "${PROGDIR}/terraform" > /dev/null
9+
terraform apply
10+
terraform output ssh_private_key > /tmp/key
11+
chmod 600 /tmp/key
12+
13+
ssh-keygen -f "${HOME}/.ssh/known_hosts" -R "$(terraform output vm_ip)"
14+
15+
echo "waiting for vm"
16+
while ! ping -c 1 -n -w 1 "$(terraform output vm_ip)" &> /dev/null
17+
do
18+
printf "%c" "."
19+
done
20+
21+
ssh -i /tmp/key "ubuntu@$(terraform output vm_ip)" <<'ENDSSH'
22+
echo "HELLO"
23+
pushd "${HOME}" > /dev/null
24+
git clone https://github.com/joshzarrabi/workstation
25+
pushd workstation/dotfiles > /dev/null
26+
sudo ./install.sh
27+
popd > /dev/null
28+
popd > /dev/null
29+
ENDSSH
30+
popd
31+
}
32+
33+
main

0 commit comments

Comments
 (0)