Skip to content

Commit 0cb5b93

Browse files
committed
hooks: update motd handling and remove 50-motd-news
The base-files package grew a new /etc/update-motd.d/50-motd-news script during the lifetime of Core 16. This script wants to write to the non-writable /var/cache/motd-news location and also needs curl to work. So it fails and that leads to breaking the /etc/update-motd.d/00-header script. This commit disables the script and also adds a check to ensure that no new files are added to /etc/update-motd.d without us noticing.
1 parent 9c67e47 commit 0cb5b93

1 file changed

Lines changed: 15 additions & 0 deletions

File tree

live-build/hooks/14-set-motd.chroot

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,18 @@ EOF
2020
# in particular the 'help' message but leave the 'Welcome'
2121
# string which is autogenerated based on uname -a and such.
2222
rm /etc/update-motd.d/10-help-text
23+
24+
# Ensure there is no motd-news. If that file is there the
25+
# /etc/update-motd.d/50-motd-news script will try to fetch news from
26+
# motd.ubuntu.com but will fail and cause /etc/update-motd.d/00-header
27+
# not to run.
28+
#
29+
# See also: https://github.com/snapcore/core18/pull/168
30+
! test -e /etc/default/motd-news
31+
32+
# fail if anything in update-motd.d changed so that we can inspect/update
33+
if [ "$(find /etc/update-motd.d/ -type f | wc -l)" != 2 ]; then
34+
echo "The /etc/update-motd.d/ directory content changed, please inspect:"
35+
ls -l /etc/update-motd.d
36+
exit 1
37+
fi

0 commit comments

Comments
 (0)