summary refs log tree commit diff stats
path: root/install.sh
blob: bbdb7ead18e397466e7c0ea4c726ebe9bf25f1cb (plain) (blame)
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
#!/usr/bin/bash

# cd into script path
SCRIPT=$(readlink -f "$0")
SCRIPTPATH=$(dirname "$SCRIPT")
cd $SCRIPTPATH

# Ignore list
IGNORE=("bin" "wallpaper" "install.sh" ".git" "scripts" "git")

printf "Start installing dotfiles\n\n"
printf "Ignore: %s\n" "${IGNORE[@]}"
printf "\n"

# Install stow, if not installed
pacman -Q | grep stow 1>/dev/null
if [ $? != 0 ]; then
    printf "Installing stow\n"
    sudo pacman -S stow
else
    printf "Stow is already installed\n"
fi

# Prevent from symlinking whole directory
if [ ! -d "/home/chris/.gnupg" ]; then
    printf "Creating ~/.gnupg\n\n"
    mkdir ~/.gnupg
else
    printf "~/.gnupg is already available\n\n"
fi

# Setting up all the symlinks
max=${#IGNORE[@]}
max=$((max-1))

for f in *; do
	ignored=false

    #Check if package is in ignore list
	for i in `seq 0 $max`
	do

		if [[ ${IGNORE[$i]} == $f ]]; then
			ignored=true
		fi

	done

    # Create symlink if not ignored
	if [[ $ignored == false ]]; then
        printf "Symlink for $f created\n"
		stow "$f"
	fi
done

printf "\nDone\n"