setup.sh 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. #!/bin/sh
  2. # This script pulls extra software and creates appropriate symlinks in the home
  3. # directory
  4. # Run from where it's located (within dotfiles directory)
  5. # Make a known_hosts file if none, otherwise zsh throws an error for our .zshrc
  6. if test -f ~/.ssh/known_hosts; then
  7. echo "known_hosts found..."
  8. else
  9. mkdir -p ~/.ssh
  10. touch ~/.ssh/known_hosts
  11. echo "known_hosts created (blank)..."
  12. fi
  13. # Ack for this user (perl 5.8.8 or higher on system)
  14. # Curl may need to have proxy settings
  15. if test -f ~/bin/ack; then
  16. echo "ack found..."
  17. else
  18. mkdir -p ~/bin
  19. curl http://betterthangrep.com/ack-standalone > ~/bin/ack
  20. chmod 0755 ~/bin/ack
  21. echo "ack installed from betterthangrep.com..."
  22. fi
  23. # color for git! Some machines don't have it.
  24. git config --global color.ui true
  25. git config --global core.editor "vim"
  26. echo "git colour and editor setup..."
  27. # This repository has vim plugins as submodules, so initialise and clone them
  28. git submodule init
  29. git submodule update
  30. echo "dotfiles submodules done..."
  31. #
  32. # Thanks to: https://github.com/dangerous/dotfiles
  33. # for cleaner way of handling symlinking
  34. #
  35. BACKUP_DIR="/tmp/$(date)"
  36. mkdir "$BACKUP_DIR"
  37. # Zsh
  38. [ -f ~/.zshrc ] && mv ~/.zshrc "$BACKUP_DIR"
  39. [ -f ~/.zshenv ] && mv ~/.zshenv "$BACKUP_DIR"
  40. ln -s dotfiles/zsh/zshrc ~/.zshrc
  41. ln -s dotfiles/zsh/zshenv ~/.zshenv
  42. # Vim
  43. [ -d ~/.vim ] && mv ~/.vim "$BACKUP_DIR"
  44. [ -f ~/.vimrc ] && mv ~/.vimrc "$BACKUP_DIR"
  45. ln -s dotfiles/vim ~/.vim
  46. ln -s dotfiles/vim/vimrc ~/.vimrc
  47. mkdir -p ~/.vim/undo # persistent undo folder
  48. # Vimperator
  49. [ -d ~/.vimperator ] && mv ~/.vimperator "$BACKUP_DIR"
  50. [ -f ~/.vimperatorrc ] && mv ~/.vimperatorrc "$BACKUP_DIR"
  51. ln -s dotfiles/vimperator ~/.vimperator
  52. ln -s dotfiles/vimperator/vimperatorrc ~/.vimperatorrc
  53. # Screen
  54. [ -f ~/.screenrc ] && mv ~/.screenrc "$BACKUP_DIR"
  55. ln -s dotfiles/screen/screenrc ~/.screenrc
  56. # Tmux
  57. [ -f ~/.tmux.conf ] && mv ~/.tmux.conf "$BACKUP_DIR"
  58. ln -s dotfiles/tmux/tmux.conf ~/.tmux.conf
  59. # Powerline
  60. # `.config` is a shared config location, so take more care
  61. [ -d ~/.config/powerline ] && mv ~/.config/powerline "$BACKUP_DIR"
  62. [ ! -d ~/.config ] && mkdir ~/.config
  63. ln -s ../dotfiles/powerline/config ~/.config/powerline
  64. # Nethack
  65. [ -f ~/.nethackrc ] && mv ~/.nethackrc "$BACKUP_DIR"
  66. ln -s dotfiles/nethack/nethackrc ~/.nethackrc
  67. # Irssi
  68. [ -d ~/.irssi ] && mv ~/.irssi "$BACKUP_DIR"
  69. ln -s dotfiles/irssi ~/.irssi
  70. # Mongo
  71. [ -f ~/.mongorc.js ] && mv ~/.mongorc.js "$BACKUP_DIR"
  72. ln -s dotfiles/mongo/mongorc.js ~/.mongorc.js
  73. # Ack
  74. [ -f ~/.ackrc ] && mv ~/.ackrc "$BACKUP_DIR"
  75. ln -s dotfiles/ack/ackrc ~/.ackrc
  76. echo "Setup complete!"