aboutsummaryrefslogtreecommitdiff
path: root/archSetup.sh
blob: 0c6ba91eba93dd75c799f9cf15fe8cff1d4c4e0e (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
#!/bin/sh

# Sets up a custom environment in an Arch installation

# Initialization
packagesFile="$HOME/repos/configs/packages.txt"

# Setup is done from the $HOME directory
cd

# 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

# Install git to get needed repos
if ! type git; then
	echo "Installing git"
	type git || sudo pacman -S git
	echo "Setting up git config."
	git config --global user.name "InigoGutierrez"
	git config --global user.email "inigogf.95@gmail.com"
	echo ""
fi

mkdir "repos"

# Clone scripts and configs repos
if [ ! -d "scripts" ]; then
	echo "Cloning scripts repo"
	git clone https://github.com/InigoGutierrez/scripts
	echo ""
fi
if [ ! -d "repos/configs" ]; then
	echo "Cloning configs repo"
	(
	cd repos
	git clone https://github.com/InigoGutierrez/configs
	echo ""
	)
fi

# Read programs to install from file
sed -n '/^# pacman/,/^# yay/p' "$packagesFile" | sed '/^#/d' | sudo pacman -S -

# 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"
sh setup.sh
echo ""
)

# Compile specific programs

echo "Installing some program repos."
(
cd "$HOME/repos"
if ! type dmenu; then
	(
	cd dmenu
	make
	sudo make install
	make clean
	)
fi

if ! type sxiv; then
	(
	cd sxiv
	make
	sudo make install
	make clean
	)
fi

if ! type yay; then
	(
	cd yay
	makepkg -si
	)
fi
echo ""
)

# Install programs with yay
sed -n '/^# yay/,$p' "$packagesFile" | sed '/^#/d' | yay -S -

# Directory structure
mkdir -p "$HOME/downloads/videos"
mkdir -p "$HOME/downloads/audios"
mkdir -p "$HOME/images/screenshots"
mkdir -p "$HOME/images/wallpapers/shufs/current"

# Mainpage
(
cd "$HOME/repos"
git clone "https://github.com/InigoGutierrez/mainpage.git"
cp -r "mainpage" "$HOME/.mainpage"
rm -rf "$HOME/.mainpage/.git"
)

# Set up nvim (as in nvim-from-vim)
mkdir -p "$HOME/.config/nvim"
echo "set runtimepath^=~/.vim runtimepath+=~/.vim/after
let &packpath = &runtimepath
source ~/.vimrc" >"$HOME/.config/nvim/init.vim"

# vim-plug
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
    https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim

# Remove default .bash_profile as it avoids .profile execution
if [ -f ".bash_profile" ]; then
	echo "Remove .bash_profile? It prevents .profile from being executed. [y/N]"
	read answer
	echo "$answer" | grep -E -q '^[yY]' && rm .bash_profile
fi