blob: 658f8593b0c8bafc4e7ae86b446cdc3ddc2055b8 (
plain)
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
|
#!/usr/bin/env bash
set -euo pipefail
# get the hostname
if [ -s /etc/motd.name ]; then
cat /etc/motd.name > /tmp/motd
elif [ -x /usr/bin/banner ]; then
cat /etc/hostname | banner -w 80 > /tmp/motd
else
cat /etc/hostname > /tmp/motd
fi
echo >> /tmp/motd
# get additional info
if [ -s /etc/motd.info ]; then
cat /etc/motd.info >> /tmp/motd
echo >> /tmp/motd
fi
# get currently running kernel version
uname -a >> /tmp/motd
echo >> /tmp/motd
# update package cache
set +eu
pacman -Sy 2>&1 > /dev/null
pacman -Qu > /tmp/updates
set -eu
# show updatable packages
if [ -s /tmp/updates ]; then
echo "Package updates available:" >> /tmp/motd
cat /tmp/updates >> /tmp/motd
echo >> /tmp/motd
fi
if [ -x /usr/bin/arch-audit ]; then
arch-audit -uf "%n|%c" >> /tmp/cves
if [ -s /tmp/cves ]; then
echo "Security updates needed:" >> /tmp/motd
cat /tmp/cves >> /tmp/motd
fi
else
echo "Install arch-audit for information on CVEs." >> /tmp/motd
fi
# move all to /etc/motd
if [ -x /usr/bin/lolcat ]; then
lolcat /tmp/motd > /etc/motd
else
cat /tmp/motd > /etc/motd
fi
exit 0
|