From 6aa9cf77e5e3706c55ea7d740c0901802e3e51d2 Mon Sep 17 00:00:00 2001 From: Christian Haeusler <794584+corvus-ch@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:47:07 +0200 Subject: [PATCH] Preserve system PATH Up to this point 73linux wrote a hardcoded version of PATH into `.bashrc`. This disabled all system mechanism to alter the path. The PATH export was added even if $HOME/bin was already in the path or not. --- bin/runner.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bin/runner.sh b/bin/runner.sh index 653b877..fbf7074 100755 --- a/bin/runner.sh +++ b/bin/runner.sh @@ -300,9 +300,11 @@ EOF #setup bin dir and put in path mkdir -p ${HOME}/bin - CK=$(grep $HOME/bin $HOME/.bashrc) - if [ -z "$CK" ]; then - echo "export PATH=$PATH:${HOME}/bin" >>${HOME}/.bashrc + # Add $HOME/bin to PATH + # Prevent adding it more than once + # Prevent adding it if already added elswhere + if ! grep -q 'export PATH=$PATH:$HOME/bin' "${HOME}/.bashrc" && [[ ! "${PATH}" =~ "${HOME}/bin" ]]; then + echo 'export PATH=$PATH:$HOME/bin' >> "${HOME}/.bashrc" fi ##################################