-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add compatibility with ZSH for deployement
- Loading branch information
Showing
1 changed file
with
30 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!" |