diff options
author | Mathias Bynens <mathias@qiwi.be> | 2011-12-29 11:31:11 +0100 |
---|---|---|
committer | Mathias Bynens <mathias@qiwi.be> | 2011-12-29 11:31:11 +0100 |
commit | 147eff27785380412afb352aa9dc050554887fa0 (patch) | |
tree | 1f35e26bac8fb2b2624e0474bfeb75e1da8d2452 /bootstrap.sh | |
parent | 46b82f742b382bcba44da734f454900a223891e2 (diff) | |
download | dotfiles-147eff27785380412afb352aa9dc050554887fa0.tar.gz dotfiles-147eff27785380412afb352aa9dc050554887fa0.tar.bz2 dotfiles-147eff27785380412afb352aa9dc050554887fa0.zip |
Allow running bootstrap.sh with a --force or -f option
This avoids the confirmation prompt.
Diffstat (limited to 'bootstrap.sh')
-rwxr-xr-x | bootstrap.sh | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/bootstrap.sh b/bootstrap.sh index 0d03922..89642fb 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -2,9 +2,17 @@ mkdir -p ~/.vim/{backups,swaps,undo} cd "$(dirname "$0")" git pull -read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 -echo -if [[ $REPLY =~ ^[Yy]$ ]]; then +function doIt() { rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" --exclude "README.md" -av . ~ +} +if [ "$1" == "--force" -o "$1" == "-f" ]; then + doIt +else + read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 + echo + if [[ $REPLY =~ ^[Yy]$ ]]; then + doIt + fi fi -source "$HOME/.bash_profile"
\ No newline at end of file +unset doIt +source ~/.bash_profile
\ No newline at end of file |