[Pkg-sysvinit-devel] Bug#624391: initscripts: postinst dupes /etc/motd into /etc/motd.tail

Nathan Stratton Treadway debbugs2010 at nathanst.com
Wed Jun 8 15:05:12 UTC 2011


On Sat, Apr 30, 2011 at 22:09:22 +1000, Kel Modderman wrote:
> On Thu, 28 Apr 2011 02:44:15 PM Andrew Pollock wrote:
> > In short, I don't think the postinst should be creating an /etc/motd.tail
> > if one doesn't exist already.
> 
> I do not completely understand this statement. Do you mean: postinst should 
> never create /etc/motd.tail at all?

The code to create the /etc/motd.tail file was added as part of the
migration from a "static" /etc/motd to the one found in /var/run/motd,
as mentioned in this changelog entry:

sysvinit (2.86.ds1-7) experimental; urgency=low
[...]
  * bootmisc.sh: Shorten motd header  (Closes: #340017)
  * bootmisc.sh: Store dynamic motd in /var/run/ and make /etc/motd a
    symbolic link.  The EDITMOTD variable no longer has any effect; to
    disable updating of the motd just point the /etc/motd symlink to a
    static file such as /etc/motd.static.
[...]
 -- Petter Reinholdtsen <pere at debian.org>  Sat, 17 Dec 2005 21:26:03 +0100

Basically, it looks like the idea was that the package postinst script
would preserve the existing file's contents into /etc/motd.tail, which
would then be used going forward (by bootmisc.sh) to re-generate the
/var/run/motd so that it looked like /etc/motd had looked prior to the
move.

(See 
  http://anonscm.debian.org/viewvc/pkg-sysvinit/sysvinit/trunk/debian/initscripts.postinst?r1=365&r2=380
or 
  http://snapshot.debian.org/archive/debian/20051219T000000Z/pool/main/s/sysvinit/sysvinit_2.86.ds1-7.diff.gz
for the exact changes.)

Unfortunately, this logic is still found in the postinst script, and it
runs every time the package is upgraded... even if /etc/motd was already
converted to a symlink to /var/run/motd on a prior upgrade.

I guess this hasn't turned out to be a big issue on Debian systems
because of the way the motd file generally gets used on those systems --
but even so, it seems like there's really no point for the postinst
script to still be attempting this /etc/motd -> /etc/motd.tail migration
processs these days....


 
> I'd be happy to look at/apply a patch if you could please whip one up?

The simplest patch just removes the motd.tail logic completely
(attached).

(You can find patches implementing a couple other approaches attached to
LP #659738:
  https://bugs.launchpad.net/ubuntu/+source/sysvinit/+bug/659738
, but off hand I don't see a compelling reason to use those over the
"simple" patch in the Debian package....)

						Nathan
-------------- next part --------------
--- initscripts.postinst	2011-06-08 10:44:48.000000000 -0400
+++ initscripts.postinst_no_motd-tail	2011-06-08 10:47:10.000000000 -0400
@@ -288,14 +288,6 @@
 #
 # Set up motd stuff, putting variable file in /var/run/
 #
-if [ ! -f /etc/motd.tail ]
-then
-	if [ -f /etc/motd ]
-	then
-		sed 1d /etc/motd > /etc/motd.tail
-		[ -s /etc/motd.tail ] || rm -f /etc/motd.tail
-	fi
-fi
 if [ ! -f /var/run/motd ]
 then
 	if [ -f /etc/motd ]


More information about the Pkg-sysvinit-devel mailing list