On Sat, 8 May 2010, Steve Langasek wrote:

> On Wed, May 05, 2010 at 06:38:49PM +0200, Julian Andres Klode wrote:
> > > On Wed, May 05, 2010 at 02:23:16AM +0200, Jean-Christophe Dubacq wrote:
> > > > This one was a bit hard to track down. After a while, my /etc/motd
> > > > would be reduced to one empty line or info about packages updates.
> 
> > > > It happens that pam_motd executes /etc/update-motd.d if it exists (with
> > > > run-parts) but nothing in this directory rebuilds the standard motd.
> > I did not know this.
> 
> > > > This could be a bug in update-notifier-common, or in pam (not providing
> > > > a small file such as:
> > > > ebene:~$ cat /etc/update-motd.d/00-header 
> > > > #!/bin/sh
> > > > uname -snrvm
> > > > [ -f /etc/motd.tail ] && cat /etc/motd.tail
> 
> > > Yes, I think this is a bug in update-notifier-common for shipping this 
> > > file
> > > in Debian without having an appropriate versioned dep on something that
> > > builds the main part of the motd.  Reassigning.
> > Is there something that builds it?
> 
> In Debian, I don't think there is yet (and if not, update-notifier-common
> should avoid shipping this code in Debian).  In Ubuntu,
> /etc/update-motd.d/00-header is provided as part of base-files, since that's
> the package which owns /etc/motd historically.

In Debian, the file /etc/motd is created the very first time
base-files is installed (by debootstrap) in this way:

if [ "$1" = "configure" ] && [ "$2" = "" ]; then
  [...]
  install_from_default /usr/share/base-files/motd          /etc/motd

Also, on upgrades, base-files tries to upgrade the file in this way:

if [ "$1" = "configure" ] && [ "$2" != "" ]; then
  if [ -f /etc/motd ]; then
    oldmd=`awk 'NR > 2' /etc/motd | md5sum | awk '{print $1}'`
    newmd=`awk 'NR > 2' /usr/share/base-files/motd | md5sum | awk '{print $1}'`
    if [ "$oldmd" != "$newmd" ]; then
      if grep -q "$oldmd" /usr/share/base-files/motd.md5sums; then
        awk 'NR <= 2' /etc/motd > /etc/motd.new
        awk 'NR > 2' /usr/share/base-files/motd >> /etc/motd.new
        mv /etc/motd /etc/motd.old
        mv /etc/motd.new /etc/motd
      fi
    fi
  fi
fi


If anybody is going to break this I will appreciate that it could be
discussed first, at least.


(I was warned about this bug by a neutral observer).



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to