void-packages/srcpkgs/base-files/files/profile
Adeel 20c06e3b0a
base-files: preserve PATH preset by environment
This delta aligns the value of `PATH` variable with other
shells/distros, which in their default configuration preserve
(append) the old value.
For instance: https://src.fedoraproject.org/rpms/bash/blob/master/f/dot-bashrc#_9.

In order to exercise interoperability with Win32 applications
in WSL, the subsystem process injects Windows environment's
PATH to the Linux OS, which in this case gets lost.

closes #6233

Co-authored-by: maxice8 <thinkabit.ukim@gmail.com>
2019-03-03 18:03:28 -03:00

34 lines
617 B
Bash

# /etc/profile
# System wide environment and startup programs.
appendpath () {
case ":$PATH:" in
*:"$1":*)
;;
*)
PATH="${PATH:+$PATH:}$1"
esac
}
# Set our default path (/usr/sbin:/sbin:/bin included for non-Void chroots)
appendpath '/usr/local/sbin'
appendpath '/usr/local/bin'
appendpath '/usr/bin'
appendpath '/usr/sbin'
appendpath '/sbin'
appendpath '/bin'
unset appendpath
export PATH
# Set default umask
umask 022
# Load profiles from /etc/profile.d
if [ -d /etc/profile.d/ ]; then
for f in /etc/profile.d/*.sh; do
[ -r "$f" ] && . "$f"
done
unset f
fi