-
Notifications
You must be signed in to change notification settings - Fork 1
/
provision.sh
155 lines (134 loc) · 4.59 KB
/
provision.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
#Environment
HOME_DIR=/home/vagrant
DOWNLOAD_DIR=${HOME_DIR}/Download
function installWget() {
echo "INSTALLING WGET" \
&& sudo dnf -q install -y wget \
&& echo "WGET DONE"
}
function installNano() {
echo "INSTALLING NANO" \
&& sudo dnf -q install -y nano \
&& echo "NANO DONE"
}
function installGit() {
echo "INSTALLING GIT" \
&& sudo dnf -q install -y git \
&& echo "GIT DONE"
}
function installAtom() {
echo "INSTALLING ATOM" \
&& sudo rpm --import https://packagecloud.io/AtomEditor/atom/gpgkey \
&& sudo sh -c 'echo -e "[Atom]\nname=Atom Editor\nbaseurl=https://packagecloud.io/AtomEditor/atom/el/7/\$basearch\nenabled=1\ngpgcheck=0\nrepo_gpgcheck=1\ngpgkey=https://packagecloud.io/AtomEditor/atom/gpgkey" > /etc/yum.repos.d/atom.repo' \
&& sudo dnf -q install -y atom \
&& echo "ATOM DONE"
}
function installOhMyZsh() {
echo "INSTALLING OH MY ZSH" \
&& sudo dnf -q install -y zsh \
&& sh -c "$(wget -O- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)" \
&& sudo usermod -s /bin/zsh vagrant \
&& mv ${HOME_DIR}/.zshrc-custom ${HOME_DIR}/.zshrc \
&& echo "ZSH DONE"
}
function addToPathAndSource() {
local zshEnvFile=${HOME_DIR}/.zshenv
echo -e $1 >> ${zshEnvFile} && source ${zshEnvFile}
}
function installOpenJdk() {
echo "INSTALLING OPENJDK" \
&& sudo dnf -q install -y java-1.8.0-openjdk-devel \
&& addToPathAndSource 'export JAVA_HOME=/usr/lib/jvm/java-openjdk' \
&& echo "OPENJDK DONE"
}
function installMaven() {
local mavenVersion=3.6.3
echo "INSTALLING MAVEN" \
&& wget -q http://www-eu.apache.org/dist/maven/maven-3/${mavenVersion}/binaries/apache-maven-${mavenVersion}-bin.tar.gz -P ${DOWNLOAD_DIR} \
&& sudo mkdir /opt/maven \
&& sudo tar xzf ${DOWNLOAD_DIR}/apache-maven-${mavenVersion}-bin.tar.gz -C /opt/maven --strip-components=1 \
&& sudo chown -R vagrant:vagrant /opt/maven \
&& addToPathAndSource 'export PATH=$PATH:/opt/maven/bin' \
&& echo "MAVEN DONE"
}
function installGradle() {
local gradleVersion=6.6.1
echo "INSTALLING GRADLE" \
&& wget -q https://services.gradle.org/distributions/gradle-${gradleVersion}-bin.zip -P ${DOWNLOAD_DIR} \
&& unzip -q ${DOWNLOAD_DIR}/gradle-${gradleVersion}-bin.zip -d ${DOWNLOAD_DIR} \
&& sudo mv ${DOWNLOAD_DIR}/gradle-${gradleVersion} /opt/gradle \
&& sudo chown -R vagrant:vagrant /opt/gradle \
&& addToPathAndSource 'export PATH=$PATH:/opt/gradle/bin' \
&& echo "GRADLE DONE"
}
function installFirefox() {
echo "INSTALLING FIREFOX" \
&& sudo dnf -q install -y firefox \
&& echo "FIREFOX DONE"
}
function installNvm() {
local nvmVersion=0.35.3
local defaultNodeVersion=14.10.1
echo "INSTALLING NVM" \
&& wget -qO- https://raw.githubusercontent.com/creationix/nvm/v${nvmVersion}/install.sh | bash \
&& addToPathAndSource 'export NVM_DIR="$HOME/.nvm"\n[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' \
&& nvm install ${defaultNodeVersion} \
&& echo "NVM DONE"
}
function installIntelliJ() {
local intellijVersion=2020.2
echo "INSTALLING INTELLIJ" \
&& wget -q https://download.jetbrains.com/idea/ideaIU-${intellijVersion}.tar.gz -P ${DOWNLOAD_DIR} \
&& sudo mkdir /opt/intellij \
&& sudo tar xzf ${DOWNLOAD_DIR}/ideaIU-${intellijVersion}.tar.gz -C /opt/intellij --strip-components=1 \
&& sudo chown -R vagrant:vagrant /opt/intellij \
&& mkdir -p ${HOME_DIR}/.local/share/applications \
&& echo '[Desktop Entry]
Version=1.0
Type=Application
Name=IntelliJ IDEA Ultimate Edition
Icon=/opt/intellij/bin/idea.svg
Exec="/opt/intellij/bin/idea.sh" %f
Comment=Capable and Ergonomic IDE for JVM
Categories=Development;IDE;
Terminal=false
StartupWMClass=jetbrains-idea' > ${HOME_DIR}/.local/share/applications/jetbrains-idea.desktop \
&& echo "INTELLIJ DONE"
}
function installGnome() {
echo "INSTALLING GNOME (this may take a while)" \
&& sudo dnf -q groupinstall -y gnome-desktop base-x \
&& sudo systemctl set-default graphical.target \
&& echo "GNOME DONE"
}
function setupLocale() {
echo "SETTING UP LOCALE" \
&& sudo localectl set-x11-keymap ch \
&& sudo timedatectl set-timezone Europe/Zurich \
&& echo "LOCALE DONE"
}
function setupWorkspace() {
echo "SETTING UP WORKSPACE" \
&& mkdir ${HOME_DIR}/workspace \
&& echo "WORKSPACE DONE"
}
function cleanup() {
echo "CLEAN UP" \
&& sudo rm -rf ${DOWNLOAD_DIR}/* \
&& echo "CLEAN UP DONE"
}
installWget
installNano
installAtom
installGit
installOhMyZsh
installOpenJdk
installMaven
installGradle
installFirefox
installNvm
installIntelliJ
installGnome
setupLocale
setupWorkspace
cleanup