From beb88df7e3c5a6af7b62e4bf78de592359a31526 Mon Sep 17 00:00:00 2001 From: Evgeny Aleksandrov Date: Mon, 26 Aug 2019 10:02:54 +0300 Subject: [PATCH] Update dotfiles install flow --- .bash/bash_profile | 1 - .bash/dotfilesrc | 4 ---- .gitignore | 20 +++++++++++++++----- README.md | 11 +---------- bootstrap.sh | 30 ++++++++++++++++++++++++++++++ 5 files changed, 46 insertions(+), 20 deletions(-) delete mode 100644 .bash/dotfilesrc create mode 100644 bootstrap.sh diff --git a/.bash/bash_profile b/.bash/bash_profile index 1a0de12..18688a6 100644 --- a/.bash/bash_profile +++ b/.bash/bash_profile @@ -7,4 +7,3 @@ so ~/.bash/prompt # so ~/.bash/aliases # so ~/.bash/functions # so ~/.bash/path # -so ~/.bash/dotfilesrc # git-dotfiles specific stuff diff --git a/.bash/dotfilesrc b/.bash/dotfilesrc deleted file mode 100644 index 44a94f9..0000000 --- a/.bash/dotfilesrc +++ /dev/null @@ -1,4 +0,0 @@ -# http://gmarik.info/blog/2010/05/02/tracking-dotfiles-with-git - -alias .G="git --work-tree=$HOME --git-dir=$HOME/.dotfiles.git" -complete -o default -o nospace -F _git .G # allow git-completion to work with alias aswell diff --git a/.gitignore b/.gitignore index 7efecad..beb60a9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,16 @@ -# ignore all by default -/* +# OS noise +Desktop.ini +[Tt]humbs.db +.Spotlight-V100 +*.DS_Store +.Trashes +._* +*~ +*.swp +*.out +*.bak* -# do not ignore: -!.bash/ -!.macos/ +#Other CSM +.hg +.svn +CVS diff --git a/README.md b/README.md index af3ffcf..003b042 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,7 @@ ## How To Use It ``` shell -git clone --bare git://github.com/ealeksandrov/dotfiles.git ~/dotfiles.git -#setup bash alias -alias .G="git --git-dir=$HOME/dotfiles.git --work-tree=$HOME/" - -# commit original files in orig branch for backup -# WARNING: backup what's going to be overwritten -.G status -s -uno # review changelist -.G checkout -b original_files -.G commit -a -m 'original files' -.G checkout master +git clone https://github.com/ealeksandrov/dotfiles.git && cd dotfiles && source bootstrap.sh ``` ## Clean system install diff --git a/bootstrap.sh b/bootstrap.sh new file mode 100644 index 0000000..43e14ab --- /dev/null +++ b/bootstrap.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash + +cd "$(dirname "${BASH_SOURCE}")"; + +git pull origin master; + +function doIt() { + rsync --exclude ".git/" \ + --exclude ".DS_Store" \ + --exclude "iterm2/" \ + --exclude "bootstrap.sh" \ + --exclude ".macos" \ + --exclude "brewfile" \ + --exclude "bootstrap.sh" \ + --exclude "README.md" \ + --exclude "LICENSE" \ + -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; + echo ""; + if [[ $REPLY =~ ^[Yy]$ ]]; then + doIt; + fi; +fi; +unset doIt;