update-motd

Dynamically update /etc/motd without relying on pam_motd
git clone git://git.danielmoch.com/update-motd.git
Log | Files | Refs

commit 829a4c6b226bc431d3139146abb7743efcbd211d
parent f8ca311f734b4811f57f3006ed2ec41964c13dd6
Author: Daniel Moch <daniel@danielmoch.com>
Date:   Sun,  5 Jan 2020 06:34:16 -0500

Add support for Slackware

Diffstat:
Acontrib/slackware/20-slackpkg | 18++++++++++++++++++
Msrc/update-motd.d/10-fortune | 7++++++-
2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/contrib/slackware/20-slackpkg b/contrib/slackware/20-slackpkg @@ -0,0 +1,18 @@ +#!/bin/sh +out=/run/motd.slackpkg +script=slackpkg\ check-updates + +if [ -f "$out" ] +then + echo + cat $out + lastrun=`stat -c %Y "$out"` || lastrun=0 + expiration=`expr $lastrun + 3600` + + if [ `date +%s` -ge $expiration ] + then + $script > "$out" & + fi +else + $script > "$out" & +fi diff --git a/src/update-motd.d/10-fortune b/src/update-motd.d/10-fortune @@ -1,2 +1,7 @@ #!/bin/sh -[ -x /usr/bin/fortune ] && echo && /usr/bin/fortune +[ -d /usr/games ] && PATH=/usr/games:$PATH +if type fortune > /dev/null 2>&1 +then + echo + fortune +fi