-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
executable file
·202 lines (159 loc) · 6.74 KB
/
Makefile
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
include config/utils
include config/variables
include config/functions
IS_ROOT = $(shell id -u)
ifneq ($(IS_ROOT), 0)
$(error This script must be run as root)
endif
SUDO_HOME = $(shell sudo -H echo $(HOME))
ifneq ($(SUDO_HOME), $(HOME))
$(error SUDO_HOME "$(SUDO_HOME)" is not equal to "$(HOME)")
endif
.DEFAULT_GOAL := run
.PHONY: data config
run: setup install install-apps post-install post-setup data vcs finish ##Run default installation set
#=====================================================================
### Setup requirements for installation procedures ###################
#=====================================================================
setup: setup-apt setup-dirs
setup-apt: ##Add all repositories to apt
$(call TITLE, UPDATE APT)
apt-get update
setup-dirs: ##Create folder for tar apps to install in
$(call TITLE, CREATING .APPS DIR)
$(call MKDIR,$(APPS))
#=====================================================
### Update various package managers ##################
#=====================================================
update: update-apt
update-apt:
$(call TITLE, UPDATE APT)
apt-get update
#===========================================
### Installation for package managers ######
#===========================================
install: install-drivers install-apt install-snap install-nvm
install-drivers:
$(call TITLE, INSTALL DRIVERS)
ubuntu-drivers autoinstall
install-apt:
$(call TITLE, INSTALL APT PACKAGES)
$(call INSTALL,apt-get -y install,apt)
install-snap:
$(call TITLE, INSTALL SNAP PACKAGES)
$(call INSTALL_LOOP,snap install --classic,snap)
install-nvm:
$(call TITLE, INSTALL NVM)
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/$(NVM)/install.sh | bash
#===========================================
### Installation for applications ##########
#===========================================
install-apps: install-apps-intellij install-apps-docker
install-apps-intellij:
$(call TITLE, INSTALL INTELLIJ)
$(call WGET_TAR,intellij.tar.gz,https://download.jetbrains.com/idea/ideaIU-$(IDEA).tar.gz,.)
$(call LINK_BIN,$$(find $(APPS) -regex '.*\/idea-IU-.*/bin/idea'),idea)
install-apps-pycharm:
$(call TITLE, INSTALL PYCHARM)
$(call WGET_TAR,pycharm.tar.gz,https://download.jetbrains.com/python/pycharm-community-$(PYCHARM).tar.gz,.)
$(call LINK_BIN,$$(find $(APPS) -regex '.*\/pycharm-.*/bin/pycharm'),pycharm)
install-apps-docker:
$(call TITLE, INSTALL DOCKER)
curl -fsSL https://get.docker.com -o /tmp/get-docker.sh
sh /tmp/get-docker.sh
apt install docker-compose
install-apps-tinkey:
$(call TITLE, INSTALL TINKEY)
$(call WGET_TAR,tinkey.tar.gz,https://storage.googleapis.com/tinkey/tinkey-$(TINKEY).tar.gz,tinkey)
$(call LINK_BIN,$(APPS)/tinkey/tinkey,tinkey)
$(call LINK_BIN,$(APPS)/tinkey/tinkey_deploy.jar,tinkey_deploy.jar)
#============================================
### Post installation procedures ############
#============================================
post-install: ##Install zsh, fonts
$(call TITLE, POST APT AUTOREMOVE)
apt autoremove
$(call TITLE, POST INSTALL ZSH TOOLS)
wget -O- https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh | sh
echo
$(call GIT_CLONE,https://github.com/zsh-users/zsh-syntax-highlighting.git,~/.oh-my-zsh/plugins/zsh-syntax-highlighting)
$(call TITLE, POST INSTALL CODE FONTS)
$(call WGET_TAR,dejavu-code-ttf,https://github.com/SSNikolaevich/DejaVuSansCode/releases/download/v$(CODE_FONTS)/dejavu-code-ttf-$(CODE_FONTS).tar.bz2,.)
cp -v $(APPS)/dejavu-code-ttf-$(CODE_FONTS)/ttf/* /usr/local/share/fonts
fc-cache -f
echo
$(call INFO,installed fonts [DejaVuSansCode])
fc-list | grep "DejaVuSansCode"
#====================================================
### Post installation setup procedures ##############
#====================================================
post-setup: ##Setup inotify, alternatives, vcs, clean home directory
$(call TITLE, POST SETUP INOTIFY)
grep -q -F 'fs.inotify.max_user_watches' /etc/sysctl.conf || echo 'fs.inotify.max_user_watches = 524288' | sudo tee --append /etc/sysctl.conf > /dev/null
sysctl -p #Update inotify
$(call TITLE, POST SETUP HOME DIRECTORY)
rm -rfv ~/Desktop
rm -rfv ~/Music
rm -rfv ~/Public
rm -rfv ~/Videos
rm -rfv ~/Documents
rm -rfv ~/Pictures
rm -rfv ~/Templates
rm -rfv ~/examples.desktop
$(call INFO,home directory: $$(ls -l $(HOME)))
$(call TITLE, POST SETUP ALTERNATIVES)
update-alternatives --config x-www-browser
update-alternatives --config x-terminal-emulator
$(call TITLE, POST SETUP SHELL)
$(call INFO,$$(grep $(USER) /etc/passwd | sed -e 's/.*,,,://g'))
usermod --shell $$(which zsh) $(USER)
$(call INFO,$$(grep $(USER) /etc/passwd | sed -e 's/.*,,,://g'))
$(call TITLE, POST SETUP LINKS)
$(call LINK_BIN,/usr/bin/timew,t)
#=====================================================================
### Setup and copy all dotfiles to home directory ####################
#=====================================================================
data: ##Setup i3 background, scripts and dotfiles
$(call TITLE, CREATE i3 DIR)
mkdir -p ~/.i3
$(call TITLE, COPY BACKGROUND)
cp -rv $(BACKGROUND) ~/.i3
$(call TITLE, COPY DOTFILES)
for fpath in $(DOTFILES)/*; do
newPath=$$(echo $$fpath | sed -e 's/^.*\///g' -e 's/_|_/\//g' -e "s/~/\/home\/${USER}/g")
mkdir -p $$(dirname $$newPath)
cp $$fpath $$newPath
sed -i -e "s/USER/${USER}/g" -e "s/EMAIL/${EMAIL}/g" $$newPath
printf "%-35s -> %s\n" $$(basename $$fpath) $$newPath
done
#=====================================================================
### Setup your own vcs ####################
#=====================================================================
vcs: vcs-setup vcs-jetbrains
vcs-setup: ##Create vcs directory and clone repos
$(call TITLE, POST SETUP VCS)
$(call MKDIR,$(VCS))
$(call GIT_CLONE,https://github.com/$(AUTHOR)/mylinux.git,$(VCS)/mylinux)
$(call GIT_CLONE,https://github.com/$(AUTHOR)/jetbrains.git,$(VCS)/jetbrains)
vcs-jetbrains: ##Install my repositories
$(call TITLE, POST SETUP JETBRAINS)
cd $(VCS)/jetbrains; make install || echo "Jetbrains installation failed..."
#=====================================================================
### Finish procedure #################################################
#=====================================================================
finish: ##Finish procedure (user permissions, rebooting)
$(call TITLE, POST SETUP CHOWN HOME DIR)
chown -R $(USER) $(HOME)
$(call INFO,folder \"$(HOME)\" now belongs to \"$(USER)\")
chmod 777 $(BIN) -R
$(call INFO,folder \"$(BIN)\" now belongs to \"$(USER)\")
$(call TITLE, RESTARTING)
read -p "Reboot the sistem? (y/n): " -n 1 -r
echo
if [[ $$REPLY =~ ^[Yy] ]]; then
$(call ALERT,rebooting the sistem...)
reboot
else
echo
$(call ALERT,you should reboot the sistem ASAP...)
fi