#!/usr/bin/env bash

cd "$(dirname "${BASH_SOURCE}")";

git pull origin master;

function doIt() {
	rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" \
		--exclude "README.md" --exclude "LICENSE-MIT.txt" -avh --no-perms . ~;
	source ~/.bash_profile;
}

if [ "$SPIN" ]; then
  sudo add-apt-repository ppa:aos1/diff-so-fancy;
  sudo apt-get update;
  sudo apt-get install -y rsync ripgrep fzf spaceship diff-so-fancy;
  doIt;
elif [ "$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;
unset doIt;

#!/usr/bin/env bash

cd "$(dirname "${BASH_SOURCE}")";

git pull origin master;

function doIt() {
	rsync --exclude ".git/" --exclude ".DS_Store" --exclude "bootstrap.sh" \
		--exclude "README.md" --exclude "LICENSE-MIT.txt" -avh --no-perms . ~;
	source ~/.bash_profile;
}

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 -t 5;
	echo "";
	if [[ $? > 128 || $REPLY =~ ^[Yy]$ ]]; then
		doIt;
	fi;
fi;
unset doIt;

--- 
+++ 
@@ -10,17 +10,12 @@
 	source ~/.bash_profile;
 }
 
-if [ "$SPIN" ]; then
-  sudo add-apt-repository ppa:aos1/diff-so-fancy;
-  sudo apt-get update;
-  sudo apt-get install -y rsync ripgrep fzf spaceship diff-so-fancy;
-  doIt;
-elif [ "$1" == "--force" -o "$1" == "-f" ]; then
+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;
+	read -p "This may overwrite existing files in your home directory. Are you sure? (y/n) " -n 1 -t 5;
 	echo "";
-	if [[ $REPLY =~ ^[Yy]$ ]]; then
+	if [[ $? > 128 || $REPLY =~ ^[Yy]$ ]]; then
 		doIt;
 	fi;
 fi;
Remove timeout in install and force it on Spin
