diff options
author | Lars Wendler <polynomial-c@gentoo.org> | 2017-02-06 01:48:53 +0100 |
---|---|---|
committer | Lars Wendler <polynomial-c@gentoo.org> | 2017-02-06 01:52:37 +0100 |
commit | e99a31824bb89ed9ea45649d6b4a602fc922d8a3 (patch) | |
tree | 7d0f30b23ad922e828e8a69f65171a8664ee594a /app-shells/fish/files/profile-env.fish | |
parent | Revert "app-shells/fish: Removed old." (diff) | |
download | gentoo-e99a31824bb89ed9ea45649d6b4a602fc922d8a3.tar.gz gentoo-e99a31824bb89ed9ea45649d6b4a602fc922d8a3.tar.bz2 gentoo-e99a31824bb89ed9ea45649d6b4a602fc922d8a3.zip |
app-shells/fish: Bump to version 2.5.0. Removed old.
Package-Manager: Portage-2.3.3, Repoman-2.3.1
Diffstat (limited to 'app-shells/fish/files/profile-env.fish')
-rw-r--r-- | app-shells/fish/files/profile-env.fish | 34 |
1 files changed, 21 insertions, 13 deletions
diff --git a/app-shells/fish/files/profile-env.fish b/app-shells/fish/files/profile-env.fish index 21a918adba8f..d4852f04171b 100644 --- a/app-shells/fish/files/profile-env.fish +++ b/app-shells/fish/files/profile-env.fish @@ -1,15 +1,23 @@ -# since fish supports export via upstream provided function -# we can source directly, only ommiting $PATH and comments. -grep -Ev "^(#|export (PATH|ROOTPATH)=)" /etc/profile.env | source +# only apply env for login shells, as we'd like fish to +# inherit existing shell environment without overriding it +# using csh env, as it's cleaner and less too parse/strip -# strip unneded stuff from bash export lines -# apply paths and cleanup -if [ "$EUID" = "0" ] ; or [ "$USER" = "root" ] - set _rootpath (grep -o " ROOTPATH='.*'" /etc/profile.env | sed "s@.*'\(.*\)'@\1@;s@:@\n@g") - set -xg PATH /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin $_rootpath - set -e _rootpath -else - set _userpath (grep -o " PATH='.*'" /etc/profile.env | sed "s@.*'\(.*\)'@\1@;s@:@\n@g") - set -xg PATH /usr/local/bin /usr/bin /bin $_userpath - set -e _userpath +if status --is-login + # since fish supports export via upstream provided function + # we can source directly, only ommiting $PATH and comments. + string match -r -v '^(#|setenv (PATH|ROOTPATH) )' < /etc/csh.env | source + + # strip unneded stuff from setenv lines + # apply paths and cleanup + if [ "$EUID" = "0" ] ; or [ "$USER" = "root" ] + string match -r '^setenv ROOTPATH .+' < /etc/csh.env | string replace -ra '\'|\:' ' ' | source + set -gx PATH /usr/local/sbin /usr/local/bin /usr/sbin /usr/bin /sbin /bin $ROOTPATH + set -e ROOTPATH + else + string match -r '^setenv PATH .+' < /etc/csh.env | string replace -ra '\'|\:' ' ' | source + set -gx PATH /usr/local/bin /usr/bin /bin $PATH + end + + # re-prepend $fish_user_paths + __fish_reconstruct_path end |