PageRenderTime 960ms CodeModel.GetById 40ms RepoModel.GetById 2ms app.codeStats 0ms

/workspace/files/etc/profile.d/cloud9.sh

https://gitlab.com/billyprice1/templates
Shell | 96 lines | 75 code | 17 blank | 4 comment | 17 complexity | 2c6f79b5c19c85fb253b9d24b6e32507 MD5 | raw file
  1. #!/bin/sh
  2. if [ "$C9_SH_EXECUTED" ]; then
  3. # We already executed, let's not overwrite the path
  4. return
  5. fi
  6. export C9_FULLNAME=
  7. export C9_HOSTNAME=
  8. export C9_EMAIL=
  9. export C9_USER=
  10. export C9_PROJECT=
  11. export C9_PID=
  12. export C9_UID=
  13. export C9_SH_EXECUTED=1
  14. export C9_PORT=8080
  15. export C9_IP=0.0.0.0
  16. export C9_SHARED=/mnt/shared
  17. export PATH=/mnt/shared/bin:$HOME/workspace/node_modules/.bin:$HOME/bin\
  18. :$PATH\
  19. :/mnt/shared/sbin:/opt/gitl:/opt/go/bin:/mnt/shared/c9/app.nw/bin
  20. export LC_ALL=C.UTF-8
  21. export LANG=C.UTF-8
  22. export LANGUAGE=C.UTF-8
  23. export HGUSER="$C9_FULLNAME"
  24. export EMAIL="$C9_EMAIL"
  25. export PORT="$C9_PORT"
  26. export IP="$C9_IP"
  27. if [ -d "$HOME/lib/python/site-packages" ]; then
  28. export PYTHONPATH="$PYTHONPATH:$HOME/lib/python/site-packages"
  29. fi
  30. if [ -d "/mnt/shared/lib/ruby" ]; then
  31. export GEM_PATH="$GEM_PATH:/mnt/shared/lib/ruby"
  32. fi
  33. export METEOR_IP="$IP"
  34. export METEOR_PORT="$PORT"
  35. [ "$GOROOT" ] || export GOROOT=/opt/go
  36. [ "$GOPATH" ] || export GOPATH=/home/ubuntu/workspace
  37. [ "$BASH_VERSION" ] || return 0
  38. # remove nada-nix-compat.sh in old workspaces
  39. if [ -e /etc/profile.d/nada-nix-compat.sh ]; then
  40. sudo rm -f /etc/profile.d/nada-nix-compat.sh &
  41. fi
  42. if [ ! -e /usr/bin/iojs ] && [ ! -L /usr/bin/iojs ]; then
  43. sudo ln -s /mnt/shared/lib/iojs/bin/iojs /usr/bin/iojs
  44. fi
  45. LAST_LINE=$(tail -1 /home/ubuntu/.profile)
  46. if [ "$LAST_LINE" == '[ -s "/home/ubuntu/.nvm/nvm.sh" ] && . "/home/ubuntu/.nvm/nvm.sh" # This loads nvm' ]; then
  47. WRAP_START='[ "$BASH_VERSION" ] \&\& npm() { if [ "$*" == "config get prefix" ]; then which node | sed "s/bin\\/node//"; else $(which npm) "$@"; fi } # hack: avoid slow npm sanity check in nvm'
  48. WRAP_END='unset npm # end hack'
  49. sed -iE 's!.*This loads nvm!'"$WRAP_START\n&\n$WRAP_END!" /home/ubuntu/.profile
  50. fi
  51. # fix broken .gitconfig
  52. if grep -qs "askpass = /bin/echo" ~/.gitconfig; then
  53. sed -i 's!askpass = /bin/echo/!!' ~/.gitconfig
  54. fi
  55. for S in /mnt/shared/profile.d/*; do
  56. [ -e $S ] && . $S
  57. done
  58. if X='() { :; }; echo Vulnerable' bash -c pwd 2>/dev/null | grep -q Vulnerable; then
  59. (( sudo apt-get update &>/dev/null &&
  60. sudo apt-get install bash &>/dev/null) &)
  61. fi
  62. _xdgopen() {
  63. if [ -e "$@" ]; then
  64. c9 "$@"
  65. return
  66. fi
  67. command xdg-open "$@"
  68. }
  69. _gnomeopen() {
  70. if [ -e "$@" ]; then
  71. c9 "$@"
  72. return
  73. fi
  74. command xdg-open "$@"
  75. }
  76. export -f _xdgopen _gnomeopen
  77. alias xdg-open=_xgdopen
  78. alias gnome-open=_gnomeopen
  79. alias open=c9