From 598d19ba46f5960ce702f61af4fe883121a1154c Mon Sep 17 00:00:00 2001 From: Mylloon Date: Sun, 14 Nov 2021 21:13:42 +0100 Subject: [PATCH] Auto adding path to installed bash, zsh and fish --- .config/fish/config.fish | 4 ---- installgl4D.sh | 39 +++++++++++++++++++++++++++++++-------- 2 files changed, 31 insertions(+), 12 deletions(-) diff --git a/.config/fish/config.fish b/.config/fish/config.fish index 10b7ac8..6e6e657 100644 --- a/.config/fish/config.fish +++ b/.config/fish/config.fish @@ -8,9 +8,5 @@ set -x MANPAGER "sh -c 'col -bx | batcat -l man -p'" # SSH fish_ssh_agent -# GL4Dummies -set -gx PATH $HOME/local/bin $PATH -set -gx LD_LIBRARY_PATH $HOME/local/lib $LD_LIBRARY_PATH - # Exercism set -gx PATH ~/bin $PATH diff --git a/installgl4D.sh b/installgl4D.sh index 5bc1573..c44e4e8 100644 --- a/installgl4D.sh +++ b/installgl4D.sh @@ -15,12 +15,35 @@ rm -rf GL4Dummies # Fix for shared libraries (https://stackoverflow.com/a/9395355) sudo ldconfig +# changing env variables path and ld_library_path +# to correct locations to all the shell installed + +# to .bashrc if exists +if [ -f $HOME/.bashrc ] ; then + echo "" >> $HOME/.bashrc + echo "# GL4Dummies" >> $HOME/.bashrc + echo "export PATH=\$PATH:\$HOME/local/bin" >> $HOME/.bashrc + echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/local/lib" >> $HOME/.bashrc + echo "" >> $HOME/.bashrc +fi + +# to .zshrc if exists +if [ -f $HOME/.zshrc ] ; then + echo "" >> $HOME/.zshrc + echo "# GL4Dummies" >> $HOME/.zshrc + echo "export PATH=\$PATH:\$HOME/local/bin" >> $HOME/.zshrc + echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/local/lib" >> $HOME/.zshrc + echo "" >> $HOME/.zshrc +fi + +# if config.fish exists +if [ -f $HOME/.config/fish/config.fish ] ; then + echo "" >> $HOME/.config/fish/config.fish + echo "# GL4Dummies" >> $HOME/.config/fish/config.fish + echo "set -gx PATH \$HOME/local/bin \$PATH" >> $HOME/.config/fish/config.fish + echo "set -gx LD_LIBRARY_PATH \$HOME/local/lib $LD_LIBRARY_PATH" >> $HOME/.config/fish/config.fish + echo "" >> $HOME/.config/fish/config.fish +fi + echo "" -echo "" -echo "Add theses lines to your ~/.bashrc" -echo "export PATH=\$PATH:\$HOME/local/bin" -echo "export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$HOME/local/lib" -echo "" -echo "If you use Fish, add theses lines to your ~/.config/fish/config.fish" -echo "set -gx PATH $HOME/local/bin $PATH" -echo "set -gx LD_LIBRARY_PATH $HOME/local/lib $LD_LIBRARY_PATH" +echo "You may need to restart your shell to apply changes."