Skip to content

Commit 659d325

Browse files
committed
Add compatibility with ZSH for deployement
1 parent 20d855d commit 659d325

File tree

1 file changed

+30
-2
lines changed

1 file changed

+30
-2
lines changed

deploy.sh

Lines changed: 30 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11
#!/usr/bin/env bash
2+
3+
add_profiled(){
24
cat <<EOF > /etc/profile.d/telegram-alert.sh
35
#!/usr/bin/env bash
4-
# Log connection
5-
bash /opt/ssh-login-alert-telegram/alert.sh
6+
# Log connections
7+
bash $ALERTSCRIPT_PATH
68
EOF
9+
}
10+
11+
add_zsh () {
12+
cat <<EOF >> /etc/zsh/zshrc
13+
14+
# Log connections
15+
bash $ALERTSCRIPT_PATH
16+
EOF
17+
}
18+
19+
ALERTSCRIPT_PATH="/opt/ssh-login-alert-telegram/alert.sh"
20+
21+
echo "Deploying alerts..."
22+
add_profiled
23+
24+
echo "Check if ZSH is installed.."
25+
26+
HAS_ZSH=$(grep -o -m 1 "zsh" /etc/shells)
27+
if [ ! -z $HAS_ZSH ]; then
28+
echo "ZSH is installed, deploy alerts to zshrc"
29+
add_zsh
30+
else
31+
echo "No zsh detected"
32+
fi
33+
34+
echo "Done!"

0 commit comments

Comments
 (0)