Created
April 12, 2020 16:06
-
-
Save sidoh/a6ac92f5355cd8f498e1a16c2b93cb70 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat ~/code/me/dotfiles/install.sh | |
#!/bin/bash | |
set -eo pipefail | |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | |
if [ ! -e ~/.oh-my-zsh ]; then | |
echo "Installing oh-my-zsh..." | |
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh | |
fi | |
if [ ! -e ~/.vim/autoload ]; then | |
echo "Installing vim pathogen..." | |
mkdir -p ~/.vim/autoload ~/.vim/bundle | |
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim | |
fi | |
for dotfile in $(find $DIR -type f | grep -v "\/\.git\/" | grep -v "install\.sh"); do | |
base_dotfile=${dotfile#$DIR} | |
echo "Installing $base_dotfile" | |
skip="" | |
if [ -e ~/$base_dotfile ]; then | |
read -p "$base_dotfile already exists in ~. Overwrite?" -n 1 -r | |
echo | |
if [[ ! $REPLY =~ ^[Yy]$ ]]; then | |
skip='yes' | |
fi | |
fi | |
if [ -z "$skip" ]; then | |
mkdir -p ~/$(dirname $base_dotfile) | |
rm -rf ~/$base_dotfile | |
ln -s $dotfile ~/$base_dotfile | |
else | |
echo "skipped $base_dotfile" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment