-
Notifications
You must be signed in to change notification settings - Fork 1
/
bootstrap.sh
executable file
·86 lines (65 loc) · 1.75 KB
/
bootstrap.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
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
#!/usr/bin/env bash
#
# bootstrap installs things.
set +e
info () {
printf "\r [ \033[00;34m..\033[0m ] $1\n"
}
user () {
printf "\r [ \033[0;33m??\033[0m ] $1\n"
}
success () {
printf "\r\033[2K [ \033[00;32mOK\033[0m ] $1\n"
}
fail () {
printf "\r\033[2K [\033[0;31mFAIL\033[0m] $1\n"
echo ''
exit
}
setup_gitconfig () {
if ! [ -f git/gitconfig.local.symlink ]
then
info 'Setup gitconfig'
git_credential='cache'
if [ "$(uname -s)" == "Darwin" ]
then
git_credential='osxkeychain'
fi
user ' - What is your github author name?'
read -e git_authorname
user ' - What is your github author email?'
read -e git_authoremail
touch git/gitconfig.local.symlink
sed -e "s/AUTHORNAME/$git_authorname/g" -e "s/AUTHOREMAIL/$git_authoremail/g" -e "s/GIT_CREDENTIAL_HELPER/$git_credential/g" git/gitconfig.local.symlink.example > git/gitconfig.local.symlink
success 'gitconfig'
fi
}
install_dotfiles () {
info 'Installing dotfiles'
local overwrite_all=false backup_all=false skip_all=false
for src in $(find -H ~/.dotfiles -maxdepth 2 -name '*.symlink' -not -path '*.git*')
do
echo "linking $src"
dst="$HOME/.$(basename "${src%.*}")"
if [ $(readlink $dst) ]
then
rm -fr "$dst"
fi
ln -s "$src" "$dst"
done
}
setup_clone () {
cd ~/
git clone https://github.com/slifty/dotfiles.git .dotfiles
cd .dotfiles
}
setup_gitconfig
install_dotfiles
# Run the pre-installers
find . -name preinstall.sh | while read installer ; do sh -c "${installer}" ; done
# Run Homebrew through the Brewfile
info "› brew bundle"
brew bundle
# find the installers and run them iteratively
find . -name install.sh | while read installer ; do sh -c "${installer}" ; done
success 'All installed!'