diff options
Diffstat (limited to 'sh')
-rw-r--r-- | sh/.config/profile.d/20-cargo.sh | 2 | ||||
-rw-r--r-- | sh/.config/profile.d/20-dotnet.sh | 2 | ||||
-rw-r--r-- | sh/.config/profile.d/20-go.sh | 2 | ||||
-rw-r--r-- | sh/.config/profile.d/20-perl.sh | 2 | ||||
-rw-r--r-- | sh/.config/profile.d/20-ruby.sh | 2 | ||||
-rw-r--r-- | sh/.config/profile.d/50-opam.sh | 2 | ||||
-rw-r--r-- | sh/.profile | 16 |
7 files changed, 14 insertions, 14 deletions
diff --git a/sh/.config/profile.d/20-cargo.sh b/sh/.config/profile.d/20-cargo.sh index f0c4dbd..02be05d 100644 --- a/sh/.config/profile.d/20-cargo.sh +++ b/sh/.config/profile.d/20-cargo.sh @@ -3,6 +3,6 @@ export RUSTUP_HOME="$XDG_DATA_HOME/rustup" export CARGO_HOME="$XDG_DATA_HOME/cargo" -append_path "$CARGO_HOME/bin" +prepend_path "$CARGO_HOME/bin" export PATH diff --git a/sh/.config/profile.d/20-dotnet.sh b/sh/.config/profile.d/20-dotnet.sh index f7ac5a6..3f2216d 100644 --- a/sh/.config/profile.d/20-dotnet.sh +++ b/sh/.config/profile.d/20-dotnet.sh @@ -3,6 +3,6 @@ export OMNISHARPHOME="$XDG_CONFIG_HOME/omnisharp" export DOTNET_CLI_HOME="$XDG_DATA_HOME/dotnet" -append_path "$DOTNET_CLI_HOME/tools" +prepend_path "$DOTNET_CLI_HOME/tools" export PATH diff --git a/sh/.config/profile.d/20-go.sh b/sh/.config/profile.d/20-go.sh index 252ba47..93911f3 100644 --- a/sh/.config/profile.d/20-go.sh +++ b/sh/.config/profile.d/20-go.sh @@ -4,6 +4,6 @@ export GOPRIVATE=git.sr.ht export GOPATH="$XDG_DATA_HOME/go" -append_path "$GOPATH/bin" +prepend_path "$GOPATH/bin" export PATH diff --git a/sh/.config/profile.d/20-perl.sh b/sh/.config/profile.d/20-perl.sh index 13d5e0b..330ef9f 100644 --- a/sh/.config/profile.d/20-perl.sh +++ b/sh/.config/profile.d/20-perl.sh @@ -6,6 +6,6 @@ export PERL5LIB="$PERL_LOCAL_LIB_ROOT/lib/perl5" export PERL_MB_OPT="--install_base '$PERL_LOCAL_LIB_ROOT'" export PERL_MM_OPT="INSTALL_BASE=$PERL_LOCAL_LIB_ROOT" -append_path "$PERL_LOCAL_LIB_ROOT/bin" +prepend_path "$PERL_LOCAL_LIB_ROOT/bin" export PATH diff --git a/sh/.config/profile.d/20-ruby.sh b/sh/.config/profile.d/20-ruby.sh index 757bd95..5ed6da2 100644 --- a/sh/.config/profile.d/20-ruby.sh +++ b/sh/.config/profile.d/20-ruby.sh @@ -2,6 +2,6 @@ if command -v ruby >/dev/null && command -v gem >/dev/null; then GEM_USER_DIR="$(ruby -r rubygems -e 'puts Gem.user_dir')" - [ -d "$GEM_USER_DIR" ] && append_path "$GEM_USER_DIR" + [ -d "$GEM_USER_DIR" ] && prepend_path "$GEM_USER_DIR" export PATH fi diff --git a/sh/.config/profile.d/50-opam.sh b/sh/.config/profile.d/50-opam.sh index 1caea3b..3b3c364 100644 --- a/sh/.config/profile.d/50-opam.sh +++ b/sh/.config/profile.d/50-opam.sh @@ -6,4 +6,4 @@ export CAML_LD_LIBRARY_PATH="$OPAM_SWITCH_PREFIX/lib/stublibs:/usr/lib/ocaml/stu export OCAML_TOPLEVEL_PATH="$OPAM_SWITCH_PREFIX/lib/toplevel" export MANPATH="$MANPATH:$OPAM_SWITCH_PREFIX/man" -append_path "$OPAM_SWITCH_PREFIX/bin" +prepend_path "$OPAM_SWITCH_PREFIX/bin" diff --git a/sh/.profile b/sh/.profile index 2b794d7..0b1d175 100644 --- a/sh/.profile +++ b/sh/.profile @@ -3,13 +3,13 @@ # Most of this script is a user scoped version of /etc/profile -# Append "$1" to $PATH when not already in. +# Prepend "$1" to $PATH when not already in. # This function API is accessible to scripts in $XDG_CONFIG_HOME/profile.d -append_path() { +prepend_path() { case ":$PATH:" in *:"$1":*) ;; *) - PATH="${PATH:+$PATH:}$1" + PATH="$1${PATH:+:$PATH}" ;; esac } @@ -21,11 +21,6 @@ for generator in /usr/lib/systemd/user-environment-generators/*; do export $($generator | xargs) done -append_path "$HOME/.local/bin" - -# Force PATH to be environment -export PATH - # Load profiles from $XDG_CONFIG_HOME/profile.d if test -d "$XDG_CONFIG_HOME"/profile.d/; then for profile in "$XDG_CONFIG_HOME"/profile.d/*.sh; do @@ -34,5 +29,10 @@ if test -d "$XDG_CONFIG_HOME"/profile.d/; then unset profile fi +prepend_path "$HOME/.local/bin" + +# Force PATH to be environment +export PATH + # Unload our profile API functions unset -f append_path |