summaryrefslogtreecommitdiff
path: root/install.sh
blob: 7de9fe7ad3430427c495dd5a5220c6525133cd17 (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
#!/bin/bash 

# Programs:
# compton: Compositor
# xterm fo default terminal

#Configs for home dir
MODULES=(.i3 .vim .xinitrc .compton.conf .bashrc .Xresources .radare2rc .bash_profile)

#Configs for .config
CFGFOLDER=(polybar powerline nvim termite)

#Scripts
SCRIPTS=()

#1: message
yes_no()
{
	read -p "$1 (y/[n])" inp
	case $inp in
		[yY]* ) return 1;;
		* ) 	return 0;;
	esac
}

#1: source 2: destination
link()
{
	if [ -e $2 ]
	then
		yes_no "$(basename $2) exists. Overwrite?"
		if [ $? -eq 0 ]
		then
			return
		fi

		if [ -d $2 ]
		then
			rm -R $2
		else
			rm $2
		fi
	fi

	ln -s "$1" "$2"
}

echo Configs to install: ${MODULES[@]} ${CFGFOLDER[@]}

git submodule init
git submodule update

for mod in ${MODULES[@]}; do
	yes_no "Install $mod?"
	#ln -s --backup $(pwd)/$mod/ ~/$mod/
	if [ $? -eq 1 ]
	then
		link "$(pwd)/$(dirname $0)/$mod" "$HOME/$mod"
	fi
done

for mod in ${CFGFOLDER[@]}; do
	#ln -s --backup $(pwd)/$mod/ ~/.config/$mod/
	yes_no "Install $mod?"
	if [ $? -eq 1 ]
	then
		link "$(pwd)/$(dirname $0)/$mod" "$HOME/.config/$mod"
	fi
done