| # This script is meant to be installed in /etc/profile.d and sourced |
| # *after* any PATH modifications done by MSYS Perl. |
| # Lines marked @REM@ are removed when generating the actual profile script |
| |
| [ "${MSYSTEM_PREFIX}" != "@PREFIX@" ] && return 0 |
| |
| if [ "$(echo -n "$PATH" | wc -l)" -gt 0 ]; then |
| echo "@FILENAME@: ERROR: PATH contains line break, skipping PATH setup" >&2 |
| return 1 |
| fi |
| |
| modify_path() { |
| # @REM@ mypath is determined in package() based on the built configuration |
| local mypath="" |
| |
| # Remove MSYS perl modules from PATH to avoid conflicts |
| local newpath="$(echo -n "${PATH}" \ |
| | gawk -v mypath="${mypath}" ' |
| BEGIN { RS = ":" } |
| /^\/usr\/bin\/.*_perl$/ { next } |
| { printf "%s", (++i > 1 ? ":" : "") $0 } |
| mypath && /^\@PREFIX@\/bin$/ { printf "%s", ":" mypath } |
| ' |
| )" |
| [ -z "${newpath}" ] && return 1 |
| |
| PATH="${newpath}" |
| } |
| |
| modify_path |
| |
| unset modify_path |
| |
| # vim: set ts=4 sw=4 et ai syn=sh: |