setup.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #!/bin/bash
  2. set -e
  3. echo 'setup zsh'
  4. if [ ! -d "$HOME/.oh-my-zsh" ]
  5. then
  6. # git clone https://github.com/ohmyzsh/ohmyzsh.git $HOME/.oh-my-zsh
  7. tar xf ohmyzsh.tar.xz -C $HOME
  8. fi
  9. if [ ! -f "$HOME/.zshrc" ]
  10. then
  11. cp $HOME/.oh-my-zsh/templates/zshrc.zsh-template $HOME/.zshrc
  12. echo 'source $HOME/.profile' >> $HOME/.zshrc
  13. fi
  14. echo 'setup nodejs'
  15. if [ ! -d "$HOME/.nvm" ]
  16. then
  17. # git clone https://github.com/nvm-sh/nvm.git $HOME/.nvm
  18. tar xf nvm.tar.xz -C $HOME
  19. cat >> $HOME/.profile <<EOF
  20. export NVM_DIR="\$HOME/.nvm"
  21. [ -s "\$NVM_DIR/nvm.sh" ] && \. "\$NVM_DIR/nvm.sh"
  22. [ -s "\$NVM_DIR/bash_completion" ] && \. "\$NVM_DIR/bash_completion"
  23. EOF
  24. echo 'export PATH=$HOME/.yarn/bin:$PATH' >> $HOME/.profile
  25. echo 'export EDITOR=vim' >> $HOME/.profile
  26. fi
  27. # cd $HOME/.nvm
  28. # git checkout v0.39.3
  29. # . $HOME/.nvm/nvm.sh
  30. # if ! [ -x "$(command -v yarn)" ]
  31. # then
  32. # nvm install node
  33. # nvm use node
  34. # npm install yarn -g
  35. # fi
  36. mkdir -p $HOME/.local/bin $HOME/local $HOME/downloads $HOME/tmp $HOME/workspace
  37. echo 'setup php'
  38. # if [ ! -f "$HOME/downloads/composer" ]
  39. # then
  40. # wget -O $HOME/downloads/composer https://getcomposer.org/installer
  41. # fi
  42. if [ ! -f "$HOME/.local/bin/composer" ]
  43. then
  44. # cd $HOME/downloads
  45. # php composer
  46. cp composer.phar $HOME/.local/bin/composer
  47. fi
  48. echo 'setup ssh'
  49. if [ ! -d $HOME/.ssh ]
  50. then
  51. mkdir $HOME/.ssh
  52. chmod 700 $HOME/.ssh
  53. cat $USER.pub > $HOME/.ssh/authorized_keys
  54. fi
  55. echo 'setup workspace folder'
  56. if [ ! -L $HOME/www ]
  57. then
  58. ln -sf /srv/http/$USER $HOME/www
  59. fi
  60. echo 'setup tmux'
  61. if [ ! -f $HOME/.tmux.conf ]
  62. then
  63. echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf
  64. echo 'set-option -g default-shell "/bin/zsh"' >> $HOME/.tmux.conf
  65. fi
  66. echo 'setup git'
  67. git config --global core.quotepath false
  68. git config --global http.version HTTP/1.1
  69. git config --global pull.rebase false
  70. git config --global http.proxy socks5h://0:8000
  71. echo "done."
  72. exit 0