|
| 1 | +# /etc/profile |
| 2 | + |
| 3 | +# System wide environment and startup programs, for login setup |
| 4 | +# Functions and aliases go in /etc/bashrc |
| 5 | + |
| 6 | +# It's NOT a good idea to change this file unless you know what you |
| 7 | +# are doing. It's much better to create a custom.sh shell script in |
| 8 | +# /etc/profile.d/ to make custom changes to your environment, as this |
| 9 | +# will prevent the need for merging in future updates. |
| 10 | + |
| 11 | +pathmunge () { |
| 12 | + case ":${PATH}:" in |
| 13 | + *:"$1":*) |
| 14 | + ;; |
| 15 | + *) |
| 16 | + if [ "$2" = "after" ] ; then |
| 17 | + PATH=$PATH:$1 |
| 18 | + else |
| 19 | + PATH=$1:$PATH |
| 20 | + fi |
| 21 | + esac |
| 22 | +} |
| 23 | + |
| 24 | + |
| 25 | +if [ -x /usr/bin/id ]; then |
| 26 | + if [ -z "$EUID" ]; then |
| 27 | + # ksh workaround |
| 28 | + EUID=`/usr/bin/id -u` |
| 29 | + UID=`/usr/bin/id -ru` |
| 30 | + fi |
| 31 | + USER="`/usr/bin/id -un`" |
| 32 | + LOGNAME=$USER |
| 33 | + MAIL="/var/spool/mail/$USER" |
| 34 | +fi |
| 35 | + |
| 36 | +# Path manipulation |
| 37 | +if [ "$EUID" = "0" ]; then |
| 38 | + pathmunge /usr/sbin |
| 39 | + pathmunge /usr/local/sbin |
| 40 | +else |
| 41 | + pathmunge /usr/local/sbin after |
| 42 | + pathmunge /usr/sbin after |
| 43 | +fi |
| 44 | + |
| 45 | +HOSTNAME=`/usr/bin/hostname 2>/dev/null` |
| 46 | +HISTSIZE=1000 |
| 47 | +if [ "$HISTCONTROL" = "ignorespace" ] ; then |
| 48 | + export HISTCONTROL=ignoreboth |
| 49 | +else |
| 50 | + export HISTCONTROL=ignoredups |
| 51 | +fi |
| 52 | + |
| 53 | +export PATH USER LOGNAME MAIL HOSTNAME HISTSIZE HISTCONTROL |
| 54 | +export JAVA_HOME=/usr/lib/jvm/java-1.8.0-openjdk-1.8.0.282.b08-1.amzn2.0.1.x86_64 |
| 55 | +export PATH=$JAVA_HOME/bin:$PATH |
| 56 | +export MAVEN_HOME=/usr/share/maven |
| 57 | +# By default, we want umask to get set. This sets it for login shell |
| 58 | +# Current threshold for system reserved uid/gids is 200 |
| 59 | +# You could check uidgid reservation validity in |
| 60 | +# /usr/share/doc/setup-*/uidgid file |
| 61 | +if [ $UID -gt 199 ] && [ "`/usr/bin/id -gn`" = "`/usr/bin/id -un`" ]; then |
| 62 | + umask 002 |
| 63 | +else |
| 64 | + umask 022 |
| 65 | +fi |
| 66 | + |
| 67 | +for i in /etc/profile.d/*.sh /etc/profile.d/sh.local ; do |
| 68 | + if [ -r "$i" ]; then |
| 69 | + if [ "${-#*i}" != "$-" ]; then |
| 70 | + . "$i" |
| 71 | + else |
| 72 | + . "$i" >/dev/null |
| 73 | + fi |
| 74 | + fi |
| 75 | +done |
| 76 | + |
| 77 | +unset i |
| 78 | +unset -f pathmunge |
0 commit comments