Skip to content

Commit

Permalink
AppMan: restrict ~/.profile's patch to those who need it
Browse files Browse the repository at this point in the history
Changed the "_patch_bashrc_and_profile" function to only modify the ~/.profile file if the output of `echo $PATH` places $HOME/.local/bin first in the $PATH list.

Only systems that need it will be affected by this patch, while all systems will only have two lines added to the bottom of the ~/.bashrc file.

See the previous commits listed at ivan-hc/AppMan#25 and ivan-hc/AppMan#26
  • Loading branch information
ivan-hc authored Dec 26, 2023
1 parent 8c5d0ef commit 003a6a6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions APP-MANAGER
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,10 @@ function _patch_bashrc_and_profile(){
echo 'export PATH=$(echo $PATH | tr ":" "\n" | grep -v "/.local/bin" | tr "\n" ":" | sed ''s/.$//'')' >> $HOME/.bashrc
echo -e 'export PATH=$PATH:$(xdg-user-dir USER)/.local/bin\n' >> $HOME/.bashrc
fi
if $( grep -q 'PATH="$HOME/.local/bin:$PATH"' $HOME/.profile); then
sed -i 's#PATH="$HOME/.local/bin:$PATH"#PATH="$PATH:$HOME/.local/bin"#g' $HOME/.profile
if $( echo "$(echo $PATH | tr ":" "\n" | head -1)" | grep -q "/.local/bin") ; then
if $( grep -q 'PATH="$HOME/.local/bin:$PATH"' $HOME/.profile); then
sed -i 's#PATH="$HOME/.local/bin:$PATH"#PATH="$PATH:$HOME/.local/bin"#g' $HOME/.profile
fi
fi
}

Expand Down Expand Up @@ -2224,7 +2226,7 @@ case "$1" in

'version'|'-v'|'--version')

echo "5.3-5";;
echo "5.3-6";;

*) exec $AMCLIPATH ;;

Expand Down

0 comments on commit 003a6a6

Please sign in to comment.