-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall
executable file
·66 lines (52 loc) · 1.35 KB
/
install
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
#!/bin/bash
echo "Installing dotfiles..."
# Working directory
PWD=`pwd`
function remove_config {
if [ -h "$1" ]
then
unlink "$1"
elif [ -f "$1" ]
then
rm "$1"
fi
}
function install_bash_config {
echo " installing Bash profile "
local readonly path="$HOME/.bash_profile"
remove_config "$path"
ln -s "$PWD/.bash_profile" "$path"
}
function install_zsh_config {
echo " installing ZSH profile "
local readonly path="$HOME/.zprofile"
remove_config "$path"
ln -s "$PWD/.zprofile" "$path"
echo " installing ZSH config "
local readonly path="$HOME/.zshrc"
remove_config "$path"
ln -s "$PWD/.zshrc" "$path"
}
function install_git_config {
echo " installing Git configuration "
local readonly path="$HOME/.gitignore"
remove_config "$path"
ln -s "$PWD/.gitignore" "$path"
git config --global core.excludesfile "$path"
}
function install_compose_config {
echo " installing Composer descriptors "
local readonly path="$HOME/.composer"
local readonly lockpath="$path/composer.lock"
local readonly jsonpath="$path/composer.json"
mkdir -p "$path"
remove_config "$lockpath"
remove_config "$jsonpath"
ln -s "$PWD/.composer/composer.json" "$jsonpath"
ln -s "$PWD/.composer/composer.lock" "$lockpath"
}
install_bash_config
install_zsh_config
install_git_config
install_compose_config
echo "Installation finished!"