setup.sh 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. echo 'export http_proxy=socks5h://0:8000' >> $HOME/.profile
  27. echo 'export https_proxy=socks5h://0:8000' >> $HOME/.profile
  28. echo 'export ftp_proxy=socks5h://0:8000' >> $HOME/.profile
  29. echo 'export PATH=$HOME/.local/bin:$PATH' >> $HOME/.profile
  30. fi
  31. # cd $HOME/.nvm
  32. # git checkout v0.39.3
  33. # . $HOME/.nvm/nvm.sh
  34. # if ! [ -x "$(command -v yarn)" ]
  35. # then
  36. # nvm install node
  37. # nvm use node
  38. # npm install yarn -g
  39. # fi
  40. mkdir -p $HOME/.local/bin $HOME/local $HOME/downloads $HOME/tmp $HOME/workspace
  41. echo 'setup php'
  42. # if [ ! -f "$HOME/downloads/composer" ]
  43. # then
  44. # wget -O $HOME/downloads/composer https://getcomposer.org/installer
  45. # fi
  46. if [ ! -f "$HOME/.local/bin/composer" ]
  47. then
  48. # cd $HOME/downloads
  49. # php composer
  50. cp composer.phar $HOME/.local/bin/composer
  51. fi
  52. echo 'setup ssh'
  53. if [ ! -d $HOME/.ssh ]
  54. then
  55. mkdir $HOME/.ssh
  56. chmod 700 $HOME/.ssh
  57. cat $USER.pub > $HOME/.ssh/authorized_keys
  58. fi
  59. echo 'setup vnc'
  60. mkdir -p $HOME/.vnc
  61. cat > $HOME/.vnc/xstartup <<EOF
  62. #!/bin/sh
  63. unset SESSION_MANAGER
  64. exec openbox-session &
  65. startlxqt &
  66. EOF
  67. echo 'setup workspace folder'
  68. if [ ! -L $HOME/www ]
  69. then
  70. ln -sf /srv/http/$USER $HOME/www
  71. fi
  72. echo 'setup tmux'
  73. if [ ! -f $HOME/.tmux.conf ]
  74. then
  75. echo 'set-option -g history-limit 102400' > $HOME/.tmux.conf
  76. echo 'set-option -g default-shell "/bin/zsh"' >> $HOME/.tmux.conf
  77. fi
  78. echo 'setup git'
  79. git config --global core.quotepath false
  80. git config --global http.version HTTP/1.1
  81. git config --global pull.rebase false
  82. git config --global http.proxy socks5h://0:8000
  83. echo "done."
  84. exit 0