blob: 1148b591545ad682759999bd9e310099cc5440ec (
plain)
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
|
#!/bin/sh
# Sets up a custom environment in an Arch installation
getPackageGroup() {
packagesFile="$HOME/repos/privconfigs/packages.txt"
[ -f "$packagesFile" ] || exit 1
group="$1"
sed -n "/^# ${group}/,/^# /p" "$packagesFile" |
sed '/^#/d;/^\s*$/d;s/\s*#.*$//'
}
installPackageGroup() {
getPackageGroup "$1" | sudo pacman -S -
}
prompt() {
echo "$1"
shift
read answer
echo "$answer" | grep -E -q '^[yY]' && eval "$@"
}
# Initialization
server="taamas@taamas.xyz"
installAudio=""
installGraphic=""
# Setup is done from the $HOME directory
cd
# Directory structure
mkdir -p "$HOME/downloads/videos"
mkdir -p "$HOME/downloads/audios"
mkdir -p "$HOME/media/images/screenshots"
mkdir -p "$HOME/media/images/wallpapers/shufs/current"
mkdir "$HOME/logs"
mkdir "$HOME/repos"
# Connect to server
sshKey="$HOME/.ssh/id_rsa_$(hostnamectl hostname)ForXyz"
ssh-keygen -f "$sshKey" && ssh-copy-id -i "$sshKey" "$server"
# Install git to get needed repos
if ! type git; then
echo "Installing git"
type git || sudo pacman -S git
gitName="InigoGutierrez"
gitEmail="inigogf.95@gmail.com"
echo "Setting up git config"
echo "Name: $gitName"
echo "mail: $gitEmail"
git config --global user.name "$gitName"
git config --global user.email "$gitEmail"
echo ""
fi
# Clone scripts and configs repos
if [ ! -d "scripts" ]; then
echo "Cloning scripts repo"
git clone gitea@git.taamas.xyz/Taamas/scripts.git
echo ""
fi
if [ ! -d "repos/configs" ]; then
echo "Cloning configs repo"
(
cd repos
git clone gitea@git.taamas.xyz/Taamas/configs.git
echo ""
)
fi
if [ ! -d "repos/privconfigs" ]; then
echo "Cloning private configs repo"
(
cd repos
git clone taamas@taamas.xyz:~/repos/remotes/privconfigs
echo ""
)
fi
# Stop the satanic bell
sudo echo 'blacklist pcspkr' >/etc/modprobe.d/nobeep.conf
# Pacman config
echo "Adding color and candy to /etc/pacman.conf"
grep -q 'ILoveCandy' /etc/pacman.conf ||
sudo sed -i 's/^#Color.*$/Color\nILoveCandy/' /etc/pacman.conf
# Read programs to install from file
installPackageGroup base
echo "Heavy packages are:"
getPackageGroup heavy
prompt "Install heavy packages? [y/N]" installPackageGroup heavy
prompt "Install audio packages? [y/N]" installAudio="y"
[ -z "$installAudio" ] || installPackageGroup audio
prompt "Install graphic packages? [y/N]" installGraphic="y"
[ -z "$installGraphic" ] || installPackageGroup graphic
# Clone specific programs sources to be compiled and installed later
(
cd "$HOME/repos"
[ ! -d "dmenu" ] && git clone "https://git.suckless.org/dmenu"
[ ! -d "sxiv" ] && git clone "https://github.com/muennich/sxiv"
[ ! -d "yay" ] && git clone "https://aur.archlinux.org/yay.git"
)
# Put config files in place
echo "Putting config files in place"
(
cd "$HOME/repos/configs/stow"
if [ -f "$HOME/.bashrc" ]; then
prompt "Remove .bashrc? If it is the installation default it will prevent stow from loading configs. [y/N]" \
rm "$HOME/.bashrc"
fi
stow -t "$HOME" calcurse
stow -t "$HOME" neofetch
stow -t "$HOME" newsboat
stow -t "$HOME" nvim
stow -t "$HOME" pandoc
stow -t "$HOME" ranger
stow -t "$HOME" rcs
stow -t "$HOME" tmux
stow -t "$HOME" vim
if ! [ -z "$installAudio" ]; then
stow -t "$HOME" cmus
fi
if ! [ -z "$installGraphic" ]; then
stow -t "$HOME" bspwm
stow -t "$HOME" colorschemes
stow -t "$HOME" dunst
stow -t "$HOME" emoji
stow -t "$HOME" mpv
stow -t "$HOME" picom
stow -t "$HOME" qutebrowser
stow -t "$HOME" sxhkd
stow -t "$HOME" sxiv
stow -t "$HOME" XserverDotfiles
stow -t "$HOME" zathura
fi
echo ""
)
# Compile specific programs
echo "Installing some program repos."
(
cd "$HOME/repos"
if ! type dmenu; then
(
echo "Installing dmenu."
echo
cd dmenu
git remote add xyz "${server}:~/repos/remotes/dmenu"
git checkout xyz/taamas
git switch -c taamas
git branch --set-upstream-to=xyz/taamas taamas
make
sudo make install
make clean
)
fi
if ! type sxiv; then
(
echo "Installing sxiv."
echo
cd sxiv
make
sudo make install
make clean
)
fi
if ! type yay; then
(
echo "Installing yay."
echo
cd yay
makepkg -si
)
fi
echo ""
)
# Install programs with yay
prompt "Install yay packages? [y/N]" getPackageGroup 'yay' '|' yay -S -
# Mainpage
if [ ! -d "$HOME/.mainpage" ]; then
(
cd "$HOME/repos"
git clone "https://git.taamas.xyz/Taamas/mainpage"
cp -r "mainpage" "$HOME/.mainpage"
rm -rf "$HOME/.mainpage/.git"
)
fi
# Remove default .bash_profile as it avoids .profile execution
if [ -f ".bash_profile" ]; then
prompt "Remove .bash_profile? It prevents .profile from being executed. [y/N]" \
rm .bash_profile
fi
|