PageRenderTime 88ms CodeModel.GetById 14ms RepoModel.GetById 1ms app.codeStats 0ms

/setup.sh

http://github.com/kfieldho/localfiles
Shell | 79 lines | 41 code | 21 blank | 17 comment | 26 complexity | c9373451f6eff8454227a73d3c351c8d MD5 | raw file
  1. #!/bin/bash
  2. # curl https://raw.github.com/kfieldho/localfiles/master/setup.sh
  3. # bash setup.sh
  4. NOW=$(date +"%Y-%m-%d-%H-%M-%S")
  5. dot_local_repo="https://github.com/kfieldho/localfiles.git"
  6. dot_vim_repo="https://github.com/kfieldho/vimfiles.git"
  7. fzf_repo="https://github.com/junegunn/fzf"
  8. platformstr=$(uname)
  9. rg_repo=""
  10. if [ $platformstr == "Linux" ]; then
  11. rg_repo="https://github.com/BurntSushi/ripgrep/releases/download/0.7.1/ripgrep-0.7.1-i686-unknown-linux-musl.tar.gz"
  12. fi
  13. if [ $platformstr == "Darwin" ]; then
  14. rg_repo="https://github.com/BurntSushi/ripgrep/releases/download/0.7.1/ripgrep-0.7.1-x86_64-apple-darwin.tar.gz"
  15. fi
  16. if [ ! -z rg_repo ]; then
  17. mkdir -p ~/.rg
  18. wget -qO- ${rg_repo} | tar xzv --strip-components=1 -C ~/.rg
  19. fi
  20. my_home=${HOME}
  21. # For testing
  22. # my_home=~/tmp/HOME
  23. cd ${my_home}
  24. #+
  25. # Get My Git Repos if they're not there
  26. #-
  27. [ -d ${my_home}/.kfieldho ] || git clone ${dot_local_repo} .kfieldho
  28. [ -d ${my_home}/.vim ] || git clone ${dot_vim_repo} .vim
  29. [ -d ${my_home}/.logs ] || mkdir ${my_home}/.logs
  30. [ -d ${my_home}/.fzf ] || git clone ${fzf_repo} ${my_home}/.fzf
  31. #+
  32. # Now update them
  33. #-
  34. cd ${my_home}/.kfieldho && git checkout master && git pull && git submodule update --init
  35. cd ${my_home}/.vim && git checkout master && git pull && git submodule update --init
  36. cd ${my_home}/.fzf && git checkout master && git pull && git submodule update --init
  37. #+
  38. # Install fzf
  39. #-
  40. cd ${my_home}/.fzf && ./install --completion --key-bindings --no-update-rc
  41. #+
  42. # Set up dot files (purposely making relative links)
  43. #-
  44. [ -f ${my_home}/.bashrc ] && mv ${my_home}/.bashrc ${my_home}/bashrc.${NOW}
  45. ln -s .kfieldho/etc/bashrc ${my_home}/.bashrc
  46. [ -f ${my_home}/.bash_profile ] && mv ${my_home}/.bash_profile ${my_home}/bash_profile.${NOW}
  47. ln -s .kfieldho/etc/bash_profile ${my_home}/.bash_profile
  48. [ -f ${my_home}/.zshrc ] && mv ${my_home}/.zshrc ${my_home}/zshrc.${NOW}
  49. ln -s .kfieldho/etc/zshrc ${my_home}/.zshrc
  50. [ -f ${my_home}/.tmux.conf ] && mv ${my_home}/.tmux.conf ${my_home}/tmux.conf.${NOW}
  51. ln -s .kfieldho/etc/tmux.conf ${my_home}/.tmux.conf
  52. [ -f ${my_home}/.hgrc ] && mv ${my_home}/.hgrc ${my_home}/hgrc.${NOW}
  53. ln -s .kfieldho/etc/hgrc ${my_home}/.hgrc
  54. [ -f ${my_home}/.gitconfig ] && mv ${my_home}/.gitconfig ${my_home}/gitconfig.${NOW}
  55. ln -s .kfieldho/etc/gitconfig ${my_home}/.gitconfig
  56. [ -f ${my_home}/.vimrc ] && mv ${my_home}/.vimrc ${my_home}/vimrc.${NOW}
  57. ln -s .vim/vimrc ${my_home}/.vimrc
  58. touch ${my_home}/.kfieldho-installed