setup.sh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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://beyondgrep.com/ack-2.04-single-file > ~/bin/ack && chmod 0755 ~/bin/ack
  20. echo "ack installed from beyondgrep.com..."
  21. fi
  22. # color for git! Some machines don't have it.
  23. git config --global color.ui true
  24. git config --global core.editor "vim"
  25. echo "git colour and editor setup..."
  26. # This repository has vim plugins as submodules, so initialise and clone them
  27. git submodule init
  28. git submodule update
  29. echo "dotfiles submodules done..."
  30. #
  31. # Thanks to: https://github.com/dangerous/dotfiles
  32. # for cleaner way of handling symlinking
  33. #
  34. BACKUP_DIR="/tmp/$(date)"
  35. mkdir "$BACKUP_DIR"
  36. # Zsh
  37. [ -f ~/.zshrc ] && mv ~/.zshrc "$BACKUP_DIR"
  38. [ -f ~/.zshenv ] && mv ~/.zshenv "$BACKUP_DIR"
  39. ln -s dotfiles/zsh/zshrc ~/.zshrc
  40. ln -s dotfiles/zsh/zshenv ~/.zshenv
  41. # Vim
  42. [ -d ~/.vim ] && mv ~/.vim "$BACKUP_DIR"
  43. [ -f ~/.vimrc ] && mv ~/.vimrc "$BACKUP_DIR"
  44. ln -s dotfiles/vim ~/.vim
  45. ln -s dotfiles/vim/vimrc ~/.vimrc
  46. mkdir -p ~/.vim/undo # persistent undo folder
  47. # Vimperator
  48. [ -d ~/.vimperator ] && mv ~/.vimperator "$BACKUP_DIR"
  49. [ -f ~/.vimperatorrc ] && mv ~/.vimperatorrc "$BACKUP_DIR"
  50. ln -s dotfiles/vimperator ~/.vimperator
  51. ln -s dotfiles/vimperator/vimperatorrc ~/.vimperatorrc
  52. # Screen
  53. [ -f ~/.screenrc ] && mv ~/.screenrc "$BACKUP_DIR"
  54. ln -s dotfiles/screen/screenrc ~/.screenrc
  55. # Tmux
  56. [ -f ~/.tmux.conf ] && mv ~/.tmux.conf "$BACKUP_DIR"
  57. ln -s dotfiles/tmux/tmux.conf ~/.tmux.conf
  58. # Powerline
  59. # `.config` is a shared config location, so take more care
  60. [ -d ~/.config/powerline ] && mv ~/.config/powerline "$BACKUP_DIR"
  61. [ ! -d ~/.config ] && mkdir ~/.config
  62. ln -s ../dotfiles/powerline/config ~/.config/powerline
  63. # Nethack
  64. [ -f ~/.nethackrc ] && mv ~/.nethackrc "$BACKUP_DIR"
  65. ln -s dotfiles/nethack/nethackrc ~/.nethackrc
  66. # Irssi
  67. [ -d ~/.irssi ] && mv ~/.irssi "$BACKUP_DIR"
  68. ln -s dotfiles/irssi ~/.irssi
  69. # Mongo
  70. [ -f ~/.mongorc.js ] && mv ~/.mongorc.js "$BACKUP_DIR"
  71. ln -s dotfiles/mongo/mongorc.js ~/.mongorc.js
  72. # Ack
  73. [ -f ~/.ackrc ] && mv ~/.ackrc "$BACKUP_DIR"
  74. ln -s dotfiles/ack/ackrc ~/.ackrc
  75. echo "Setup complete!"