.bin, .profile: Update, add minor security checks to PATH patching

This commit is contained in:
Salt 2019-09-26 03:04:40 -05:00
parent d6beb3dd37
commit 7b9b201d8f
2 changed files with 7 additions and 2 deletions

2
.bin

@ -1 +1 @@
Subproject commit aa1cc36264073fdf43cff7fe740844356e9ef0fe
Subproject commit 2d62cfabbf1b226e173b7e20a1d49edba820b7be

View File

@ -25,7 +25,12 @@
_baseshell="$(basename -- "$0")"
# Patch PATH
desiredpath="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/games:/usr/games:$HOME/.bin:$HOME/.local/bin"
desiredpath="/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/sbin:/usr/local/games:/usr/games"
for dir in "$HOME/.bin" "$HOME/.local/bin"; do
if [ -d "$dir" ] && [ -O "$dir" ]; then
desiredpath="$desiredpath:$dir"
fi
done
IFS=":"
for path in $desiredpath; do
PATH="${PATH#*$path}"