--- update-motd-3.6.orig/debian/changelog +++ update-motd-3.6/debian/changelog @@ -0,0 +1,348 @@ +update-motd (3.6-0ubuntu9) hirsute; urgency=medium + + * debian/tests/*: Add script debian/tests/wait-for-apt-update-to-finish and + call it. One of the integrations we're testing (freedombox) starts doing + an `apt update` when it's installed, and this breaks `update-motd`. Wait + for this to settle before calling `update-motd`. Perhaps it would be + better if this test didn't test external integrations which can break it + for reasons not to do with `update-motd` itself, and leave that up to + those packages themselves to do. + + -- Iain Lane Wed, 03 Mar 2021 10:53:23 +0000 + +update-motd (3.6-0ubuntu8) hirsute; urgency=low + + * debian/control: fix typo compliment -> complement (LP: #1900318) + + -- Koen Beek Wed, 16 Dec 2020 00:28:20 +0100 + +update-motd (3.6-0ubuntu7) groovy; urgency=medium + + [ Jinming Wu, Patrick ] + * update-motd.sh: remove an extra "once" (LP: #1886534) + + [ Balint Reczey ] + * debian/control: Vcs-* to point to the new packaging repository + + -- Balint Reczey Wed, 12 Aug 2020 19:37:58 +0200 + +update-motd (3.6-0ubuntu6) focal; urgency=medium + + * debian/tests/update-motd: Print not tested motd snippets + * debian/tests/control: Test update-motd.d snippet or fwupd, too + + -- Balint Reczey Thu, 12 Dec 2019 18:57:29 +0100 + +update-motd (3.6-0ubuntu5) focal; urgency=medium + + * show-motd: Show MOTD from /etc/profile.d snippet in the first shell every + day instead of showing it only after 24h is elapsed since showing it + last time. (LP: #1855918) + + -- Balint Reczey Tue, 10 Dec 2019 20:21:57 +0100 + +update-motd (3.6-0ubuntu4) focal; urgency=medium + + * update-motd.sh: Don't source, but run update-motd. + This fixes being dropped out of shell when update-motd exits + with nonzero value. + * update-motd.sh: Don't misleadingly indicate that script is + running with set -e + * update-motd.sh: Don't set "stamp" and eval_gettext() + in /etc/profile.d script + + -- Balint Reczey Sat, 07 Dec 2019 10:25:10 +0100 + +update-motd (3.6-0ubuntu3) focal; urgency=medium + + * update-motd.sh: Fix space in message about .hushlogin + + -- Balint Reczey Fri, 06 Dec 2019 17:31:18 +0100 + +update-motd (3.6-0ubuntu2) focal; urgency=medium + + * Show MOTD using an /etc/profile.d snippet when it was not shown + by PAM and it was shown more than a day ago. (LP: #1855089) + - Add autopkgtest + - Set MOTD_SHOWN=update-motd in /etc/profile.d after showing MOTD + - Add Breaks: for packages with /etc/update-motd.d snippets failing as + a normal user. Also add Breaks: on libpam-modules not setting + MOTD_SHOWN=pam. + - I18n the message about .hushlogin + - Split /etc/profile.d snippet to new show-motd binary package + to not change the behaviour of the update-motd package on upgrade. + - update-motd.8: Update man page with new update-motd --show-only option + and also mention the new show-motd package. + + -- Balint Reczey Fri, 06 Dec 2019 16:52:46 +0100 + +update-motd (3.6-0ubuntu1) vivid; urgency=low + + * .bzr-builddeb/default.conf: + - remove dirty directory + * debian/control: + - clean up package description + * debian/manpages, update-motd.1 => update-motd.8: LP: #907688 + - move from a .1 to .8 manpage, minor doc updates + * debian/preinst, debian/prerm: + - deprecate, at these have not been necessary in a very long time + * debian/release-build.sh, debian/release.sh: + - deprecate, as these are maintained in bikeshed now + * debian/rules: + - simplify/modernize build + * README: + - update manpage reference + * update-motd: + - add a permission denied check, and better error handling + + -- Dustin Kirkland Tue, 11 Nov 2014 10:48:44 -0600 + +update-motd (3.5-0ubuntu1) karmic; urgency=low + + * debian/rules: install changelog, LP: #401229 + + -- Dustin Kirkland Sun, 19 Jul 2009 21:21:39 -0500 + +update-motd (3.4-0ubuntu1) karmic; urgency=low + + * debian/rules: ensure that this package isn't *totally* empty, + so install docs, was causing nasty failures on upgrades, LP: #400462 + + -- Dustin Kirkland Fri, 17 Jul 2009 03:27:10 -0500 + +update-motd (3.3-0ubuntu1) karmic; urgency=low + + [ Dustin Kirkland ] + * control, dirs, install, rules: this package is now just a placeholder, + depending on libpam-modules which provides pam_motd; empty out the + installed contents of this package; leaving the sources in bzr for + historical purposes (ah, memories); LP: #399071, #400131 + + [ Loïc Minier ] + * Call dh_installchangelogs to install debian/changelog in /usr/share/doc. + * Drop references to build-stamp, configure-stamp and the configure target + ase these aren't used. + * Call dh_* with -i in binary-indep. + * Strip boilerplate from rules. + * Drop useless dirs from debian/dirs. + * Drop unused/bogus po-debconf from build-deps. + * Use debian/manpages instead of args to dh_installman for consistency. + + -- Dustin Kirkland Thu, 16 Jul 2009 17:33:44 -0500 + +update-motd (3.2-0ubuntu1) karmic; urgency=low + + * update-motd.sh: respect ~/.hushlogin, LP: #399738 + + -- Dustin Kirkland Wed, 15 Jul 2009 22:30:41 -0500 + +update-motd (3.1-0ubuntu1) karmic; urgency=low + + * debian/prerm: remove /etc/profile.d/update-motd.sh + + -- Dustin Kirkland Mon, 13 Jul 2009 20:36:22 -0500 + +update-motd (3.0-0ubuntu1) karmic; urgency=low + + [ update-motd 3.0 major redesign ] + NOTE: this release will be very short lived--this entire package + should be obsolete when pam_motd assumes this functionality; + see Launchpad #399071 + * update-motd + - drop the daemon design, as this was heavily objectionable + - drop the cronjob design (actually, this was dropped in 2.0) + - instead, make update-motd a script sourced in /etc/profile.d, + such that it is *only* run on interactive login, and cpu cycles + are not wasted otherwise + * update-motd.sh: script installed in /etc/profile.d + * update-motd.1: updated accordingly + * debian/control: updated description, drop python dependency + * debian/dirs, debian/install: only installing in /usr/bin and + /etc/profile.d + * debian/init, debian/iwatch.xml: dropped entirely (also fixes LP: #398646) + * debian/postinst: purge unneeded /etc files + * debian/release-build.sh, debian/release.sh: bump major version to '3' + * debian/rules: drop init script installation, link /usr/bin/update-motd + into /etc/profile.d + + -- Dustin Kirkland Mon, 13 Jul 2009 20:02:54 -0500 + +update-motd (2.0-0ubuntu1) karmic; urgency=low + + [ update-motd 2.0 major redesign ] + * update-motd: + - rewrite update-motd as a python daemon, rather than a series of + difficult-to-manage cronjobs + - improve locking, LP: #340761 + * update-motd: manpage updated for daemon re-design + * debian/update-motd.cron.d: dropped, no longer needed + * debian/rules: added a get-orig-source target, install init, don't + install cron + * debian/control: updated description for the daemon, depend on python, + drop cron dependency + * debian/postinst: delete the cron.d file in older installations + * ChangeLog: dropped; please use debian/changelog + + -- Dustin Kirkland Sun, 12 Jul 2009 17:08:55 -0500 + +update-motd (1.13) jaunty; urgency=low + + [ Jon Bernard ] + * debian/install: fix installation path for iwatch.xml + * debian/changelog: use Jon's launchpad email address + * update-motd: + - Fix renice output redirect, LP: #339774 + - Fix usage() formatting + + -- Dustin Kirkland Sun, 08 Mar 2009 23:27:56 -0500 + +update-motd (1.12) jaunty; urgency=low + + * Inotify support + - big thanks for Jon Bernard for all his help! + * debian/control: suggest iwatch + * debian/dirs: add /etc/update-motd directory + * debian/install: install /etc/update-motd/iwatch.xml + * debian/iwatch.xml: iwatch configuration file + * debian/update-motd.cron.d: use the "d" argument for the 10-minute job + * update-motd: + - default FREQ to "d" + - default vars added for inotify + - usage statement updated accordingly + - ensure that the cronjobs are no-ops, if running in inotify mode + - handle starting/stopping inotify via --enable and --disable + - move the trap to the top, and make sure the lock is established + - do not run the /etc/update-motd.*/ scripts, if in inotify mode + * update-motd.1: documentation updated + + -- Dustin Kirkland Thu, 05 Mar 2009 13:20:14 -0600 + +update-motd (1.11) jaunty; urgency=low + + * update-motd: don't fail the entire script, if renice/ionice fail, + LP: #331921; ionice to 'idle' rather than 'best-effort' + + -- Dustin Kirkland Thu, 05 Mar 2009 10:51:26 -0600 + +update-motd (1.10) jaunty; urgency=low + + * debian/update-motd.cron.d: Fix broken crontab entries, LP: #312809 + + -- Dustin Kirkland Mon, 05 Jan 2009 12:51:54 -0600 + +update-motd (1.9) jaunty; urgency=low + + * update-motd: support other run frequencies, run very "nice" when not + --force'd + * update-motd.1: document the new run frequencies + * debian/dirs: create the additional run frequency directories + * debian/update-motd.cron.d: install cronjobs to handle the new run + frequencies + + -- Dustin Kirkland Tue, 11 Nov 2008 00:42:47 +0100 + +update-motd (1.8) intrepid; urgency=low + + * update-motd: on disable, regenerate a motd that does not have the possibly + stale update-motd data in it; on enable, run update-motd immediately + (LP: #276539) + * update-motd.1: update the manpage accordingly + + -- Dustin Kirkland Tue, 30 Sep 2008 17:30:34 -0500 + +update-motd (1.7) intrepid; urgency=low + + * Packaging suggestions (LP: #271848) + * debian/postinst: use lt-nl instead of lt + * debian/prerm: remove entirely + * debian/rules: use dh_installcron + * debian/update-motd.cron.d: ensure that the binary exists and is + executable when running the cronjob + * update-motd.cron: moved to debian/update-motd.cron.d + * debian/copyright: GPLv3 only, adhere to Canonical guidelines + * debian/control: added VCS-* info to point to upstream bazaar branches + + -- Dustin Kirkland Fri, 19 Sep 2008 18:13:55 -0500 + +update-motd (1.6) intrepid; urgency=low + + * ChangeLog: fill in details of the last few releases + * debian/config: purge debconf configuration + * debian/dirs: purge usr/share/update-motd and etc/default/update-motd + * debian/init.d: purge init script + * debian/install: install cronjob directly to etc/cron.d + * debian/po/*: purge translation of template + * debian/postinst: purge debconf configuration, remove init script left by + older update-motd version (<1.6) + * debian/rules: purge po update, install the cronjob into place, purge init + script installation + * debian/templates: purge debconf questions + * update-motd: + - add usage statement + - add options for --disable, --enable + - adjust error messages + - do no execute if the .disabled file exists + - write the last-run timestamp to the .lastrun file + * update-motd.1: adjust manpage to match new operation + * update-motd.cron: adjust header comment to match new operation + * update-motd.default: purge etc/default file + + -- Dustin Kirkland Wed, 17 Sep 2008 21:14:18 -0500 + +update-motd (1.5) intrepid; urgency=low + + * update-motd: print error messages to stderr, rather than stdout, + (LP: #271368). + + -- Dustin Kirkland Wed, 17 Sep 2008 09:18:54 -0500 + +update-motd (1.4) intrepid; urgency=low + + * debian/config: validate that 1<=FREQ_IN_MIN<=59, at most 5 times before + defaulting to FREQ_IN_MIN=10 + * debian/templates: valid input is 1 to 59 minutes + + -- Dustin Kirkland Mon, 15 Sep 2008 21:37:44 -0500 + +update-motd (1.3) intrepid; urgency=low + + * debian/config: only ask freq-in-min question if update-motd is enabled, + set default FREQ_IN_MIN back to 10 + * debian/postinst: only update FREQ_IN_MIN if update-motd is enabled, remove + the cronjob entirely if update-motd is disabled + + -- Dustin Kirkland Mon, 15 Sep 2008 16:08:37 -0500 + +update-motd (1.2) intrepid; urgency=low + + * debian/config: extract FREQ_IN_MIN from /etc/cron.d/update-motd + * debian/init.d: + - check that RUN=yes before starting, and that the cronjob exists + - ditto for the status action + - touch /var/run/update-motd.enabled if running + - use proper log_daemon_msg/log_end_msg for start/stop/refresh + * debian/postinst + - update the default file on RUN=yes|no + - create cronjob from template, using FREQ_IN_MIN debconf selection + * update-motd: + - check that update-motd is enabled (/var/run/update-motd.enabled) + - add argument handling and support for --force + * update-motd.1: + - added documentation about --force + - improved manpage formatting + * update-motd.default: remove FREQ_IN_MIN, as it's no longer set here + + -- Dustin Kirkland Mon, 15 Sep 2008 14:55:18 -0500 + +update-motd (1.1) intrepid; urgency=low + + * debian/control: Description line was too long (LP: #260441). + + -- Dustin Kirkland Fri, 22 Aug 2008 17:30:56 +0100 + +update-motd (1.0) intrepid; urgency=low + + * Initial package creation (LP: #260412) + + -- Dustin Kirkland Fri, 22 Aug 2008 10:36:38 +0100 + --- update-motd-3.6.orig/debian/compat +++ update-motd-3.6/debian/compat @@ -0,0 +1 @@ +6 --- update-motd-3.6.orig/debian/control +++ update-motd-3.6/debian/control @@ -0,0 +1,41 @@ +Source: update-motd +Section: admin +Priority: extra +Maintainer: Dustin Kirkland +Build-Depends: debhelper (>= 6) +Standards-Version: 3.8.0 +Vcs-Git: https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/update-motd -b ubuntu/master +Vcs-Browser: https://git.launchpad.net/~ubuntu-core-dev/ubuntu/+source/update-motd + +Package: update-motd +Architecture: all +Depends: ${misc:Depends}, libpam-modules (>= 1.0.1-9ubuntu3) +Description: complements pam_motd in libpam-modules + . + This package installs a script that immediately dynamically generates + a message-of-the-day by running scripts installed in /etc/update-motd.d, + in lexical order. + . + Other packages, or system administrators should symlink scripts into + /etc/update-motd.d, pre-pending a 2-digit number to handle ordering. + . + The functionality formerly provided by this package is now integrated into + pam_motd, in libpam-modules. + +Package: show-motd +Architecture: all +Depends: ${misc:Depends}, + update-motd (>= 3.6-0ubuntu1.19.10.0) +Breaks: base-files (<< 11ubuntu2), + libpam-modules (<< 1.3.1-5ubuntu1.19.10.0), + ubuntu-release-upgrader-core (<< 1:20.04.5), + update-notifier-common (<< 3.192.26.1) +Description: show message of the day in interactive shells + . + This package installs a script in /etc/profile.d that dynamically + generates and shows a message-of-the-day in inteactive shells by + running scripts installed in /etc/update-motd.d. + . + Showing the message-of-the-day in shells is useful when pam_motd does + not show it, for example when starting the interactive shell does not + require login. --- update-motd-3.6.orig/debian/copyright +++ update-motd-3.6/debian/copyright @@ -0,0 +1,26 @@ +This package was created by Dustin Kirkland +Wed, 13 Aug 2008 17:37:37 -0500 + +Upstream Author: Dustin Kirkland + +Copyright: + Copyright (C) 2008 Canonical Ltd. + All rights reserved. + +License: + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License version 3, + as published by the Free Software Foundation. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + + On Debian systems, the complete text of the GNU General Public + License, version 3, can be found in /usr/share/common-licenses/GPL-3. + --- update-motd-3.6.orig/debian/dirs +++ update-motd-3.6/debian/dirs @@ -0,0 +1 @@ +etc/update-motd.d --- update-motd-3.6.orig/debian/docs +++ update-motd-3.6/debian/docs @@ -0,0 +1,2 @@ +README +THANKS --- update-motd-3.6.orig/debian/gbp.conf +++ update-motd-3.6/debian/gbp.conf @@ -0,0 +1,3 @@ +[DEFAULT] +debian-branch = ubuntu/master +debian-tag = ubuntu/%(version)s --- update-motd-3.6.orig/debian/rules +++ update-motd-3.6/debian/rules @@ -0,0 +1,4 @@ +#!/usr/bin/make -f + +%: + dh $@ --- update-motd-3.6.orig/debian/show-motd.install +++ update-motd-3.6/debian/show-motd.install @@ -0,0 +1 @@ +update-motd.sh /etc/profile.d --- update-motd-3.6.orig/debian/tests/control +++ update-motd-3.6/debian/tests/control @@ -0,0 +1,28 @@ +Tests: show-motd +# mythtv-status is buggy +Depends: @, + apt-file, + base-files, + fortunes-ubuntu-server, + freedombox, + fwupd [armhf], + overlayroot, + python3, + ubuntu-release-upgrader-core, + unattended-upgrades, + update-notifier-common + +Tests: update-motd +# mythtv-status is buggy +Depends: @, + apt-file, + base-files, + fortunes-ubuntu-server, + freedombox, + fwupd [armhf], + overlayroot, + python3, + ubuntu-release-upgrader-core, + unattended-upgrades, + update-notifier-common +Restrictions: needs-root --- update-motd-3.6.orig/debian/tests/show-motd +++ update-motd-3.6/debian/tests/show-motd @@ -0,0 +1,10 @@ +#!/bin/sh + +unset MOTD_SHOWN + +debian/tests/wait-for-apt-update-to-finish + +RET=0 +bash -i -c '. /etc/profile.d/update-motd.sh' 2> stdout || RET=$? +egrep -v '(bash: cannot set terminal process group|no job control in this shell)' stdout >&2 || true +exit $RET --- update-motd-3.6.orig/debian/tests/update-motd +++ update-motd-3.6/debian/tests/update-motd @@ -0,0 +1,17 @@ +#!/bin/sh + +set -e + +debian/tests/wait-for-apt-update-to-finish + +# generate and show MOTD +update-motd + +# check if there are not tested snippets +# mythtv status is buggy +apt-file update +for i in $(apt-file search /etc/update-motd.d | grep -v mythtv-status | cut -d' ' -f2); do + if ! [ -f $i ]; then + echo "ERROR: Untested update-motd snippet: $(apt-file search $i): $i" >&2 + fi +done --- update-motd-3.6.orig/debian/tests/wait-for-apt-update-to-finish +++ update-motd-3.6/debian/tests/wait-for-apt-update-to-finish @@ -0,0 +1,39 @@ +#!/usr/bin/python3 + +# If there's any `apt update` running, wait for it to finish. This is an +# inherently racy thing to do but it might help for some tests. + +import ctypes +import fcntl +import os +import struct +import sys + +LOCK_DIR = "/var/lib/apt/lists/lock" + +if os.geteuid() != 0: + print("Must be root, exiting.", file=sys.stderr) + sys.exit(1) + +lockdata = struct.pack("hhllhh", fcntl.F_WRLCK, 0, 0, 0, 0, 0) + +f = os.open(LOCK_DIR, os.O_RDWR) +rv = fcntl.fcntl(f, fcntl.F_SETFL, os.O_NDELAY) + +if rv == -1: + print(f"Unable to set O_NDELAY on {LOCK_DIR}", file=sys.stderr) + sys.exit(1) + +print( + f"Attempting to lock {LOCK_DIR} to wait for any currently running apt updates to finish...", + end=" ", +) +rv = fcntl.fcntl(f, fcntl.F_SETLKW, lockdata) +if rv == -1: + print( + f"Unable to lock {LOCK_DIR}: {os.strerror(ctypes.get_errno())}", file=sys.stderr + ) + sys.exit(1) +print("locked, exiting.") + +os.close(f) --- update-motd-3.6.orig/debian/update-motd.install +++ update-motd-3.6/debian/update-motd.install @@ -0,0 +1 @@ +update-motd usr/sbin --- update-motd-3.6.orig/debian/update-motd.manpages +++ update-motd-3.6/debian/update-motd.manpages @@ -0,0 +1 @@ +update-motd.8 --- update-motd-3.6.orig/po/POTFILES.in +++ update-motd-3.6/po/POTFILES.in @@ -0,0 +1 @@ +update-motd.sh --- update-motd-3.6.orig/po/update-motd.pot +++ update-motd-3.6/po/update-motd.pot @@ -0,0 +1,28 @@ +# Update-motd message translation template +# Copyright (C) 2019 Canonical Ltd. +# This file is distributed under the same license as the update-motd package. +# Balint Reczey , 2019 +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: PACKAGE VERSION\n" +"Report-Msgid-Bugs-To: \n" +"POT-Creation-Date: 2019-12-06 00:08+0100\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"Language: \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=CHARSET\n" +"Content-Transfer-Encoding: 8bit\n" + +#: ../update-motd.sh:20 +#, sh-format +msgid "This message is shown once once a day. To disable it please create the" +msgstr "" + +#: ../update-motd.sh:22 +#, sh-format +msgid "file." +msgstr "" --- update-motd-3.6.orig/update-motd +++ update-motd-3.6/update-motd @@ -20,13 +20,19 @@ set -e -if ! touch /var/run/motd.new 2>/dev/null; then +if [ "$1" = "--show-only" ]; then + SHOW_ONLY=true +else + SHOW_ONLY=false +fi + +if ! $SHOW_ONLY && ! touch /var/run/motd.new 2>/dev/null; then echo "ERROR: Permission denied, try:" 1>&2 echo " sudo $0" 1>&2 exit 1 fi -if run-parts --lsbsysinit /etc/update-motd.d > /var/run/motd.new; then +if ! $SHOW_ONLY && run-parts --lsbsysinit /etc/update-motd.d > /var/run/motd.new; then if mv -f /var/run/motd.new /var/run/motd; then cat /var/run/motd exit 0 @@ -34,6 +40,9 @@ echo "ERROR: could not install new MOTD" 1>&2 exit 1 fi +elif ! $SHOW_ONLY; then + echo "ERROR: could not generate new MOTD" 1>&2 + exit 2 +elif $SHOW_ONLY; then + run-parts --lsbsysinit /etc/update-motd.d fi -echo "ERROR: could not generate new MOTD" 1>&2 -exit 2 --- update-motd-3.6.orig/update-motd.8 +++ update-motd-3.6/update-motd.8 @@ -1,10 +1,10 @@ -.TH update-motd 8 "14 February 2013" "update-motd" +.TH update-motd 8 "6 December 2019" "update-motd" .SH NAME update-motd \- immediately update the dynamic MOTD and print it to stdout .SH SYNOPSIS -.B update-motd +.B update-motd [--show-only] .SH DESCRIPTION The PAM MOTD module updates the Message-of-the-Day automatically on user logins. @@ -15,6 +15,8 @@ Note that only the system administrator can typically write to the MOTD, and thus this utility should be executed as the root user. +The program also accepts the \fB --show-only\fR option to not update, just show the MOTD. Regular users can use this option to see the dynamically generated MOTD even when the root user did not generate it in advance. The show-motd package contains the \fI/etc/profile.d/update-motd.sh\fP snipped to show MOTD in interactive shells when the PAM MOTD module did not show it on login. + For best practices and additional information, please see \fBupdate-motd\fP(5). .SH FILES --- update-motd-3.6.orig/update-motd.sh +++ update-motd-3.6/update-motd.sh @@ -1,9 +1,29 @@ -#!/bin/sh -e +#!/bin/sh + +stamp="$HOME/.motd_shown" + +eval_gettext() { + if type gettext > /dev/null 2>&1 ; then + echo $(env TEXTDOMAIN=update-motd TEXTDOMAINDIR=/usr/share/locale gettext "$1") + else + echo "$1" + fi +} # Only display this information in interactive shells if echo "$-" | grep -qs "i"; then - # Also, don't display if .hushlogin exists - if [ ! -e "$HOME/.hushlogin" ]; then - . /usr/bin/update-motd + # Also, don't display if .hushlogin exists or MOTD was shown recently + if [ ! -e "$HOME/.hushlogin" ] && [ -z "$MOTD_SHOWN" ] && ! find $stamp -newermt 'today 0:00' 2> /dev/null | grep -q -m 1 '.'; then + [ $(id -u) -eq 0 ] || SHOW="--show-only" + update-motd $SHOW + echo "" + eval_gettext "This message is shown once a day. To disable it please create the" + echo -n "$HOME/.hushlogin " + eval_gettext "file." + touch $stamp + export MOTD_SHOWN=update-motd fi fi + +unset -f eval_gettext +unset stamp