-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmotd
executable file
·40 lines (32 loc) · 827 Bytes
/
motd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
source $(dirname "${BASH_SOURCE[0]}")/.abash/abash.sh
MOTD_FILE=/etc/motd
MOTD_BANNER_FILE=/etc/motd-banner
MOTD_TAGLINE_FILE=/etc/motd-tagline
MOTD_WARNING_FILE=/etc/motd-warning
indent() {
echo "$1" | sed 's/^/ /g'
}
print_motd_file() {
local _FILE_PATH=$(console_file_path $1)
[ -f "$1" ] && echo -e "\n$(indent "$(cat $_FILE_PATH)")"
}
print_motd_banner() {
echo -en "\e[1;$(prompt-color $(pfarg color))m"
print_motd_file $MOTD_BANNER_FILE
print_motd_file $MOTD_TAGLINE_FILE
echo -en '\e[0m'
}
print_motd_body() {
print_motd_file $MOTD_FILE
}
print_motd_warning() {
print_motd_file $MOTD_WARNING_FILE
}
print_motd_banner
echo
echo -e " $(uname -sr) ($(uptime -p))"
[ -n "$SSH_TTY" ] && echo -e " $(sshd -V 2>&1 | grep -im1 ssh)"
print_motd_body
arge warning && print_motd_warning
echo