Allow running bootstrap.sh with a --force or -f option

This avoids the confirmation prompt.
This commit is contained in:
Mathias Bynens
2011-12-29 11:31:11 +01:00
parent 46b82f742b
commit 147eff2778
+12 -4
View File
@@ -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"
unset doIt
source ~/.bash_profile