mirror of
https://github.com/zardus/ctf-tools
synced 2024-12-04 18:29:26 +00:00
don't repeatedly add ctf-tools to PATH in (bash|zsh)rc, config.fish
This commit is contained in:
parent
f4b8abf963
commit
17d6bceea0
1 changed files with 20 additions and 7 deletions
|
@ -146,15 +146,28 @@ function base_build_setup()
|
|||
|
||||
## setup PATH for several shells
|
||||
|
||||
echo "export PATH=\"$PWD/bin:\$PATH\"" >> ~/.bashrc
|
||||
MAGIC="# ctf-tools: PATH setup"
|
||||
# make sure at least bashrc exists in case of plain VM setup
|
||||
touch ~/.bashrc
|
||||
|
||||
if [ -e ~/.zshrc ]
|
||||
then
|
||||
echo "export PATH=\"$PWD/bin:\$PATH\"" >> ~/.zshrc
|
||||
fi
|
||||
for f in ~/.bashrc ~/.zshrc; do
|
||||
if [[ -e "$f" ]]; then
|
||||
if ! grep "$MAGIC" "$f" >/dev/null 2>&1; then
|
||||
cat >> "$f" << EOF
|
||||
$MAGIC
|
||||
export PATH=$PWD/bin:\$PATH
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -e ~/.config/fish/config.fish ]; then
|
||||
echo "set -x PATH $PWD/bin \$PATH " >> ~/.config/fish/config.fish
|
||||
if [[ -e "$f" ]]; then
|
||||
if ! grep "$MAGIC" "$f" >/dev/null 2>&1; then
|
||||
cat >> "$f" << EOF
|
||||
$MAGIC
|
||||
set -x PATH $PWD/bin \$PATH
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ ! -e "$PWD/bin/ctf-tools-pip3" ]]; then
|
||||
|
|
Loading…
Reference in a new issue