From 901bc018e65c294f8830a57c5902d929427fdb71 Mon Sep 17 00:00:00 2001 From: James Antill Date: Mon, 22 Mar 2010 14:06:04 +0000 Subject: [PATCH] - Add pathmunge to our /etc/zshrc, for profile.d compat. - Resolves: bug#548960 --- zsh.spec | 6 +++++- zshrc.rhs | 14 +++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/zsh.spec b/zsh.spec index 4483458..0569377 100644 --- a/zsh.spec +++ b/zsh.spec @@ -3,7 +3,7 @@ Summary: A powerful interactive shell Name: zsh Version: 4.3.10 -Release: 4%{?dist} +Release: 5%{?dist} License: BSD URL: http://zsh.sunsite.dk/ Group: System Environment/Shells @@ -175,6 +175,10 @@ fi %doc Doc/*.html %changelog +* Mon Mar 22 2010 James Antill - 4.3.10-5 +- Add pathmunge to our /etc/zshrc, for profile.d compat. +- Resolves: bug#548960 + * Fri Aug 7 2009 James Antill - 4.3.10-4 - Allow --excludedocs command to work! - Resolves: bug#515986 diff --git a/zshrc.rhs b/zshrc.rhs index 4dd1c77..5b3b92a 100644 --- a/zshrc.rhs +++ b/zshrc.rhs @@ -15,6 +15,18 @@ PROMPT='[%n@%m]%~%# ' # default prompt # bindkey -e # emacs key bindings bindkey ' ' magic-space # also do history expansion on space +# Provide pathmunge for /etc/profile.d scripts +pathmunge() +{ + if ! echo $PATH | /bin/grep -qE "(^|:)$1($|:)" ; then + if [ "$2" = "after" ] ; then + PATH=$PATH:$1 + else + PATH=$1:$PATH + fi + fi +} + _src_etc_profile_d() { # Make the *.sh things happier, and have possible ~/.zshenv options like @@ -34,5 +46,5 @@ _src_etc_profile_d() } _src_etc_profile_d -unset -f _src_etc_profile_d +unset -f pathmunge _src_etc_profile_d