-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbash_greeter.sh
81 lines (55 loc) · 1.83 KB
/
bash_greeter.sh
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
################################################################################
# #
# Various greeting information - Needs /.bash_functions #
# #
# binaryanomaly - v0.1 #
# #
################################################################################
source ~/bash_files/bash_print_functions.sh
__print_hostname ()
{
local STR_HOSTNAME="-= $HOSTNAME =-"
if [[ -x /usr/bin/figlet ]]; then
#Print hostename with figlets
__print_ascii_art "$STR_HOSTNAME"
else
__print_centered_string "$STR_HOSTNAME" "0"
fi
#printf "${NORMAL}\n"
}
__print_sysinfo ()
{
local SYS_INFO=$(uname -srmo)
local SYS_INFO="-= $SYS_INFO =-"
printf ${ORANGE}
__print_centered_string "$SYS_INFO" "0"
printf "${NORMAL}\n"
__print_line
}
__print_diskinfo ()
{
# disk usage, minus def and swap
local DISK_INFO=$(df -h -x tmpfs -x devtmpfs -x ecryptfs -x fuse.encfs -T)
printf ${POWDER_BLUE}
__print_centered_multiline "$DISK_INFO" "0"
# printf "%s\n" "$DISK_INFO" | boxes -d ada-box -ph8v1
printf "${NORMAL}\n"
__print_line
}
__print_lastlogins ()
{
# LAST_LOGINS=$(last -in 3 -ad)
# printf "%s\n" "$LAST_LOGINS" | boxes -d ada-box -ph8v1
local LAST_LOGINS=$(last -in 3 -ad)
#local linecount=$(printf "%s\n" "$LAST_LOGINS" | grep -c '^')
printf ${GREY}
__print_centered_multiline "$LAST_LOGINS" "0"
printf "${NORMAL}\n"
__print_line
}
# Call functions
__print_hostname
__print_sysinfo
__print_diskinfo
__print_lastlogins