summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wendler <polynomial-c@gentoo.org>2017-01-13 06:02:25 +0100
committerLars Wendler <polynomial-c@gentoo.org>2017-01-13 06:02:47 +0100
commit867eb172854e2965a1992c802d10fd3993769170 (patch)
tree96d006695c9a71c7459aa8ba22518e19f99d3e47 /app-shells/fish/files
parentdev-util/buildbot-worker: Update homepages (missed one) (diff)
downloadgentoo-867eb172854e2965a1992c802d10fd3993769170.tar.gz
gentoo-867eb172854e2965a1992c802d10fd3993769170.tar.bz2
gentoo-867eb172854e2965a1992c802d10fd3993769170.zip
app-shells/fish: Attempt to load system-wide variables (bug #545830).
Use system pcre2 lib instead of bundled one. Package-Manager: Portage-2.3.3, Repoman-2.3.1
Diffstat (limited to 'app-shells/fish/files')
-rw-r--r--app-shells/fish/files/profile-env.fish15
1 files changed, 15 insertions, 0 deletions
diff --git a/app-shells/fish/files/profile-env.fish b/app-shells/fish/files/profile-env.fish
new file mode 100644
index 000000000000..21a918adba8f
--- /dev/null
+++ b/app-shells/fish/files/profile-env.fish
@@ -0,0 +1,15 @@
+# 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
+
+# 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
+end