-
Notifications
You must be signed in to change notification settings - Fork 0
/
old_setup.sh
executable file
·251 lines (217 loc) · 7.46 KB
/
old_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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
#!/usr/bin/env bash
# Before running this script:
# sudo chown -R hugo /usr/local
mode=$1
distro=$(lsb_release -cs)
if [[ $mode = "init" ]]; then
# make in case they aren't already there
mkdir -p "/usr/local/lib"
mkdir -p "/usr/local/bin"
# update the system
sudo apt-get update
sudo apt-get upgrade -y
sudo apt-get dist-upgrade -y
# reboot afterwards
elif [[ $mode = "install" ]]; then
mkdir ~/tmp
sudo apt-get update
# install barebone software
echo "Installing essentials"
sudo apt-get install -y build-essential make git curl gparted preload openssh-server
# generate ssh key
echo "Generating ssh key..."
ssh-keygen -t rsa -b 4096 -C "[email protected]"
# Some git defaults
echo "Setting git defaults..."
cp git/.* ~
# Install nvm
echo "Installing nvm..."
mkdir -p /opt/nvm
export NVM_DIR="/opt/nvm"
curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash
nvm install --lts
curl -o- -L https://yarnpkg.com/install.sh | bash
# Install Node modules
modules=(
np
vtop
surge
vue-cli
)
# Install pip
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
python3 get-pip.py --user
echo "installing node modules..."
yarn global add ${modules[@]}
echo "Installing Ubuntu restricted extras..."
sudo apt-get install -y ubuntu-restricted-extras
echo "Install Java JDK? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
sudo add-apt-repository -y ppa:webupd8team/java
sudo apt-get update
sudo apt-get install -y oracle-java8-installer
sudo apt-get install -y oracle-java8-set-default
fi
echo "Install OCaml? (Y/n)"
read opt
if [[ ${opt,,} = "y" ]]; then
wget https://raw.github.com/ocaml/opam/master/shell/opam_installer.sh -O - | sh -s /usr/local/bin
fi
echo "Install Software pack? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
sudo apt-get update
sudo apt-get install -y synaptic vlc deluge filezilla python-pygame keepassx unetbootin bleachbit
# Utils
sudo apt-get install -y p7zip-full p7zip-rar unrar-free
# Conky
sudo apt-get install conky lm-sensors hddtemp
fi
echo "Install Multimedia pack? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
# Multimedia software
sudo apt-get install -y audacity blender gimp imagemagick cheese inkscape
fi
# Libreoffice
echo "Install Libreoffice? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
sudo add-apt-repository -y ppa:libreoffice/ppa
sudo apt-get update
sudo apt-get install -y libreoffice
fi
# Docker
echo "Install Docker? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
sudo apt-get remove docker docker-engine docker.io
sudo apt-get install \
apt-transport-https \
ca-certificates \
curl \
software-properties-common
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository \
"deb [arch=amd64] https://download.docker.com/linux/ubuntu \
$distro \
stable"
sudo apt-get update
sudo apt-get install docker-ce
sudo usermod -aG docker $USER
fi
# VirtualBox 5.1
echo "Install VirtualBox? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
if [[ $distro = "xenial" ]]; then
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
else
wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -
fi
sudo add-apt-repository "deb http://download.virtualbox.org/virtualbox/debian $distro contrib"
sudo apt-get update
sudo apt-get install -y dkms
sudo apt-get install -y virtualbox-5.2
sudo usermod -aG vboxusers $USER
fi
# Dropbox
echo "Install Dropbox? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
sudo apt-key adv --keyserver pgp.mit.edu --recv-keys 1C61A2656FB57B7E4DE0F4C1FC918B335044912E
sudo add-apt-repository -y "deb http://linux.dropbox.com/ubuntu $distro main"
sudo apt-get update
sudo apt-get install -y dropbox
fi
# PHP --if
echo "Install PHP and Composer? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
sudo apt-get install -y php
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
fi
# Dev tools --if
echo "Install Development tools VSCode and Vagrant? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
if [[ ! -d "$~/tmp" ]]; then
mkdir ~/tmp
fi
wget https://go.microsoft.com/fwlink/?LinkID=760868 -O ~/tmp/vscode.deb
wget -P ~/tmp https://releases.hashicorp.com/vagrant/2.0.4/vagrant_2.0.4_x86_64.deb
sudo dpkg -i ~/tmp/*.deb
fi
# PhpStorm --if
echo "Download PhpStorm? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
wget -P ~/Downloads https://download.jetbrains.com/webide/PhpStorm-2018.1.2.tar.gz
fi
# Laptop battery tools
echo "Laptop battery Tools? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
sudo add-apt-repository ppa:linrunner/tlp
sudo apt-get update
sudo apt-get install tlp tlp-rdw
sudo tlp start
sudo apt-get install -y xbacklight
fi
# Spotify
echo "Install Spotify? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
# 1. Add the Spotify repository signing key to be able to verify downloaded packages
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886
# 2. Add the Spotify repository
echo "deb http://repository.spotify.com stable non-free" | sudo tee /etc/apt/sources.list.d/spotify.list
# 3. Update list of available packages
sudo apt-get update
# 4. Install Spotify
sudo apt-get install -y spotify-client
fi
echo "Creating Work directories"
mkdir ~/Personal
mkdir -p ~/Code
echo "Install Homestead? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
vagrant box add laravel/homestead
git clone https://github.com/laravel/homestead.git /opt/Homestead
bash /opt/Homestead/init.sh
fi
# Clone dotfiles
git clone https://github.com/hmatalonga/dotfiles ~/.dotfiles
# Source dot files
echo '. ~/.dotfiles/bash/.profile' >> ~/.bashrc
source ~/.bashrc
echo "Cleaning setup..."
sudo apt-get autoremove -y
sudo apt-get autoclean -y
sudo apt-get clean 0
rm -rf ~/tmp
sudo apt-get update
elif [[ $mode = "drivers" ]]; then
echo "Graphics card drivers go here..."
sudo apt-get update
sudo apt-get install nvidia-current
elif [[ $mode = "config" ]]; then
echo "Changing ownership of /opt..."
sudo chown $USER:$USER /opt
echo "Adding public DNS nameservers..."
echo -e "nameserver 8.8.8.8\nnameserver 8.8.4.4" | sudo tee /etc/resolvconf/resolv.conf.d/head
sudo resolvconf -u
# fstab
elif [[ $mode = "themes" ]]; then
echo "Install Moka theme? (Y/n):"
read opt
if [[ ${opt,,} = "y" ]]; then
sudo add-apt-repository ppa:moka/daily
sudo apt-get update
sudo apt-get install moka-icon-theme -y
fi
else
echo "Usage: bootstrap {init/install/drivers/config/themes}"
fi