/
bootstrap.sh
executable file
·28 lines (25 loc) · 1.35 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
#!/usr/bin/env bash
set -o xtrace
function doIt() {
if [ "$1" "==" "--dry-run" ]; then
find . -type f -not -path "*/.git/*" -not -path "./.DS_Store" -not -path "./.osx" -not -path "./bootstrap.sh" -not -path "./brew.sh" -not -path "./README.md" -not -path "./LICENSE-MIT.txt" -exec echo ~/dotfiles/'{}' "->" ~/'{}' \;
elif [ "$1" "==" "--force" ]; then
echo "forced"
find . -type f -not -path "*/.git/*" -not -path "*/.sl/*" -not -path "./.DS_Store" -not -path "./.osx" -not -path "./bootstrap.sh" -not -path "./README.md" -not -path "./LICENSE-MIT.txt" | gxargs -I{} bash -xc 'cd $HOME; mkdir -pv $(dirname {}) ; ln --symbolic --verbose --force ~/dotfiles/{} ~/{};'
else
echo "NOTE: This will not overwrite any existing files. Rerun with --force to overwrite existing dotfiles"
find . -type f -not -path "*/.git/*" -not -path "*/.sl/*" -not -path "./.DS_Store" -not -path "./.osx" -not -path "./bootstrap.sh" -not -path "./README.md" -not -path "./LICENSE-MIT.txt" | gxargs -I{} bash -xc 'cd $HOME; mkdir -pv $(dirname {}) ; ln --symbolic --verbose ~/dotfiles/{} ~/{};'
fi
set +x
#source ~/.zshrc;
}
if [[ "$1" == "--force" ]]; then
doIt $1;
else
read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " REPLY
if [[ $REPLY =~ ^[Yy]$ ]]; then
doIt $1;
fi;
fi;
unset doIt;
set +x