diff options
author | David Runge <dave@sleepmap.de> | 2017-06-26 15:52:04 +0200 |
---|---|---|
committer | David Runge <dave@sleepmap.de> | 2017-06-26 15:52:04 +0200 |
commit | f7aeb073e09c5118063108659550743c1bd04755 (patch) | |
tree | a336c6ddf001eff77ad2fcedb669f1f50e5e77f2 | |
parent | bd0dad221eabfcd94d0848d022c61e06b30843b9 (diff) | |
parent | 8b3300b9a7105fa34252c90e30e43296d04eeb39 (diff) | |
download | uenv-0.9.tar.gz uenv-0.9.tar.bz2 uenv-0.9.tar.xz uenv-0.9.zip |
Merge branch 'master' of sleepmap.de:software/uenv0.9
* 'master' of sleepmap.de:software/uenv:
README.rst: Adding working homepage link for XenGi.
bin/update-motd: Fix non-zero exit code in bashs safe mode.
user/postpone-screensaver.service: Moving executable to /usr/bin. scripts/{postpone-screensaver,update-motd}: moving to bin subfolder for better distinction from scripts.
scripts/update-motd,system/update-motd.service: Adding script to be called by update-motd.service instead of using so many sh invocations in the service file.
-rw-r--r-- | README.rst | 2 | ||||
-rwxr-xr-x | bin/postpone-screensaver (renamed from scripts/postpone-screensaver) | 0 | ||||
-rwxr-xr-x | bin/update-motd | 55 | ||||
-rw-r--r-- | system/update-motd.service | 15 | ||||
-rw-r--r-- | user/postpone-screensaver.service | 2 |
5 files changed, 59 insertions, 15 deletions
@@ -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 |