Gentoo installation script
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

profile 2.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # /etc/profile
  2. # Check for an interactive shell and set umask accordingly. Currently the
  3. # threshold for system-reserved uid/guid's is 200 though you may check
  4. # '/usr/share/doc/setup/uidgid' to confirm this is valid.
  5. case $- in
  6. *i*) INTERACTIVE="true" ;;
  7. *)
  8. if [ "$UID" -gt 199 ] && [ "`id -gn`" = "`id -un`" ]; then
  9. # Mask current process as a daemon
  10. umask 002
  11. else
  12. # Mask current process as an initscript
  13. umask 022
  14. fi
  15. return
  16. esac
  17. # Gentoo has '/etc/profile.env' which needs to be read. Here we will
  18. # check if it exists and source it if found.
  19. [ -e /etc/profile.env ] &&
  20. . /etc/profile.env
  21. # OpenBSD allows setting a custom URL for pkgsrc. This section confirms
  22. # that 'pkg_add' is an available command
  23. [ -e "$(command -v pkg_add)" ] &&
  24. PKG_PATH="https://mirror.leaseweb.com/openbsd" &&
  25. PKG_PATH="$PKG_PATH/snapshots/packages/amd64/" &&
  26. export PKG_PATH
  27. # Setting PS1 correctly depending on the current shell can be important
  28. # for users of non-standard shells. Here we will attempt to accommodate
  29. # other shells if currently in use, and default to standard shell
  30. # semantics.
  31. if [ -e "$BASH_VERSION" ]; then
  32. PS1="[\u@\h \W]\$ "
  33. elif [ -e "$ZSH_VERSION" ]; then
  34. PS1="[%n@%M %d]$ "
  35. else
  36. PS1="[\u@\h \W]\$ "
  37. fi
  38. # This section defines all PATH and MANPATH locations and is mean to be a
  39. # somewhat exhaustive list for compatibility across various systems. It
  40. # may look quite upsetting but it works for our purposes.
  41. PATH="/usr/local/sbin/:/usr/local/bin:/usr/sbin:/usr/bin:/opt/bin"
  42. PATH="$PATH:/sbin:/bin:$HOME/.local/bin:$HOME/.bin:$HOME/bin"
  43. [ -d /usr/X11R6/bin ] &&
  44. PATH="$PATH:/usr/X11R6/bin"
  45. MANPATH="/usr/man:/usr/share/man:/usr/local/man:/usr/local/share/man"
  46. MANPATH="$MANPATH:$HOME/.local/man:$HOME/.local/share/man"
  47. # This section defines our exports, including the PATH, MANPATH and PS1
  48. # that we defined in previous sections.
  49. export EDITOR="emacs -nw"
  50. export LANG="en_US.UTF-8"
  51. export MANPATH
  52. export PAGER="less"
  53. export PATH
  54. export PROMPT_COMMAND="history -a"
  55. export PS1
  56. export SSH_KEY_PATH="$HOME/.ssh/rsa_id"
  57. # This section will find and source all files in '/etc/profile.d' that
  58. # end in '.sh'. This is a mechanism to allow the use of multiple files
  59. # that will comprise environment settings or other configurations.
  60. for sh in /etc/profile.d/*.sh; do
  61. [ -r "$sh" ] &&
  62. . "$sh"
  63. done
  64. # A $USER may want to maintain local shell configuration files. The
  65. # following section attempts to source '$HOME/.profile' along with all
  66. # files within '$HOME/profile.d' that end in '.sh' similarly to the above
  67. # section.
  68. if [ -d "$HOME"/.profile.d ]; then
  69. for sh in $HOME/.profile.d/*.sh; do
  70. [ -r "$sh" ] &&
  71. . "$sh"
  72. done
  73. fi
  74. # Keeping things clean in our shell environment is rather important. Here
  75. # we will unset any variables that are no longer needed.
  76. unset sh