--- etc/profile.global (revision 0) +++ etc/profile.global (revision 0) @@ -0,0 +1,30 @@ +# /etc/profile.global: bash shell setup +# +# This file contains the shared setup for all Bourne-shell derivative modes. +# It is run for login shells, non-primary shells as well as non-interactive +# shells. It should not produce any output. + +# Load environment settings from profile.env, which is created by +# env-update from the files in /etc/env.d +if [ -e /etc/profile.env ] ; then + . /etc/profile.env +fi + +# 077 would be more secure, but 022 is generally quite realistic +umask 022 + +# Set up PATH depending on whether we're root or a normal user. +# There's no real reason to exclude sbin paths from the normal user, +# but it can make tab-completion easier when they aren't in the +# user's PATH to pollute the executable namespace. +# +# It is intentional in the following line to use || instead of -o. +# This way the evaluation can be short-circuited and calling whoami is +# avoided. +if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then + PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}" +else + PATH="/usr/local/bin:/usr/bin:/bin:${PATH}" +fi +export PATH +unset ROOTPATH --- etc/profile (revision 1337) +++ etc/profile (working copy) @@ -4,31 +4,9 @@ # environment for login shells. # -# Load environment settings from profile.env, which is created by -# env-update from the files in /etc/env.d -if [ -e /etc/profile.env ] ; then - . /etc/profile.env -fi +# Load the shared setup +. /etc/profile.global -# 077 would be more secure, but 022 is generally quite realistic -umask 022 - -# Set up PATH depending on whether we're root or a normal user. -# There's no real reason to exclude sbin paths from the normal user, -# but it can make tab-completion easier when they aren't in the -# user's PATH to pollute the executable namespace. -# -# It is intentional in the following line to use || instead of -o. -# This way the evaluation can be short-circuited and calling whoami is -# avoided. -if [ "$EUID" = "0" ] || [ "$USER" = "root" ] ; then - PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:${ROOTPATH}" -else - PATH="/usr/local/bin:/usr/bin:/bin:${PATH}" -fi -export PATH -unset ROOTPATH - # Extract the value of EDITOR [ -z "$EDITOR" ] && EDITOR="`. /etc/rc.conf 2>/dev/null; echo $EDITOR`" [ -z "$EDITOR" ] && EDITOR="/bin/nano" --- etc/bash/bashrc.old 2005-07-21 23:28:35.000000000 -0700 +++ etc/bash/bashrc.old 2005-07-21 23:26:52.000000000 -0700 @@ -9,7 +9,8 @@ # past this point for scp and rcp, and it's important to refrain from # outputting anything in those cases. if [[ $- != *i* ]] ; then - # Shell is non-interactive. Be done now + # Shell is non-interactive. Be done after loading global stuff + . /etc/profile.global return fi