@@ -10,6 +10,13 @@ YELLOW='\033[0;33m'
10
10
GREEN=' \033[0;32m'
11
11
NC=' \033[0m' # No Color
12
12
13
+ # Exports an environment variable to ~/.bashrc
14
+ # $1 is the name of the env var
15
+ # $2 is the value to be exported
16
+ export_env_var () {
17
+ echo " export $1 =$2 " >> ~ /.bashrc
18
+ }
19
+
13
20
# assuming the system is Debian
14
21
printf " ${GREEN} Installing vim, tmux, git, make, unzip, and htop${NC} \n"
15
22
sudo apt-get update
@@ -31,7 +38,8 @@ printf "${GREEN}Configuring git authorization${NC}\n"
31
38
printf " ${YELLOW} Please, generate a 'repo-read' access token for git.\n"
32
39
printf " (See https://github.com/settings/tokens):${NC} "
33
40
read gitkey
34
- echo " export GIT_KEY=$gitkey " >> ~ /.bashrc
41
+ export_env_var " GIT_KEY" " $gitkey "
42
+
35
43
36
44
# then, allow the instance to access github
37
45
ssh-keygen -t ed25519 -f ~ /.ssh/id_ed25519 -N " "
57
65
58
66
sudo apt-get update
59
67
sudo apt-get install docker-ce docker-ce-cli containerd.io -y
60
- echo " export DOCKER_BUILDKIT=1 " >> ~ /.bashrc
68
+ export_env_var " DOCKER_BUILDKIT" " 1 "
61
69
62
70
63
71
printf " ${GREEN} Installing docker-compose${NC} \n"
@@ -66,7 +74,7 @@ sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-
66
74
sudo chmod +x /usr/local/bin/docker-compose
67
75
68
76
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
69
- echo " export COMPOSE_DOCKER_CLI_BUILD=1 " >> ~ /.bashrc
77
+ export_env_var " COMPOSE_DOCKER_CLI_BUILD" " 1 "
70
78
71
79
72
80
printf " ${GREEN} Removing self${NC} \n"
0 commit comments