-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
executable file
·56 lines (49 loc) · 1.09 KB
/
install.sh
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/env bash
# brew install zsh-syntax-highlighting
# brew install zsh-autosuggestions
# brew install fzf
function installDotfiles() {
scriptFor "brew"
scriptFor "git"
scriptFor "git" "semantic-commits.sh"
installFor "zsh/zshrc" "zshrc"
installFor "zsh/p10k.zsh" "p10k.zsh"
installFor "zsh/environment.sh" "zsh/environment.sh" "zsh"
installFor "zsh/scripts/" "zsh/scripts/" "zsh/"
installFor "zsh/.config/" "zsh/.config/" "zsh/"
}
## $1 = FROM
## $2 = TO
## $3 = IN
function installFor() {
FROM=$1
if [ "$2" == "" ]; then
TO=$FROM
else
TO=$2
fi
if [ "$3" != "" ]; then
mkdir -p ~/.$3
fi
echo "Linking $FROM to ~/.$TO..."
rm ~/.$TO 2>/dev/null
ln -s $PWD/$FROM ~/.$TO
}
function scriptFor() {
if [ "$#" == 2 ]; then
echo "Installing $1/$2..."
. $1/$2
else
echo "Installing $1..."
. $1/install.sh
fi
}
if [ "$1" == "--force" -o "$1" == "-f" ]; then
installDotfiles
else
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1
echo ""
if [[ $REPLY =~ ^[Yy]$ ]]; then
installDotfiles
fi
fi