From f4453acbfdb1ac77a8bffc05635daf7aa3fee605 Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Mon, 21 Apr 2014 11:57:06 -0400 Subject: touch up PATHs being set in login.sh --- .local/bin/config-path | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to '.local') diff --git a/.local/bin/config-path b/.local/bin/config-path index 6b9019c..99f0910 100755 --- a/.local/bin/config-path +++ b/.local/bin/config-path @@ -24,28 +24,46 @@ in_array() { # Import existing values IFS=: paths=($PATH) +IFS=: manpaths=($MANPATH) IFS=: rubylibs=($RUBYLIB) +IFS=: perl5libs=($PERL5LIB) # Scan through prefixes for prefix in "${prefixes[@]}"; do # PATH - dir="$prefix/bin" - if [[ -d "$dir" ]] && ! in_array "$dir" "${paths[@]}"; then - paths=("$dir" "${paths[@]}") + for dir in "$prefix/bin" "$prefix/sbin"; do + if [[ -d "$dir" ]] && ! in_array "$dir" "${paths[@]}"; then + paths=("$dir" "${paths[@]}") + fi + done + # MANPATH + dir="$prefix/share/man" + if [[ -d "$dir" ]] && ! in_array "$dir" "${manpaths[@]}"; then + manpaths=("$dir" "${manpaths[@]}") fi # RUBYLIB dir="$prefix/lib" if [[ -d "$dir" ]] && ! in_array "$dir" "${rubylibs[@]}"; then rubylibs=("$dir" "${rubylibs[@]}") fi + # PERL5LIB + for dir in "$prefix"/lib*/perl5; do + if [[ -d "$dir" ]] && in_array "$dir" "${manpaths[@]}"; then + perl5libs=("$dir" "${perl5libs[@]}") + fi + done done # Finally, print our values IFS=: PATH="${paths[*]}" +IFS=: MANPATH="${manpaths[*]}" IFS=: RUBYLIB="${rubylibs[*]}" +IFS=: PERL5LIB="${perl5libs[*]}" # The sed bit here is the only time we call an external program { declare -p PATH + declare -p MANPATH declare -p RUBYLIB + declare -p PERL5LIB } | sed 's/^declare \(-\S* \)*//' -- cgit v1.2.3-54-g00ecf