/etc/motd problem at startup

From: <serge_at_euler.Berkeley.EDU>
Date: Wed, 01 Mar 95 10:31:54 -0800

On a related note, /sbin/init.d/motd uses mv to update /etc/motd, which
means that if you changed /etc/motd's permissions and/or group and/or
owner and/or made it a link (e.g. so that your dumper could post
shutdown notices in it for full dumps), these changes will get wiped out
at next reboot.

The fix is something like the following:

*** /sbin/init.d/motd.old Wed Mar 01 10:31:20 1995
--- /sbin/init.d/motd Wed Mar 01 10:24:59 1995
***************
*** 33,39 ****
  (strings -14 "/`sizer -b`" | grep 'DEC OSF/1 .* (Rev'; \
  test -x $UWS_VERS_CMD && $UWS_VERS_CMD; \
  test -f $MOTD_FILE && grep -v 'DEC OSF/1 .* (Rev' <$MOTD_FILE)>$MOTD_FILE.$$
! mv $MOTD_FILE.$$ $MOTD_FILE
  
  ed - $GETTYDEFS_FILE <<_Gettydefs_update_version_ 2>/dev/null >/dev/null
  g/Version [XTV0-9]*\\.[0-9]*[^ ]*/s//Version `uname -r`/
--- 33,42 ----
  (strings -14 "/`sizer -b`" | grep 'DEC OSF/1 .* (Rev'; \
  test -x $UWS_VERS_CMD && $UWS_VERS_CMD; \
  test -f $MOTD_FILE && grep -v 'DEC OSF/1 .* (Rev' <$MOTD_FILE)>$MOTD_FILE.$$
! # copy to preserve owner, group, permission, linkage, etc.
! #mv $MOTD_FILE.$$ $MOTD_FILE
! cp -f $MOTD_FILE.$$ $MOTD_FILE
! rm -f $MOTD_FILE.$$
  
  ed - $GETTYDEFS_FILE <<_Gettydefs_update_version_ 2>/dev/null >/dev/null
  g/Version [XTV0-9]*\\.[0-9]*[^ ]*/s//Version `uname -r`/
Received on Wed Mar 01 1995 - 13:32:28 NZDT

This archive was generated by hypermail 2.4.0 : Wed Nov 08 2023 - 11:53:45 NZDT