Skip to content

Commit

Permalink
Add compatibility with ZSH for deployement
Browse files Browse the repository at this point in the history
  • Loading branch information
vdeville committed Aug 31, 2019
1 parent 20d855d commit 659d325
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
#!/usr/bin/env bash

add_profiled(){
cat <<EOF > /etc/profile.d/telegram-alert.sh
#!/usr/bin/env bash
# Log connection
bash /opt/ssh-login-alert-telegram/alert.sh
# Log connections
bash $ALERTSCRIPT_PATH
EOF
}

add_zsh () {
cat <<EOF >> /etc/zsh/zshrc
# Log connections
bash $ALERTSCRIPT_PATH
EOF
}

ALERTSCRIPT_PATH="/opt/ssh-login-alert-telegram/alert.sh"

echo "Deploying alerts..."
add_profiled

echo "Check if ZSH is installed.."

HAS_ZSH=$(grep -o -m 1 "zsh" /etc/shells)
if [ ! -z $HAS_ZSH ]; then
echo "ZSH is installed, deploy alerts to zshrc"
add_zsh
else
echo "No zsh detected"
fi

echo "Done!"

0 comments on commit 659d325

Please sign in to comment.