aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.rst2
-rwxr-xr-xbin/postpone-screensaver (renamed from scripts/postpone-screensaver)0
-rwxr-xr-xbin/update-motd55
-rw-r--r--system/update-motd.service15
-rw-r--r--user/postpone-screensaver.service2
5 files changed, 59 insertions, 15 deletions
diff --git a/README.rst b/README.rst
index 895741c..0731fdd 100644
--- a/README.rst
+++ b/README.rst
@@ -473,6 +473,6 @@ ______________
.. |website-xen| raw:: html
- <a href="http://ricardo.band/" target="_blank">XenGi</a>
+ <a href="http://xengi.de" target="_blank">XenGi</a>
diff --git a/scripts/postpone-screensaver b/bin/postpone-screensaver
index 7ece93d..7ece93d 100755
--- a/scripts/postpone-screensaver
+++ b/bin/postpone-screensaver
diff --git a/bin/update-motd b/bin/update-motd
new file mode 100755
index 0000000..658f859
--- /dev/null
+++ b/bin/update-motd
@@ -0,0 +1,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
diff --git a/system/update-motd.service b/system/update-motd.service
index a821688..740ea7b 100644
--- a/system/update-motd.service
+++ b/system/update-motd.service
@@ -1,23 +1,12 @@
[Unit]
Description=Update MOTD
+After=multi-user.target network.target
[Service]
-Type=oneshot
-ExecStart=/usr/bin/sh -c 'if [ -s /etc/motd.name ] ; then cat /etc/motd.name > /tmp/motd ; else cat /etc/hostname | banner -w 80 > /tmp/motd && echo >> /tmp/motd ; fi'
-ExecStart=/usr/bin/sh -c 'uname -a >> /tmp/motd'
-ExecStart=/usr/bin/sh -c 'echo >> /tmp/motd'
-ExecStart=-/usr/bin/sh -c 'pacman -Sy 2>&1 > /dev/null'
-ExecStart=/usr/bin/sh -c 'echo "Package updates available:" >> /tmp/motd'
-ExecStart=-/usr/bin/sh -c 'pacman -Qu >> /tmp/motd'
-ExecStart=/usr/bin/sh -c 'echo >> /tmp/motd'
-ExecStart=/usr/bin/sh -c 'echo "Security updates needed:" >> /tmp/motd'
-ExecStart=/usr/bin/sh -c 'if [ -x /usr/bin/arch-audit ]; then arch-audit -uf "%n|%c" >> /tmp/motd ; else echo "Install arch-audit from AUR." >> /tmp/motd ; fi'
-ExecStart=/usr/bin/sh -c 'if [ -x /usr/bin/lolcat ] ; then lolcat /tmp/motd > /etc/motd ; else mv /tmp/motd /etc/motd ; fi'
+ExecStart=/usr/bin/update-motd
PrivateDevices=yes
PrivateTmp=yes
ProtectSystem=full
ReadWriteDirectories=/etc/motd
ProtectHome=yes
NoNewPrivileges=yes
-
-
diff --git a/user/postpone-screensaver.service b/user/postpone-screensaver.service
index 92211f8..32a43c9 100644
--- a/user/postpone-screensaver.service
+++ b/user/postpone-screensaver.service
@@ -8,5 +8,5 @@ IOSchedulingClass=2
IOSchedulingPriority=7
EnvironmentFile=-/etc/conf.d/postpone-screensaver
EnvironmentFile=-/home/%u/.config/postpone-screensaver
-ExecStart=/usr/lib/systemd/scripts/postpone-screensaver
+ExecStart=/usr/bin/postpone-screensaver