Let zsteg install script add rubygems PATH to (bash|zsh)rc, config.fish

This commit is contained in:
Michael Rodler 2017-08-18 18:27:00 +02:00 committed by Yan
parent d62247af0e
commit f4b8abf963

View file

@ -1,3 +1,27 @@
#!/bin/bash -ex
gem install --user-install zsteg
GEM_BIN_PATH=$(gem environment | grep "USER INSTALL" | awk -F ': ' '{ print $2 }')/bin
MAGIC="# ctf-tools: gem install"
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=\$PATH:$GEM_BIN_PATH
EOF
fi
fi
done
f=~/.config/fish/config.fish
if [[ -e "$f" ]]; then
if ! grep "$MAGIC" "$f" >/dev/null 2>&1; then
cat >> "$f" << EOF
$MAGIC
set -x PATH \$PATH $GEM_BIN_PATH
EOF
fi
fi