diff --git a/live-build/hooks/14-set-motd.chroot b/live-build/hooks/14-set-motd.chroot index f8b0cc3..4c9fbbd 100644 --- a/live-build/hooks/14-set-motd.chroot +++ b/live-build/hooks/14-set-motd.chroot @@ -20,3 +20,23 @@ EOF # in particular the 'help' message but leave the 'Welcome' # string which is autogenerated based on uname -a and such. rm /etc/update-motd.d/10-help-text + +# fail if anything in update-motd.d changed so that we can inspect/update +needle="00-header 50-motd-news" +if [ "$(find /etc/update-motd.d/ | sort |cut -f4 -d/ | xargs echo)" = "$needle" ]; then + echo "The /etc/update-motd.d/ directory content changed, please inspect:" + ls -l /etc/update-motd.d + exit 1 +fi + +# Ensure there is no motd-news. If that file is there the +# /etc/update-motd.d/50-motd-news script will try to fetch news from +# motd.ubuntu.com but will fail and cause /etc/update-motd.d/00-header +# not to run. +# +# See also: https://github.com/snapcore/core18/pull/168 +! test -e /etc/default/motd-news +# the base-files split in LP:1888575 leaves a /etc/default/motd-news.wasremoved +# For details, see +# https://bugs.launchpad.net/ubuntu/+source/base-files/+bug/1888575/comments/21 +rm -f /etc/default/motd-news.wasremoved