-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.bash
More file actions
102 lines (77 loc) · 1.98 KB
/
setup.bash
File metadata and controls
102 lines (77 loc) · 1.98 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
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/bash
echo -n "Email : "
read email
echo -n "Name : "
read name
# create swap if not present
swap=/swapfile
if [ ! -f $swap ]; then
sudo fallocate -l 1G $swap
sudo chmod 600 $swap
sudo mkswap $swap
sudo swapon /swapfile
echo '/swapfile swap swap defaults 0 0' | sudo tee -a /etc/fstab
cat /etc/fstab
sudo swapon --show
echo 'Press <RETURN>'
read a
fi
# add to ~/.bashrc if needed
grep -Fq ". ~/setup/bash.inc" ~/.bashrc
if [ $? -eq 1 ]
then
echo "add it .bashrc"
printf '\n\n. ~/setup/bash.inc\n' >> ~/.bashrc
fi
# add to ~/.bash_profile if needed
if [ -f ~/.bash_profile ]
then
grep -Fq ". ~/setup/bash.inc" ~/.bash_profile
if [ $? -eq 1 ]
then
echo "add it .bash_profilile"
printf '\n\n. ~/setup/bash.inc\n' >> ~/.bash_profile
fi
else
printf '\n\n. ~/setup/bash.inc\n' >> ~/.bash_profile
fi
. ~/.bash_profile
# add emacs init.el
if [ ! -d ~/.emacs ]; then
mkdir ~/.emacs
fi
if [ ! -f ~/.emacs/init.el ]; then
ln ~/setup/init.el ~/.emacs/init.el
fi
if [ ! -f ~/.ssh/id_rsa ]; then
ssh-keygen -t rsa -b 4096 -C "$email"
ls -l ~/.ssh/
cat ~/.ssh/id_rsa.pub
echo 'Add to GitHub then press <RETURN>'
read a
fi
. apt.bash
# git
git config --global user.email "$email"
git config --global user.name "$name"
# pyenv
if [ ! -d ~/.pyenv/ ]; then
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
pyenv install 3.7.2
pyenv rehash
pyenv global 3.7.2
fi
# docker
pip install docker-compose
pip install --upgrade pip
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
if [ ! -f /etc/apt/sources.list.d/docker.list ]; then
sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get -y install docker-ce docker-ce-cli containerd.io
fi
sudo docker run hello-world
if [ ! -f /etc/docker/daemon.json ]; then
sudo cp daemon.json /etc/docker/daemon.json
fi
cat /etc/docker/daemon.json